[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201118165107.12419-2-W_Armin@gmx.de>
Date: Wed, 18 Nov 2020 17:51:06 +0100
From: Armin Wolf <W_Armin@....de>
To: kuba@...nel.org
Cc: netdev@...r.kernel.org, davem@...emloft.net, f.fainelli@...il.com,
joe@...ches.com
Subject: [PATCH net-next v2 1/2] lib8390: Use eth_skb_pad()
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@....de>
---
drivers/net/ethernet/8390/lib8390.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
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
--
2.20.1
Powered by blists - more mailing lists