From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeff Garzik <jgarzik@pobox.com>, Samuel Chessman <chessman@tux.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 1/7] tlan: get rid of padding buffer
Date: Fri, 30 May 2008 09:49:52 -0700 [thread overview]
Message-ID: <20080530165033.445403629@vyatta.com> (raw)
In-Reply-To: 20080530164951.033143725@vyatta.com
[-- Attachment #1: tlan-pad.patch --]
[-- Type: text/plain, Size: 2868 bytes --]
Use skb_padto to pad frames, this avoid allocation of separate buffer just
for dma of the extra bytes.
Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tlan.c 2008-05-30 08:44:39.000000000 -0700
+++ b/drivers/net/tlan.c 2008-05-30 08:46:19.000000000 -0700
@@ -218,8 +218,6 @@ static int bbuf;
module_param(bbuf, int, 0);
MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)");
-static u8 *TLanPadBuffer;
-static dma_addr_t TLanPadBufferDMA;
static char TLanSignature[] = "TLAN";
static const char tlan_banner[] = "ThunderLAN driver v1.15\n";
static int tlan_have_pci;
@@ -469,16 +467,6 @@ static int __init tlan_probe(void)
printk(KERN_INFO "%s", tlan_banner);
- TLanPadBuffer = (u8 *) pci_alloc_consistent(NULL, TLAN_MIN_FRAME_SIZE, &TLanPadBufferDMA);
-
- if (TLanPadBuffer == NULL) {
- printk(KERN_ERR "TLAN: Could not allocate memory for pad buffer.\n");
- rc = -ENOMEM;
- goto err_out;
- }
-
- memset(TLanPadBuffer, 0, TLAN_MIN_FRAME_SIZE);
-
TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n");
/* Use new style PCI probing. Now the kernel will
@@ -506,8 +494,6 @@ static int __init tlan_probe(void)
err_out_pci_unreg:
pci_unregister_driver(&tlan_driver);
err_out_pci_free:
- pci_free_consistent(NULL, TLAN_MIN_FRAME_SIZE, TLanPadBuffer, TLanPadBufferDMA);
-err_out:
return rc;
}
@@ -724,8 +710,6 @@ static void __exit tlan_exit(void)
if (tlan_have_eisa)
TLan_Eisa_Cleanup();
- pci_free_consistent(NULL, TLAN_MIN_FRAME_SIZE, TLanPadBuffer, TLanPadBufferDMA);
-
}
@@ -1096,7 +1080,6 @@ static int TLan_StartTx( struct sk_buff
TLanList *tail_list;
dma_addr_t tail_list_phys;
u8 *tail_buffer;
- int pad;
unsigned long flags;
if ( ! priv->phyOnline ) {
@@ -1105,6 +1088,9 @@ static int TLan_StartTx( struct sk_buff
return 0;
}
+ if (skb_padto(skb, TLAN_MIN_FRAME_SIZE))
+ return 0;
+
tail_list = priv->txList + priv->txTail;
tail_list_phys = priv->txListDMA + sizeof(TLanList) * priv->txTail;
@@ -1125,19 +1111,10 @@ static int TLan_StartTx( struct sk_buff
TLan_StoreSKB(tail_list, skb);
}
- pad = TLAN_MIN_FRAME_SIZE - skb->len;
-
- if ( pad > 0 ) {
- tail_list->frameSize = (u16) skb->len + pad;
- tail_list->buffer[0].count = (u32) skb->len;
- tail_list->buffer[1].count = TLAN_LAST_BUFFER | (u32) pad;
- tail_list->buffer[1].address = TLanPadBufferDMA;
- } else {
- tail_list->frameSize = (u16) skb->len;
- tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) skb->len;
- tail_list->buffer[1].count = 0;
- tail_list->buffer[1].address = 0;
- }
+ tail_list->frameSize = (u16) skb->len;
+ tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) skb->len;
+ tail_list->buffer[1].count = 0;
+ tail_list->buffer[1].address = 0;
spin_lock_irqsave(&priv->lock, flags);
tail_list->cStat = TLAN_CSTAT_READY;
--
next prev parent reply other threads:[~2008-05-30 16:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 16:49 [PATCH 0/7] TLAN driver cleanups Stephen Hemminger
2008-05-30 16:49 ` Stephen Hemminger [this message]
2008-05-31 2:19 ` [PATCH 1/7] tlan: get rid of padding buffer Jeff Garzik
2008-05-30 16:49 ` [PATCH 2/7] tlan: use netdevice stats Stephen Hemminger
2008-05-30 16:49 ` [PATCH 3/7] tlan: remove unused devName field Stephen Hemminger
2008-05-30 16:49 ` [PATCH 4/7] tlan: 64bit conversion Stephen Hemminger
2008-05-30 16:49 ` [PATCH 5/7] tlan: manage rx allocation failure better Stephen Hemminger
2008-05-30 16:49 ` [PATCH 6/7] tlan: proper shared IRQ support Stephen Hemminger
2008-05-30 16:49 ` [PATCH 7/7] tlan: wrap source lines Stephen Hemminger
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=20080530165033.445403629@vyatta.com \
--to=shemminger@vyatta.com \
--cc=chessman@tux.org \
--cc=jgarzik@pobox.com \
--cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.