aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2006-04-07 04:10:41 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-04-24 16:15:51 -0400
commit8d5be088263b0d3dbb7e7959b7c403b3d026a5d3 (patch)
tree912fd8275e7f96a22f3c4935ffba86a520e97b63 /drivers/net
parent6b61626290900f12b7f3978f57f329da6811fb59 (diff)
[PATCH] orinoco: don't use any padding for Tx frames
hermes_bap_pwrite() supports odd-sized packets now. There is no minimal packet size for 802.11. Also, hermes_bap_pwrite() supports odd-sized packets now. This removes all reasons to pad the Tx data. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/hermes.c38
-rw-r--r--drivers/net/wireless/hermes.h2
-rw-r--r--drivers/net/wireless/orinoco.c25
3 files changed, 7 insertions, 58 deletions
diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c
index be24f01ea469..2aa2f389c0d5 100644
--- a/drivers/net/wireless/hermes.c
+++ b/drivers/net/wireless/hermes.c
@@ -424,43 +424,6 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
424 return err; 424 return err;
425} 425}
426 426
427/* Write a block of data to the chip's buffer with padding if
428 * neccessary, via the BAP. Synchronization/serialization is the
429 * caller's problem.
430 *
431 * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
432 */
433int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, int len,
434 u16 id, u16 offset)
435{
436 int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
437 int err = 0;
438
439 if (len < 0 || data_len > len)
440 return -EINVAL;
441
442 err = hermes_bap_seek(hw, bap, id, offset);
443 if (err)
444 goto out;
445
446 /* Transfer all the complete words of data */
447 hermes_write_bytes(hw, dreg, buf, data_len);
448 /* If there is an odd byte left over pad and transfer it */
449 if (data_len & 1) {
450 u8 end[2];
451 end[1] = 0;
452 end[0] = ((unsigned char *)buf)[data_len - 1];
453 hermes_write_bytes(hw, dreg, end, 2);
454 data_len ++;
455 }
456 /* Now send zeros for the padding */
457 if (data_len < len)
458 hermes_clear_words(hw, dreg, (len - data_len) / 2);
459 /* Complete */
460 out:
461 return err;
462}
463
464/* Read a Length-Type-Value record from the card. 427/* Read a Length-Type-Value record from the card.
465 * 428 *
466 * If length is NULL, we ignore the length read from the card, and 429 * If length is NULL, we ignore the length read from the card, and
@@ -548,7 +511,6 @@ EXPORT_SYMBOL(hermes_allocate);
548 511
549EXPORT_SYMBOL(hermes_bap_pread); 512EXPORT_SYMBOL(hermes_bap_pread);
550EXPORT_SYMBOL(hermes_bap_pwrite); 513EXPORT_SYMBOL(hermes_bap_pwrite);
551EXPORT_SYMBOL(hermes_bap_pwrite_pad);
552EXPORT_SYMBOL(hermes_read_ltv); 514EXPORT_SYMBOL(hermes_read_ltv);
553EXPORT_SYMBOL(hermes_write_ltv); 515EXPORT_SYMBOL(hermes_write_ltv);
554 516
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h
index e1b279e1bf32..8e3f0e3edb58 100644
--- a/drivers/net/wireless/hermes.h
+++ b/drivers/net/wireless/hermes.h
@@ -359,8 +359,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
359 u16 id, u16 offset); 359 u16 id, u16 offset);
360int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, 360int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
361 u16 id, u16 offset); 361 u16 id, u16 offset);
362int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf,
363 unsigned data_len, int len, u16 id, u16 offset);
364int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, 362int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
365 u16 *length, void *buf); 363 u16 *length, void *buf);
366int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, 364int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 173e9e4523c0..9fde17bebebf 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -423,7 +423,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
423 u16 txfid = priv->txfid; 423 u16 txfid = priv->txfid;
424 char *p; 424 char *p;
425 struct ethhdr *eh; 425 struct ethhdr *eh;
426 int len, data_len, data_off; 426 int data_len, data_off;
427 struct hermes_tx_descriptor desc; 427 struct hermes_tx_descriptor desc;
428 unsigned long flags; 428 unsigned long flags;
429 429
@@ -455,13 +455,10 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
455 return NETDEV_TX_OK; 455 return NETDEV_TX_OK;
456 } 456 }
457 457
458 /* Length of the packet body */ 458 /* Check packet length */
459 /* FIXME: what if the skb is smaller than this? */ 459 data_len = skb->len;
460 len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN); 460 if (data_len < ETH_HLEN)
461 skb = skb_padto(skb, len);
462 if (skb == NULL)
463 goto fail; 461 goto fail;
464 len -= ETH_HLEN;
465 462
466 eh = (struct ethhdr *)skb->data; 463 eh = (struct ethhdr *)skb->data;
467 464
@@ -485,7 +482,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
485 /* Encapsulate Ethernet-II frames */ 482 /* Encapsulate Ethernet-II frames */
486 if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ 483 if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
487 struct header_struct hdr; 484 struct header_struct hdr;
488 data_len = len; 485 data_len = skb->len - ETH_HLEN;
489 data_off = HERMES_802_3_OFFSET + sizeof(hdr); 486 data_off = HERMES_802_3_OFFSET + sizeof(hdr);
490 p = skb->data + ETH_HLEN; 487 p = skb->data + ETH_HLEN;
491 488
@@ -507,21 +504,13 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
507 stats->tx_errors++; 504 stats->tx_errors++;
508 goto fail; 505 goto fail;
509 } 506 }
510 /* Actual xfer length - allow for padding */
511 len = ALIGN(data_len, 2);
512 if (len < ETH_ZLEN - ETH_HLEN)
513 len = ETH_ZLEN - ETH_HLEN;
514 } else { /* IEEE 802.3 frame */ 507 } else { /* IEEE 802.3 frame */
515 data_len = len + ETH_HLEN; 508 data_len = skb->len;
516 data_off = HERMES_802_3_OFFSET; 509 data_off = HERMES_802_3_OFFSET;
517 p = skb->data; 510 p = skb->data;
518 /* Actual xfer length - round up for odd length packets */
519 len = ALIGN(data_len, 2);
520 if (len < ETH_ZLEN)
521 len = ETH_ZLEN;
522 } 511 }
523 512
524 err = hermes_bap_pwrite_pad(hw, USER_BAP, p, data_len, len, 513 err = hermes_bap_pwrite(hw, USER_BAP, p, data_len,
525 txfid, data_off); 514 txfid, data_off);
526 if (err) { 515 if (err) {
527 printk(KERN_ERR "%s: Error %d writing packet to BAP\n", 516 printk(KERN_ERR "%s: Error %d writing packet to BAP\n",