diff mbox series

[net-next,v2,1/2] lib8390: Use eth_skb_pad()

Message ID 20201118165107.12419-2-W_Armin@gmx.de
State New
Headers show
Series lib8390: Remove custom padding solution | expand

Commit Message

Armin Wolf Nov. 18, 2020, 4:51 p.m. UTC
According to Joe Perches, this bit seems less than optimal
because it overwrites already zeroed content. But instead of
fixing the custom padding solution, replace them entirely
with generic eth_skb_pad().

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/net/ethernet/8390/lib8390.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--
2.20.1
diff mbox series

Patch

diff --git a/drivers/net/ethernet/8390/lib8390.c b/drivers/net/ethernet/8390/lib8390.c
index e84021282edf..b3499714f7e0 100644
--- a/drivers/net/ethernet/8390/lib8390.c
+++ b/drivers/net/ethernet/8390/lib8390.c
@@ -305,17 +305,17 @@  static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
 {
 	unsigned long e8390_base = dev->base_addr;
 	struct ei_device *ei_local = netdev_priv(dev);
-	int send_length = skb->len, output_page;
+	int send_length, output_page;
 	unsigned long flags;
-	char buf[ETH_ZLEN];
-	char *data = skb->data;
-
-	if (skb->len < ETH_ZLEN) {
-		memset(buf, 0, ETH_ZLEN);	/* more efficient than doing just the needed bits */
-		memcpy(buf, data, skb->len);
-		send_length = ETH_ZLEN;
-		data = buf;
+	char *data;
+
+	/* The Hardware does not pad undersized frames */
+	if (eth_skb_pad(skb)) {
+		dev->stats.tx_dropped++;
+		return NETDEV_TX_OK;
 	}
+	data = skb->data;
+	send_length = skb->len;

 	/* Mask interrupts from the ethercard.
 	   SMP: We have to grab the lock here otherwise the IRQ handler