Skip to contentSkip to conversation

hinic: use skb_put_padto()

PATCH Applied Eric Dumazet 2 participants 2 messages Oct 16 – Oct 20

Subsystems (3)
lore
Share & tools
lore

Eric Dumazet

author maintainer
#0 lore raw

PATCH 1/1 hinic: use skb_put_padto()

hinic_xmit_frame() pads short frames with skb_pad(), then sets skb->len directly, leaving skb->tail stale.

Use skb_put_padto(), which updates both and is a litle less confusing.

Also remove one pointless netdev_err() call.

---
Cc: Cai Huoqing <[email protected]>
Cc: Andrew Lunn <[email protected]>
---
Part of a medium plan to get rid of skb_pad(), source of many mistakes.

 drivers/net/ethernet/huawei/hinic/hinic_tx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/huawei/hinic/hinic_tx.c +2 -8
index 9b60966736db537ae87e2871a977975c4c6b919d..899d103f24803b3731240f5982c9545c2e390b38 100644
@@ -563,14 +563,8 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	txq = &nic_dev->txqs[q_id];
 	qp = container_of(txq->sq, struct hinic_qp, sq);
 
-	if (skb->len < MIN_SKB_LEN) {
-		if (skb_pad(skb, MIN_SKB_LEN - skb->len)) {
-			netdev_err(netdev, "Failed to pad skb\n");
-			goto update_error_stats;
-		}
-
-		skb->len = MIN_SKB_LEN;
-	}
+	if (skb_put_padto(skb, MIN_SKB_LEN))
+		goto update_error_stats;
 
 	nr_sges = skb_shinfo(skb)->nr_frags + 1;
 	if (nr_sges > 17) {
Signature · 1 line
2.53.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 16 Oct 2026 11:35:18 +0200 you wrote:

hinic_xmit_frame() pads short frames with skb_pad(), then sets skb->len directly, leaving skb->tail stale.

Use skb_put_padto(), which updates both and is a litle less confusing.

Also remove one pointless netdev_err() call.

[...]

Here is the summary with links:
- [net-next] hinic: use skb_put_padto()

    https://git.kernel.org/netdev/net-next/c/42ee6e77ab45

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html