diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-06-22 09:25:34 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-22 23:32:02 -0400 |
commit | aa95abefccc25efea5c8654bc3475e8161319b94 (patch) | |
tree | cd2611a0998be1e68ce10d3a5cd6d7e4c6810a03 | |
parent | c7985051dec26dc5ae2562a975a0b37b70621f3f (diff) |
[PATCH] skb_padto()-area fixes in 8390, wavelan
Ar Iau, 2006-06-22 am 21:29 +1000, ysgrifennodd Herbert Xu:
> Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> >
> > The 8390 change (corrected version) also makes 8390.c faster so should
> > be applied anyway, and the orinoco one fixes some code that isn't even
> > needed and someone forgot to remove long ago. Otherwise the skb_padto
>
> Yeah I agree totally. However, I haven't actually seen the fixed 8390
> version being posted yet or at least not to netdev :)
Ah the resounding clang of a subtle hint ;)
Signed-off-by: Alan Cox <alan@redhat.com>
- Return 8390.c to the old way of handling short packets (which is also
faster)
- Remove the skb_padto from orinoco. This got left in when the padding bad
write patch was added and is actually not needed. This is fixing a merge
error way back when.
- Wavelan can also use the stack based buffer trick if you want
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/8390.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan.c | 14 |
2 files changed, 14 insertions, 10 deletions
diff --git a/drivers/net/8390.c b/drivers/net/8390.c index f87027420081..86be96af9c8f 100644 --- a/drivers/net/8390.c +++ b/drivers/net/8390.c | |||
@@ -275,12 +275,14 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
275 | struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); | 275 | struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); |
276 | int send_length = skb->len, output_page; | 276 | int send_length = skb->len, output_page; |
277 | unsigned long flags; | 277 | unsigned long flags; |
278 | char buf[ETH_ZLEN]; | ||
279 | char *data = skb->data; | ||
278 | 280 | ||
279 | if (skb->len < ETH_ZLEN) { | 281 | if (skb->len < ETH_ZLEN) { |
280 | skb = skb_padto(skb, ETH_ZLEN); | 282 | memset(buf, 0, ETH_ZLEN); /* more efficient than doing just the needed bits */ |
281 | if (skb == NULL) | 283 | memcpy(buf, data, skb->len); |
282 | return 0; | ||
283 | send_length = ETH_ZLEN; | 284 | send_length = ETH_ZLEN; |
285 | data = buf; | ||
284 | } | 286 | } |
285 | 287 | ||
286 | /* Mask interrupts from the ethercard. | 288 | /* Mask interrupts from the ethercard. |
@@ -347,7 +349,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
347 | * trigger the send later, upon receiving a Tx done interrupt. | 349 | * trigger the send later, upon receiving a Tx done interrupt. |
348 | */ | 350 | */ |
349 | 351 | ||
350 | ei_block_output(dev, send_length, skb->data, output_page); | 352 | ei_block_output(dev, send_length, data, output_page); |
351 | 353 | ||
352 | if (! ei_local->txing) | 354 | if (! ei_local->txing) |
353 | { | 355 | { |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index b327b640823b..5b69befdab74 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -2903,6 +2903,7 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev) | |||
2903 | { | 2903 | { |
2904 | net_local *lp = (net_local *) dev->priv; | 2904 | net_local *lp = (net_local *) dev->priv; |
2905 | unsigned long flags; | 2905 | unsigned long flags; |
2906 | char data[ETH_ZLEN]; | ||
2906 | 2907 | ||
2907 | #ifdef DEBUG_TX_TRACE | 2908 | #ifdef DEBUG_TX_TRACE |
2908 | printk(KERN_DEBUG "%s: ->wavelan_packet_xmit(0x%X)\n", dev->name, | 2909 | printk(KERN_DEBUG "%s: ->wavelan_packet_xmit(0x%X)\n", dev->name, |
@@ -2937,15 +2938,16 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev) | |||
2937 | * able to detect collisions, therefore in theory we don't really | 2938 | * able to detect collisions, therefore in theory we don't really |
2938 | * need to pad. Jean II */ | 2939 | * need to pad. Jean II */ |
2939 | if (skb->len < ETH_ZLEN) { | 2940 | if (skb->len < ETH_ZLEN) { |
2940 | skb = skb_padto(skb, ETH_ZLEN); | 2941 | memset(data, 0, ETH_ZLEN); |
2941 | if (skb == NULL) | 2942 | memcpy(data, skb->data, skb->len); |
2942 | return 0; | 2943 | /* Write packet on the card */ |
2944 | if(wv_packet_write(dev, data, ETH_ZLEN)) | ||
2945 | return 1; /* We failed */ | ||
2943 | } | 2946 | } |
2944 | 2947 | else if(wv_packet_write(dev, skb->data, skb->len)) | |
2945 | /* Write packet on the card */ | ||
2946 | if(wv_packet_write(dev, skb->data, skb->len)) | ||
2947 | return 1; /* We failed */ | 2948 | return 1; /* We failed */ |
2948 | 2949 | ||
2950 | |||
2949 | dev_kfree_skb(skb); | 2951 | dev_kfree_skb(skb); |
2950 | 2952 | ||
2951 | #ifdef DEBUG_TX_TRACE | 2953 | #ifdef DEBUG_TX_TRACE |