Skip to contentSkip to conversation

r8169: fix 8168evl frame padding.

PATCH In review Francois Romieu 2 participants 2 messages Apr 26, 2013 – Apr 29, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 r8169: fix 8168evl frame padding.

From: Stefan Bader <[email protected]>

---

Stefan reported that Realtek's driver solves his problem as well. It works differently though: skb_checksum_help vs skb_pad here.

 drivers/net/ethernet/realtek/r8169.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ethernet/realtek/r8169.c +9 -0
index 4ecbe64..15ba8c4 100644
@@ -5787,6 +5787,14 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 		goto err_stop_0;
 	}
 
+	/* 8168evl does not automatically pad to minimum length. */
+	if (unlikely(tp->mac_version == RTL_GIGA_MAC_VER_34 &&
+		     skb->len < ETH_ZLEN)) {
+		if (skb_padto(skb, ETH_ZLEN))
+			goto err_update_stats;
+		skb_put(skb, ETH_ZLEN - skb->len);
+	}
+
 	if (unlikely(le32_to_cpu(txd->opts1) & DescOwn))
 		goto err_stop_0;
 
@@ -5858,6 +5866,7 @@ err_dma_1:
 	rtl8169_unmap_tx_skb(d, tp->tx_skb + entry, txd);
 err_dma_0:
 	dev_kfree_skb(skb);
+err_update_stats:
 	dev->stats.tx_dropped++;
 	return NETDEV_TX_OK;
 
Signature · 1 line
1.8.1.4