From: Francois Romieu <romieu@cogenit.fr>
To: Jeff Garzik <jgarzik@mandrakesoft.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 5/10
Date: Sun, 30 Jun 2002 17:19:31 +0200 [thread overview]
Message-ID: <20020630171931.G19347@fafner.intra.cogenit.fr> (raw)
In-Reply-To: <3D17743E.8060905@mandrakesoft.com>; from jgarzik@mandrakesoft.com on Mon, Jun 24, 2002 at 03:34:22PM -0400
- more code duplication removal.
--- linux-2.5.24/drivers/net/tlan.c Sat Jun 29 23:09:16 2002
+++ linux-2.5.24/drivers/net/tlan.c Sat Jun 29 23:18:19 2002
@@ -296,6 +296,8 @@ static int TLan_ioctl( struct net_device
static int TLan_probe1( struct pci_dev *pdev, long ioaddr, int irq, int rev, const struct pci_device_id *ent);
static void TLan_tx_timeout( struct net_device *dev);
static int tlan_init_one( struct pci_dev *pdev, const struct pci_device_id *ent);
+static void TLan_ResetTxBuffer(struct pci_dev *, TLanList *);
+static void TLan_ResetRxBuffer(struct pci_dev *, TLanList *);
static void TLan_Release_Dev(struct net_device *);
static u32 TLan_HandleInvalid( struct net_device *, u16 );
@@ -1349,14 +1351,8 @@ u32 TLan_HandleTxEOF( struct net_device
while (((tmpCStat = head_list->cStat ) & TLAN_CSTAT_FRM_CMP) && (ack < 255)) {
ack++;
- if ( ! bbuf ) {
- struct sk_buff *skb = (struct sk_buff *)head_list->buffer[9].address;
-
- pci_unmap_single(pdev, head_list->buffer[0].address,
- skb->len, PCI_DMA_TODEVICE);
- dev_kfree_skb_any(skb);
- head_list->buffer[9].address = 0;
- }
+ if ( ! bbuf )
+ TLan_ResetTxBuffer(pdev, head_list);
if ( tmpCStat & TLAN_CSTAT_EOC )
eoc = 1;
@@ -1948,37 +1944,42 @@ void TLan_ResetLists( struct net_device
} /* TLan_ResetLists */
-
-void TLan_FreeLists( struct net_device *dev )
+static void TLan_ResetTxBuffer(struct pci_dev *pdev, TLanList *list)
{
- TLanPrivateInfo *priv = dev->priv;
- struct pci_dev *pdev = priv->pci_dev;
- int i;
- TLanList *list;
- struct sk_buff *skb;
+ struct sk_buff *skb = (struct sk_buff *) list->buffer[9].address;
- if ( ! bbuf ) {
- for ( i = 0; i < TLAN_NUM_TX_LISTS; i++ ) {
- list = priv->txList + i;
- skb = (struct sk_buff *) list->buffer[9].address;
- if ( skb ) {
- pci_unmap_single(pdev, list->buffer[0].address,
- skb->len, PCI_DMA_TODEVICE);
- dev_kfree_skb_any( skb );
+ if (skb) {
+ pci_unmap_single(pdev, list->buffer[0].address, skb->len,
+ PCI_DMA_TODEVICE);
+ dev_kfree_skb_any(skb);
list->buffer[9].address = 0;
}
- }
+}
+
+static void TLan_ResetRxBuffer(struct pci_dev *pdev, TLanList *list)
+{
+ struct sk_buff *skb = (struct sk_buff *) list->buffer[9].address;
- for ( i = 0; i < TLAN_NUM_RX_LISTS; i++ ) {
- list = priv->rxList + i;
skb = (struct sk_buff *) list->buffer[9].address;
- if ( skb ) {
+ if (skb) {
pci_unmap_single(pdev, list->buffer[0].address,
TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE);
- dev_kfree_skb_any( skb );
+ dev_kfree_skb_any(skb);
list->buffer[9].address = 0;
}
- }
+}
+
+void TLan_FreeLists( struct net_device *dev )
+{
+ TLanPrivateInfo *priv = dev->priv;
+ struct pci_dev *pdev = priv->pci_dev;
+ int i;
+
+ if ( ! bbuf ) {
+ for (i = 0; i < TLAN_NUM_TX_LISTS; i++)
+ TLan_ResetTxBuffer(pdev, priv->txList + i);
+ for (i = 0; i < TLAN_NUM_RX_LISTS; i++)
+ TLan_ResetRxBuffer(pdev, priv->rxList + i);
}
} /* TLan_FreeLists */
next prev parent reply other threads:[~2002-06-30 15:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-24 2:34 [PATCH] 2.5.24 : drivers/net/tlan.c Frank Davis
2002-06-24 6:43 ` Francois Romieu
2002-06-24 19:14 ` [PATCH] 2.5.24 : drivers/net/tlan.c; drivers/net/rrunner.c Francois Romieu
2002-06-24 19:34 ` Jeff Garzik
2002-06-24 20:59 ` Dave Jones
2002-06-30 15:18 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 0/10 Francois Romieu
2002-06-30 15:18 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 1/10 Francois Romieu
2002-06-30 15:19 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 2/10 Francois Romieu
2002-06-30 15:19 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 3/10 Francois Romieu
2002-06-30 15:19 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 4/10 Francois Romieu
2002-06-30 15:19 ` Francois Romieu [this message]
2002-06-30 15:19 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 6/10 Francois Romieu
2002-06-30 15:19 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 7/10 Francois Romieu
2002-06-30 15:19 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 8/10 Francois Romieu
2002-06-30 15:20 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 9/10 Francois Romieu
2002-06-30 15:20 ` [PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 10/10 Francois Romieu
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=20020630171931.G19347@fafner.intra.cogenit.fr \
--to=romieu@cogenit.fr \
--cc=jgarzik@mandrakesoft.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®