🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Eric Dumazet Fri, 16 Oct 2026 09:35
[PATCH net-next] hinic: use skb_put_padto()
#3924
Author: Eric Dumazet
Date: Fri, 16 Oct 2026 09:35
41 lines
6504 bytes
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.

Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
Cc: Cai Huoqing <cai.huoqing@linux.dev>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
---
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(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
index 9b60966736db537ae87e2871a977975c4c6b919d..899d103f24803b3731240f5982c9545c2e390b38 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
@@ -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) {
-- 
2.53.0
Re: [PATCH net-next] hinic: use skb_put_padto()
#5696
Author: patchwork-bot+netdevbpf
Date: Tue, 20 Oct 2026 20:30
24 lines
8468 bytes
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads