[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH net-next v2 09/10] qlcnic: use pskb_may_pull() to pull excess TX frags into the head




> -----Original Message-----
> From: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Sent: Thursday, October 8, 2026 11:03 PM
> To: Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>;
> Eric Dumazet <edumazet@xxxxxxxxxx>; David S. Miller
> <davem@xxxxxxxxxxxxx>; Andrew Lunn <andrew+netdev@xxxxxxx>
> Cc: Saeed Mahameed <saeedm@xxxxxxxxxx>; Tariq Toukan
> <tariqt@xxxxxxxxxx>; Mark Bloch <mbloch@xxxxxxxxxx>; Leon Romanovsky
> <leon@xxxxxxxxxx>; Juergen Gross <jgross@xxxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Oleksandr Tyshchenko
> <oleksandr_tyshchenko@xxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Manish Chopra <manishc@xxxxxxxxxxx>;
> Rahul Verma <rahulv@xxxxxxxxxxx>; GR-Linux-NIC-Dev@xxxxxxxxxxx; Shahed
> Shaikh <shshaikh@xxxxxxxxxxx>; Simon Horman <horms@xxxxxxxxxx>;
> netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> rdma@xxxxxxxxxxxxxxx; xen-devel@xxxxxxxxxxxxxxxxxxxx; intel-wired-
> lan@xxxxxxxxxxxxxxxx; Josef Bacik <josef@xxxxxxxxxxxxxx>
> Subject: [PATCH net-next v2 09/10] qlcnic: use pskb_may_pull() to pull
> excess TX frags into the head
> 
> qlcnic_xmit_frame() pulls the frags that don't fit in a TX descriptor
> into the head with __pskb_pull_tail().  It already checks the result.
> Switch to pskb_may_pull(), which takes the length the head should end up
> with and checks it against the skb, so this driver no longer calls
> __pskb_pull_tail() directly.
> 
> __pskb_pull_tail() also releases empty frags, even when there's nothing
> to pull, so if the frags being pulled are all empty it still gets the
> frag count under the limit.  pskb_may_pull() returns early in that case,
> so follow it with skb_drop_empty_frags().
> 
> Assisted-by: LLM
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> index 761ef3bc8193..e7ab5586798b 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> @@ -682,7 +682,8 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb,
> struct net_device *netdev)
>               for (i = 0; i < (frag_count - QLCNIC_MAX_FRAGS_PER_TX);
> i++)
>                       delta += skb_frag_size(&skb_shinfo(skb)->frags[i]);
> 
> -             if (!__pskb_pull_tail(skb, delta))
> +             if (!pskb_may_pull(skb, skb_headlen(skb) + delta) ||
> +                 skb_drop_empty_frags(skb, GFP_ATOMIC))
>                       goto drop_packet;
> 
>               frag_count = 1 + skb_shinfo(skb)->nr_frags;
> 
> --
> 2.55.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.