netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski-mXXj517/zsQ@public.gmane.org>
To: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH 11/21] orinoco: don't use any padding for Tx frames
Date: Fri, 07 Apr 2006 04:10:41 -0400	[thread overview]
Message-ID: <20060407081041.16107.255.stgit@dv.roinet.com> (raw)
In-Reply-To: <20060407081019.16107.67672.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org>

From: Pavel Roskin <proski-mXXj517/zsQ@public.gmane.org>

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-mXXj517/zsQ@public.gmane.org>
---

 drivers/net/wireless/hermes.c  |   38 --------------------------------------
 drivers/net/wireless/hermes.h  |    2 --
 drivers/net/wireless/orinoco.c |   25 +++++++------------------
 3 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c
index be24f01..2aa2f38 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 
 	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.
  *
  * If length is NULL, we ignore the length read from the card, and
@@ -548,7 +511,6 @@ EXPORT_SYMBOL(hermes_allocate);
 
 EXPORT_SYMBOL(hermes_bap_pread);
 EXPORT_SYMBOL(hermes_bap_pwrite);
-EXPORT_SYMBOL(hermes_bap_pwrite_pad);
 EXPORT_SYMBOL(hermes_read_ltv);
 EXPORT_SYMBOL(hermes_write_ltv);
 
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h
index e1b279e..8e3f0e3 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 b
 		       u16 id, u16 offset);
 int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
 			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,
 		    u16 *length, void *buf);
 int 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 173e9e4..9fde17b 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -423,7 +423,7 @@ static int orinoco_xmit(struct sk_buff *
 	u16 txfid = priv->txfid;
 	char *p;
 	struct ethhdr *eh;
-	int len, data_len, data_off;
+	int data_len, data_off;
 	struct hermes_tx_descriptor desc;
 	unsigned long flags;
 
@@ -455,13 +455,10 @@ static int orinoco_xmit(struct sk_buff *
 		return NETDEV_TX_OK;
 	}
 
-	/* Length of the packet body */
-	/* FIXME: what if the skb is smaller than this? */
-	len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN);
-	skb = skb_padto(skb, len);
-	if (skb == NULL)
+	/* Check packet length */
+	data_len = skb->len;
+	if (data_len < ETH_HLEN)
 		goto fail;
-	len -= ETH_HLEN;
 
 	eh = (struct ethhdr *)skb->data;
 
@@ -485,7 +482,7 @@ static int orinoco_xmit(struct sk_buff *
 	/* Encapsulate Ethernet-II frames */
 	if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
 		struct header_struct hdr;
-		data_len = len;
+		data_len = skb->len - ETH_HLEN;
 		data_off = HERMES_802_3_OFFSET + sizeof(hdr);
 		p = skb->data + ETH_HLEN;
 
@@ -507,21 +504,13 @@ static int orinoco_xmit(struct sk_buff *
 			stats->tx_errors++;
 			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 */
-		data_len = len + ETH_HLEN;
+		data_len = skb->len;
 		data_off = HERMES_802_3_OFFSET;
 		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);
 	if (err) {
 		printk(KERN_ERR "%s: Error %d writing packet to BAP\n",



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

  parent reply	other threads:[~2006-04-07  8:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-07  8:10 [PATCH 01/21] orinoco: Remove useless CIS validation Pavel Roskin
     [not found] ` <20060407081019.16107.67672.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org>
2006-04-07  8:10   ` [PATCH 02/21] orinoco: remove PCMCIA audio support, it's useless for wireless cards Pavel Roskin
2006-04-07  8:10   ` [PATCH 03/21] orinoco: remove underscores from little-endian field names Pavel Roskin
2006-04-07  8:10   ` [PATCH 04/21] orinoco: fix truncating commsquality RID with the latest Symbol firmware Pavel Roskin
2006-04-07  8:10   ` [PATCH 05/21] orinoco: remove tracing code, it's unused Pavel Roskin
2006-04-07  8:10   ` [PATCH 06/21] orinoco: remove debug buffer code and userspace include support Pavel Roskin
2006-04-07  8:10   ` [PATCH 07/21] orinoco: Symbol card supported by spectrum_cs is LA4137, not LA4100 Pavel Roskin
2006-04-07  8:10   ` [PATCH 08/21] orinoco: optimize Tx exception handling in orinoco Pavel Roskin
2006-04-07  8:10   ` [PATCH 09/21] orinoco: orinoco_xmit() should only return valid symbolic constants Pavel Roskin
2006-04-07  8:10   ` [PATCH 10/21] orinoco replace hermes_write_words() with hermes_write_bytes() Pavel Roskin
2006-04-07  8:10   ` Pavel Roskin [this message]
2006-04-07  8:10   ` [PATCH 12/21] orinoco: refactor and clean up Tx error handling Pavel Roskin
2006-04-07  8:10   ` [PATCH 13/21] orinoco: simplify 802.3 encapsulation code Pavel Roskin
2006-04-07  8:10   ` [PATCH 14/21] orinoco: fix BAP0 offset error after several days of operation Pavel Roskin
2006-04-07  8:10   ` [PATCH 15/21] orinoco: delay FID allocation after firmware initialization Pavel Roskin
2006-04-07  8:10   ` [PATCH 16/21] orinoco_pci: disable device and free IRQ when suspending Pavel Roskin
     [not found]     ` <20060407081051.16107.87289.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org>
2006-04-07 21:24       ` Francois Romieu
     [not found]         ` <20060407212429.GA15720-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org>
2006-04-07 22:12           ` Pavel Roskin
2006-04-07 23:08             ` Francois Romieu
2006-04-07  8:10   ` [PATCH 17/21] orinoco_pci: use pci_iomap() for resources Pavel Roskin
     [not found]     ` <20060407081053.16107.19347.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org>
2006-04-07 21:36       ` Francois Romieu
     [not found]         ` <20060407213619.GB15720-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org>
2006-04-07 22:21           ` Pavel Roskin
2006-04-07 23:38             ` Francois Romieu
     [not found]               ` <20060407233819.GB15667-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org>
2006-04-08  0:07                 ` Pavel Roskin
     [not found]                   ` <20060407200731.mqskowo8808gccs8-2RFepEojUI3Rd1RZctBqVdHuzzzSOjJt@public.gmane.org>
2006-04-08 15:00                     ` Jeff Garzik
2006-04-07  8:10   ` [PATCH 18/21] orinoco: support PCI suspend/resume for Nortel, PLX and TMD adaptors Pavel Roskin
2006-04-07  8:10   ` [PATCH 19/21] orinoco: reduce differences between PCI drivers, create orinoco_pci.h Pavel Roskin
     [not found]     ` <20060407081057.16107.82106.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org>
2006-04-07 22:10       ` Francois Romieu
     [not found]         ` <20060407221041.GC15720-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org>
2006-04-07 22:43           ` Pavel Roskin
2006-04-07  8:11   ` [PATCH 20/21] orinoco: further comment cleanup in the PCI drivers Pavel Roskin
2006-04-07  8:11   ` [PATCH 21/21] orinoco: bump version to 0.15 Pavel Roskin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060407081041.16107.255.stgit@dv.roinet.com \
    --to=proski-mxxj517/zsq@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).