Commit 8d5be088 authored by Pavel Roskin's avatar Pavel Roskin Committed by John W. Linville

[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: default avatarPavel Roskin <proski@gnu.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6b616262
...@@ -424,43 +424,6 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, ...@@ -424,43 +424,6 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
return err; return err;
} }
/* Write a block of data to the chip's buffer with padding if
* neccessary, via the BAP. Synchronization/serialization is the
* caller's problem.
*
* Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
*/
int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, int len,
u16 id, u16 offset)
{
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
int err = 0;
if (len < 0 || data_len > len)
return -EINVAL;
err = hermes_bap_seek(hw, bap, id, offset);
if (err)
goto out;
/* Transfer all the complete words of data */
hermes_write_bytes(hw, dreg, buf, data_len);
/* If there is an odd byte left over pad and transfer it */
if (data_len & 1) {
u8 end[2];
end[1] = 0;
end[0] = ((unsigned char *)buf)[data_len - 1];
hermes_write_bytes(hw, dreg, end, 2);
data_len ++;
}
/* Now send zeros for the padding */
if (data_len < len)
hermes_clear_words(hw, dreg, (len - data_len) / 2);
/* Complete */
out:
return err;
}
/* Read a Length-Type-Value record from the card. /* Read a Length-Type-Value record from the card.
* *
* If length is NULL, we ignore the length read from the card, and * If length is NULL, we ignore the length read from the card, and
...@@ -548,7 +511,6 @@ EXPORT_SYMBOL(hermes_allocate); ...@@ -548,7 +511,6 @@ EXPORT_SYMBOL(hermes_allocate);
EXPORT_SYMBOL(hermes_bap_pread); EXPORT_SYMBOL(hermes_bap_pread);
EXPORT_SYMBOL(hermes_bap_pwrite); EXPORT_SYMBOL(hermes_bap_pwrite);
EXPORT_SYMBOL(hermes_bap_pwrite_pad);
EXPORT_SYMBOL(hermes_read_ltv); EXPORT_SYMBOL(hermes_read_ltv);
EXPORT_SYMBOL(hermes_write_ltv); EXPORT_SYMBOL(hermes_write_ltv);
......
...@@ -359,8 +359,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, ...@@ -359,8 +359,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
u16 id, u16 offset); u16 id, u16 offset);
int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
u16 id, u16 offset); u16 id, u16 offset);
int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf,
unsigned data_len, int len, u16 id, u16 offset);
int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
u16 *length, void *buf); u16 *length, void *buf);
int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
......
...@@ -423,7 +423,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -423,7 +423,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
u16 txfid = priv->txfid; u16 txfid = priv->txfid;
char *p; char *p;
struct ethhdr *eh; struct ethhdr *eh;
int len, data_len, data_off; int data_len, data_off;
struct hermes_tx_descriptor desc; struct hermes_tx_descriptor desc;
unsigned long flags; unsigned long flags;
...@@ -455,13 +455,10 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -455,13 +455,10 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
/* Length of the packet body */ /* Check packet length */
/* FIXME: what if the skb is smaller than this? */ data_len = skb->len;
len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN); if (data_len < ETH_HLEN)
skb = skb_padto(skb, len);
if (skb == NULL)
goto fail; goto fail;
len -= ETH_HLEN;
eh = (struct ethhdr *)skb->data; eh = (struct ethhdr *)skb->data;
...@@ -485,7 +482,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -485,7 +482,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
/* Encapsulate Ethernet-II frames */ /* Encapsulate Ethernet-II frames */
if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
struct header_struct hdr; struct header_struct hdr;
data_len = len; data_len = skb->len - ETH_HLEN;
data_off = HERMES_802_3_OFFSET + sizeof(hdr); data_off = HERMES_802_3_OFFSET + sizeof(hdr);
p = skb->data + ETH_HLEN; p = skb->data + ETH_HLEN;
...@@ -507,21 +504,13 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -507,21 +504,13 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
stats->tx_errors++; stats->tx_errors++;
goto fail; goto fail;
} }
/* Actual xfer length - allow for padding */
len = ALIGN(data_len, 2);
if (len < ETH_ZLEN - ETH_HLEN)
len = ETH_ZLEN - ETH_HLEN;
} else { /* IEEE 802.3 frame */ } else { /* IEEE 802.3 frame */
data_len = len + ETH_HLEN; data_len = skb->len;
data_off = HERMES_802_3_OFFSET; data_off = HERMES_802_3_OFFSET;
p = skb->data; p = skb->data;
/* Actual xfer length - round up for odd length packets */
len = ALIGN(data_len, 2);
if (len < ETH_ZLEN)
len = ETH_ZLEN;
} }
err = hermes_bap_pwrite_pad(hw, USER_BAP, p, data_len, len, err = hermes_bap_pwrite(hw, USER_BAP, p, data_len,
txfid, data_off); txfid, data_off);
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d writing packet to BAP\n", printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment