Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] hinic: use skb_put_padto()
@ 2026-10-16  9:35 Eric Dumazet
  0 siblings, 0 replies; only message in thread
From: Eric Dumazet @ 2026-10-16  9:35 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, Eric Dumazet, Cai Huoqing, Andrew Lunn

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-16  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16  9:35 [PATCH net-next] hinic: use skb_put_padto() Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox