From: jamal <hadi@cyberus.ca>
To: David Miller <davem@davemloft.net>
Cc: johnpol@2ka.mipt.ru, peter.p.waskiewicz.jr@intel.com,
kumarkr@linux.ibm.com, herbert@gondor.apana.org.au,
gaagaan@gmail.com, Robert.Olsson@data.slu.se,
netdev@vger.kernel.org, rdreier@cisco.com, mcarlson@broadcom.com,
randy.dunlap@oracle.com, jagana@us.ibm.com,
general@lists.openfabrics.org, mchan@broadcom.com, tgraf@suug.ch,
jeff@garzik.org, sri@us.ibm.com, shemminger@linux-foundation.org,
kaber@trash.net
Subject: [ofa-general] Re: [PATCHES] TX batching
Date: Sun, 30 Sep 2007 15:19:28 -0400 [thread overview]
Message-ID: <1191179969.6165.46.camel@localhost> (raw)
In-Reply-To: <1191178205.6165.25.camel@localhost>
[-- Attachment #1: Type: text/plain, Size: 149 bytes --]
And heres a patch that provides a sample of the usage for batching with
tg3.
Requires patch "[TG3]Some cleanups" i posted earlier.
cheers,
jamal
[-- Attachment #2: tg3.potoc --]
[-- Type: text/x-patch, Size: 5252 bytes --]
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5a864bd..9aafb78 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3103,6 +3103,13 @@ static inline u32 tg3_tx_avail(struct tg3 *tp)
((tp->tx_prod - tp->tx_cons) & (TG3_TX_RING_SIZE - 1)));
}
+static inline void tg3_set_win(struct tg3 *tp)
+{
+ tp->dev->xmit_win = tg3_tx_avail(tp) - (MAX_SKB_FRAGS + 1);
+ if (tp->dev->xmit_win < 1)
+ tp->dev->xmit_win = 1;
+}
+
/* Tigon3 never reports partial packet sends. So we do not
* need special logic to handle SKBs that have not had all
* of their frags sent yet, like SunGEM does.
@@ -3165,8 +3172,10 @@ static void tg3_tx(struct tg3 *tp)
(tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))) {
netif_tx_lock(tp->dev);
if (netif_queue_stopped(tp->dev) &&
- (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))
+ (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp))) {
+ tg3_set_win(tp);
netif_wake_queue(tp->dev);
+ }
netif_tx_unlock(tp->dev);
}
}
@@ -4007,8 +4016,13 @@ void tg3_kick_DMA(struct net_device *dev)
if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) {
netif_stop_queue(dev);
- if (tg3_tx_avail(tp) >= TG3_TX_WAKEUP_THRESH(tp))
+ dev->xmit_win = 1;
+ if (tg3_tx_avail(tp) >= TG3_TX_WAKEUP_THRESH(tp)) {
+ tg3_set_win(tp);
netif_wake_queue(dev);
+ }
+ } else {
+ tg3_set_win(tp);
}
mmiowb();
@@ -4085,6 +4099,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
if (!netif_queue_stopped(dev)) {
netif_stop_queue(dev);
+ tp->dev->xmit_win = 1;
/* This is a hard error, log it. */
printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
@@ -4100,6 +4115,25 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
return ret;
}
+static int tg3_start_bxmit(struct sk_buff *skb, struct net_device *dev)
+{
+ struct tg3 *tp = netdev_priv(dev);
+
+ if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
+ if (!netif_queue_stopped(dev)) {
+ netif_stop_queue(dev);
+ dev->xmit_win = 1;
+
+ /* This is a hard error, log it. */
+ printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
+ "queue awake!\n", dev->name);
+ }
+ return NETDEV_TX_BUSY;
+ }
+
+ return tg3_enqueue(skb, dev);
+}
+
static int tg3_start_xmit_dma_bug(struct sk_buff *, struct net_device *);
/* Use GSO to workaround a rare TSO bug that may be triggered when the
@@ -4112,9 +4146,11 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb)
/* Estimate the number of fragments in the worst case */
if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->gso_segs * 3))) {
netif_stop_queue(tp->dev);
+ tp->dev->xmit_win = 1;
if (tg3_tx_avail(tp) <= (skb_shinfo(skb)->gso_segs * 3))
return NETDEV_TX_BUSY;
+ tg3_set_win(tp);
netif_wake_queue(tp->dev);
}
@@ -4267,6 +4303,25 @@ static int tg3_enqueue_buggy(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
+static int tg3_start_bxmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
+{
+ struct tg3 *tp = netdev_priv(dev);
+
+ if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
+ if (!netif_queue_stopped(dev)) {
+ netif_stop_queue(dev);
+ dev->xmit_win = 1;
+
+ /* This is a hard error, log it. */
+ printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
+ "queue awake!\n", dev->name);
+ }
+ return NETDEV_TX_BUSY;
+ }
+
+ return tg3_enqueue_buggy(skb, dev);
+}
+
static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
{
struct tg3 *tp = netdev_priv(dev);
@@ -4283,6 +4338,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
if (!netif_queue_stopped(dev)) {
netif_stop_queue(dev);
+ dev->xmit_win = 1;
/* This is a hard error, log it. */
printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
@@ -11099,15 +11155,19 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
else
tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES;
+ tp->dev->hard_end_xmit = tg3_kick_DMA;
/* All chips before 5787 can get confused if TX buffers
* straddle the 4GB address boundary in some cases.
*/
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
- tp->dev->hard_start_xmit = tg3_start_xmit;
- else
- tp->dev->hard_start_xmit = tg3_start_xmit_dma_bug;
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+ tp->dev->hard_start_xmit = tg3_start_bxmit;
+ tp->dev->hard_prep_xmit = tg3_prep_frame;
+ } else {
+ tp->dev->hard_start_xmit = tg3_start_bxmit_dma_bug;
+ tp->dev->hard_prep_xmit = tg3_prep_bug_frame;
+ }
tp->rx_offset = 2;
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
@@ -11955,6 +12015,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
dev->watchdog_timeo = TG3_TX_TIMEOUT;
dev->change_mtu = tg3_change_mtu;
dev->irq = pdev->irq;
+ dev->features |= NETIF_F_BTX;
+ dev->xmit_win = tp->tx_pending >> 2;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = tg3_poll_controller;
#endif
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2007-09-30 19:19 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 9:00 [PATCH 0/10 REV5] Implement skb batching and support in IPoIB/E1000 Krishna Kumar
2007-09-14 9:01 ` [PATCH 1/10 REV5] [Doc] HOWTO Documentation for batching Krishna Kumar
2007-09-14 18:37 ` [ofa-general] " Randy Dunlap
2007-09-17 4:10 ` Krishna Kumar2
2007-09-17 4:13 ` [ofa-general] " Jeff Garzik
2007-09-14 9:01 ` [PATCH 2/10 REV5] [core] Add skb_blist & support " Krishna Kumar
2007-09-14 12:46 ` [ofa-general] " Evgeniy Polyakov
2007-09-17 3:51 ` Krishna Kumar2
2007-09-14 9:01 ` [PATCH 3/10 REV5] [sched] Modify qdisc_run to support batching Krishna Kumar
2007-09-14 12:15 ` [ofa-general] " Evgeniy Polyakov
2007-09-17 3:49 ` Krishna Kumar2
2007-09-14 9:02 ` [PATCH 4/10 REV5] [ethtool] Add ethtool support Krishna Kumar
2007-09-14 9:02 ` [PATCH 5/10 REV5] [IPoIB] Header file changes Krishna Kumar
2007-09-14 9:03 ` [PATCH 6/10 REV5] [IPoIB] CM & Multicast changes Krishna Kumar
2007-09-14 9:03 ` [PATCH 7/10 REV5] [IPoIB] Verbs changes Krishna Kumar
2007-09-14 9:03 ` [PATCH 8/10 REV5] [IPoIB] Post and work completion handler changes Krishna Kumar
2007-09-14 9:04 ` [PATCH 9/10 REV5] [IPoIB] Implement batching Krishna Kumar
2007-09-14 9:04 ` [PATCH 10/10 REV5] [E1000] " Krishna Kumar
2007-09-14 12:47 ` [ofa-general] " Evgeniy Polyakov
2007-09-17 3:56 ` Krishna Kumar2
2007-11-13 21:28 ` [ofa-general] " Kok, Auke
2007-11-14 8:30 ` Krishna Kumar2
2007-09-14 12:49 ` [ofa-general] Re: [PATCH 0/10 REV5] Implement skb batching and support in IPoIB/E1000 Evgeniy Polyakov
2007-09-16 23:17 ` David Miller
2007-09-17 0:29 ` jamal
2007-09-17 1:02 ` David Miller
2007-09-17 2:14 ` [ofa-general] " jamal
2007-09-17 2:25 ` David Miller
2007-09-17 3:01 ` jamal
2007-09-17 3:13 ` David Miller
2007-09-17 12:51 ` jamal
2007-09-17 16:37 ` [ofa-general] " David Miller
2007-09-17 4:46 ` Krishna Kumar2
2007-09-23 17:53 ` [PATCHES] TX batching jamal
2007-09-23 17:56 ` [ofa-general] [PATCH 1/4] [NET_SCHED] explict hold dev tx lock jamal
2007-09-23 17:58 ` [ofa-general] [PATCH 2/4] [NET_BATCH] Introduce batching interface jamal
2007-09-23 18:00 ` [PATCH 3/4][NET_BATCH] net core use batching jamal
2007-09-23 18:02 ` [ofa-general] [PATCH 4/4][NET_SCHED] kill dev->gso_skb jamal
2007-09-30 18:53 ` [ofa-general] [PATCH 3/3][NET_SCHED] " jamal
2007-10-07 18:39 ` [ofa-general] [PATCH 3/3][NET_BATCH] " jamal
2007-09-30 18:52 ` [ofa-general] [PATCH 2/3][NET_BATCH] net core use batching jamal
2007-10-01 4:11 ` Bill Fink
2007-10-01 13:30 ` jamal
2007-10-02 4:25 ` [ofa-general] " Bill Fink
2007-10-02 13:20 ` jamal
2007-10-03 5:29 ` [ofa-general] " Bill Fink
2007-10-03 13:42 ` jamal
2007-10-01 10:42 ` [ofa-general] " Patrick McHardy
2007-10-01 13:21 ` jamal
2007-10-08 5:03 ` Krishna Kumar2
2007-10-08 13:17 ` jamal
2007-10-09 3:09 ` [ofa-general] " Krishna Kumar2
2007-10-09 13:10 ` jamal
2007-10-07 18:38 ` [ofa-general] " jamal
2007-09-30 18:51 ` [ofa-general] [PATCH 1/4] [NET_BATCH] Introduce batching interface jamal
2007-09-30 18:54 ` [ofa-general] Re: [PATCH 1/3] " jamal
2007-10-07 18:36 ` [ofa-general] " jamal
2007-10-08 9:59 ` Krishna Kumar2
2007-10-08 13:49 ` jamal
2007-09-24 19:12 ` [ofa-general] RE: [PATCH 1/4] [NET_SCHED] explict hold dev tx lock Waskiewicz Jr, Peter P
2007-09-24 22:51 ` jamal
2007-09-24 22:57 ` Waskiewicz Jr, Peter P
2007-09-24 23:38 ` [ofa-general] " jamal
2007-09-24 23:47 ` Waskiewicz Jr, Peter P
2007-09-25 0:14 ` [ofa-general] " Stephen Hemminger
2007-09-25 0:31 ` [ofa-general] " Waskiewicz Jr, Peter P
2007-09-25 13:15 ` [ofa-general] " jamal
2007-09-25 15:24 ` Stephen Hemminger
2007-09-25 22:14 ` jamal
2007-09-25 22:43 ` jamal
2007-09-25 13:08 ` [ofa-general] " jamal
2007-10-08 4:51 ` [ofa-general] " David Miller
2007-10-08 13:34 ` jamal
2007-10-08 14:22 ` parallel networking (was Re: [PATCH 1/4] [NET_SCHED] explict hold dev tx lock) Jeff Garzik
2007-10-08 15:18 ` jamal
2007-10-08 15:18 ` [ofa-general] " jamal
2007-10-08 21:11 ` parallel networking David Miller
2007-10-08 21:11 ` [ofa-general] " David Miller
2007-10-08 22:30 ` jamal
2007-10-08 22:33 ` David Miller
2007-10-08 22:35 ` Waskiewicz Jr, Peter P
2007-10-08 22:35 ` [ofa-general] " Waskiewicz Jr, Peter P
2007-10-08 23:42 ` jamal
2007-10-08 23:42 ` [ofa-general] " jamal
2007-10-09 1:53 ` Jeff Garzik
2007-10-09 1:53 ` [ofa-general] " Jeff Garzik
2007-10-09 14:59 ` Michael Krause
2007-10-08 21:05 ` [PATCH 1/4] [NET_SCHED] explict hold dev tx lock David Miller
2007-09-23 18:19 ` [PATCHES] TX batching Jeff Garzik
2007-09-23 19:11 ` [ofa-general] " jamal
2007-09-23 19:36 ` Kok, Auke
2007-09-23 21:20 ` jamal
2007-09-24 7:00 ` Kok, Auke
2007-09-24 22:38 ` jamal
2007-09-24 22:52 ` [ofa-general] " Kok, Auke
2007-09-24 22:54 ` [DOC] Net batching driver howto jamal
2007-09-25 20:16 ` [ofa-general] " Randy Dunlap
2007-09-25 22:28 ` jamal
2007-09-25 0:15 ` [PATCHES] TX batching Jeff Garzik
2007-09-30 18:50 ` [ofa-general] " jamal
2007-09-30 19:19 ` jamal [this message]
2007-10-07 18:34 ` jamal
2007-10-08 12:51 ` [ofa-general] " Evgeniy Polyakov
2007-10-08 14:05 ` jamal
2007-10-09 8:14 ` Krishna Kumar2
2007-10-09 13:25 ` jamal
2007-09-17 4:08 ` [PATCH 0/10 REV5] Implement skb batching and support in IPoIB/E1000 Krishna Kumar2
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=1191179969.6165.46.camel@localhost \
--to=hadi@cyberus.ca \
--cc=Robert.Olsson@data.slu.se \
--cc=davem@davemloft.net \
--cc=gaagaan@gmail.com \
--cc=general@lists.openfabrics.org \
--cc=herbert@gondor.apana.org.au \
--cc=jagana@us.ibm.com \
--cc=jeff@garzik.org \
--cc=johnpol@2ka.mipt.ru \
--cc=kaber@trash.net \
--cc=kumarkr@linux.ibm.com \
--cc=mcarlson@broadcom.com \
--cc=mchan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=randy.dunlap@oracle.com \
--cc=rdreier@cisco.com \
--cc=shemminger@linux-foundation.org \
--cc=sri@us.ibm.com \
--cc=tgraf@suug.ch \
/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.