Re: [git patches] net driver updates

2008-02-25 Thread Divy Le Ray




So, it sounds like Krishna's patch is ok, because the race does not 
exist anymore in this driver?
The first part is right indeed, but the second part is breaking the 
current usage of txq_stopped and

the logic that stops and restarts the Tx queue.
I can submit a patch fixing it. Plese let me know what's more convenient 
for you.


Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver updates

2008-02-20 Thread Divy Le Ray

Jeff Garzik wrote:

Divy Le Ray wrote:

Jeff Garzik wrote:

Mostly fixes, a few cleanups (generally assisting fixes), and an
exception for PS3 wireless because it had been posted, reviewed and
acked for a while, just not committed.

Please pull from 'upstream-davem' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-davem


to receive the following updates:

 
 drivers/net/cxgb3/sge.c  |   35 +-

   diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 9ca8c66..979f3fc 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1059,6 +1059,14 @@ static void write_tx_pkt_wr(struct adapter 
*adap, struct sk_buff *skb,

  htonl(V_WR_TID(q-token)));
 }
 
+static inline void t3_stop_queue(struct net_device *dev, struct 
sge_qset *qs,

+ struct sge_txq *q)
+{
+netif_stop_queue(dev);
+set_bit(TXQ_ETH, qs-txq_stopped);
+q-stops++;
+}
+
 /**
  *eth_xmit - add a packet to the Ethernet Tx queue
  *@skb: the packet
@@ -1090,31 +1098,18 @@ int t3_eth_xmit(struct sk_buff *skb, struct 
net_device *dev)

 ndesc = calc_tx_descs(skb);
 
 if (unlikely(credits  ndesc)) {

-if (!netif_queue_stopped(dev)) {
-netif_stop_queue(dev);
-set_bit(TXQ_ETH, qs-txq_stopped);
-q-stops++;
-dev_err(adap-pdev-dev,
-%s: Tx ring %u full while queue awake!\n,
-dev-name, q-cntxt_id  7);
-}
+t3_stop_queue(dev, qs, q);
+dev_err(adap-pdev-dev,
+%s: Tx ring %u full while queue awake!\n,
+dev-name, q-cntxt_id  7);
 spin_unlock(q-lock);
 return NETDEV_TX_BUSY;
 }
 
 q-in_use += ndesc;

-if (unlikely(credits - ndesc  q-stop_thres)) {
-q-stops++;
-netif_stop_queue(dev);
-set_bit(TXQ_ETH, qs-txq_stopped);
-#if !USE_GTS
-if (should_restart_tx(q) 
-test_and_clear_bit(TXQ_ETH, qs-txq_stopped)) {
-q-restarts++;
-netif_wake_queue(dev);
-}
-#endif
-}
+if (unlikely(credits - ndesc  q-stop_thres))
+if (USE_GTS || !should_restart_tx(q))
+t3_stop_queue(dev, qs, q);
 
 gen = q-gen;

 q-unacked += ndesc;
  

Hi Jeff,

I thought I had NAK'ed the patch modifying sge.c from Krishna Kumar.
Looking back at my answer at the time, I was obviously unclear.
Can you please revert the drivers/net/cxgb3sge.c change ?


Explain why, so I can include it in the changelog please...


Hi Jeff,

The first part of the patch removes the !netif_queue_stopped(dev).
It opens the race discussed a while ago between Stephen hemminger and 
David Miller:

http://marc.info/?l=linux-netdevm=113383224512427w=2

The second part of the patch breaks the current usage of txq_stopped and 
the logic that stops and restarts the Tx queue.


Cheers,
Divy

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [git patches] net driver updates

2008-02-20 Thread Divy Le Ray


 -Original Message-
 From: David Miller [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 20, 2008 9:47 PM
 To: [EMAIL PROTECTED]
 Cc: Divy Le Ray; [EMAIL PROTECTED]; [EMAIL PROTECTED];
 netdev@vger.kernel.org
 Subject: Re: [git patches] net driver updates
 
 From: Krishna Kumar2 [EMAIL PROTECTED]
 Date: Thu, 21 Feb 2008 09:13:49 +0530
 
  Hi Divy,
 
Explain why, so I can include it in the changelog please...
  
   Hi Jeff,
  
   The first part of the patch removes the !netif_queue_stopped(dev).
   It opens the race discussed a while ago between Stephen hemminger
 and
   David Miller:
   http://marc.info/?l=linux-netdevm=113383224512427w=2
 
  I feel this race cannot happen anymore. I think the fix for that
race
 was
  to introduce the
  __LINK_STATE_QDISC_RUNNING bit thus eliminating any races between
 CPU's. If
  one
  CPU has called xmit, the other CPU will enqueue skbs (by holding the
  queue_lock) and
  exit from qdisc_run since it finds the bit set already.
 
 And the race is talking about LLTX, which S2IO doesn't use as
 far as I can tell.

Dave,

The driver is cxgb3 here, it uses LLTX.

Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [git patches] net driver updates

2008-02-20 Thread Divy Le Ray
 From: Divy Le Ray [EMAIL PROTECTED]
 Date: Wed, 20 Feb 2008 21:57:08 -0800
 
  The driver is cxgb3 here, it uses LLTX.
 
 That's extremely unfortunate, hopefully you can update it to
 use a model like tg3 and others use.  LLTX is a lost cause
 for hardware device drivers, and in fact we'd like to remove
 it tree wide eventually.

It sounds like I messed up.
cxgb3 does not use LLTX - The Chelsio driver does, thus should be
converted.

Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver updates

2008-02-11 Thread Divy Le Ray

Jeff Garzik wrote:

Mostly fixes, a few cleanups (generally assisting fixes), and an
exception for PS3 wireless because it had been posted, reviewed and
acked for a while, just not committed.

Please pull from 'upstream-davem' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-davem

to receive the following updates:

 
 drivers/net/cxgb3/sge.c  |   35 +-
  
 
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c

index 9ca8c66..979f3fc 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1059,6 +1059,14 @@ static void write_tx_pkt_wr(struct adapter *adap, struct 
sk_buff *skb,
 htonl(V_WR_TID(q-token)));
 }
 
+static inline void t3_stop_queue(struct net_device *dev, struct sge_qset *qs,

+struct sge_txq *q)
+{
+   netif_stop_queue(dev);
+   set_bit(TXQ_ETH, qs-txq_stopped);
+   q-stops++;
+}
+
 /**
  * eth_xmit - add a packet to the Ethernet Tx queue
  * @skb: the packet
@@ -1090,31 +1098,18 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device 
*dev)
ndesc = calc_tx_descs(skb);
 
 	if (unlikely(credits  ndesc)) {

-   if (!netif_queue_stopped(dev)) {
-   netif_stop_queue(dev);
-   set_bit(TXQ_ETH, qs-txq_stopped);
-   q-stops++;
-   dev_err(adap-pdev-dev,
-   %s: Tx ring %u full while queue awake!\n,
-   dev-name, q-cntxt_id  7);
-   }
+   t3_stop_queue(dev, qs, q);
+   dev_err(adap-pdev-dev,
+   %s: Tx ring %u full while queue awake!\n,
+   dev-name, q-cntxt_id  7);
spin_unlock(q-lock);
return NETDEV_TX_BUSY;
}
 
 	q-in_use += ndesc;

-   if (unlikely(credits - ndesc  q-stop_thres)) {
-   q-stops++;
-   netif_stop_queue(dev);
-   set_bit(TXQ_ETH, qs-txq_stopped);
-#if !USE_GTS
-   if (should_restart_tx(q) 
-   test_and_clear_bit(TXQ_ETH, qs-txq_stopped)) {
-   q-restarts++;
-   netif_wake_queue(dev);
-   }
-#endif
-   }
+   if (unlikely(credits - ndesc  q-stop_thres))
+   if (USE_GTS || !should_restart_tx(q))
+   t3_stop_queue(dev, qs, q);
 
 	gen = q-gen;

q-unacked += ndesc;
  

Hi Jeff,

I thought I had NAK'ed the patch modifying sge.c from Krishna Kumar.
Looking back at my answer at the time, I was obviously unclear.
Can you please revert the drivers/net/cxgb3sge.c change ?

Cheers,
Divy

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.25] cxgb3: Handle ARP completions that mark neighbors stale.

2008-02-06 Thread Divy Le Ray

Steve Wise wrote:

cxgb3: Handle ARP completions that mark neighbors stale.

When ARP completes due to a request rather than a reply the neighbor is
marked NUD_STALE instead of reachable (see arp_process()).  The handler
for the resulting netevent needs to check also for NUD_STALE.

Failure to use the arp entry can cause RDMA connection failures.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
  


Acked-by: Divy Le Ray [EMAIL PROTECTED]

Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Optimize cxgb3 xmit path (a bit)

2008-01-30 Thread Divy Le Ray

Krishna Kumar wrote:

Changes:
1. Add common code for stopping queue.
2. No need to call netif_stop_queue followed by netif_wake_queue (and
   infact a netif_start_queue could have been used instead), instead
   call stop_queue if required, and remove code under USE_GTS macro.
3. There is no need to check for netif_queue_stopped, as the network
   core guarantees that for us (I am sure every driver could remove
   that check, eg e1000 - I have tested that path a few billion times
   with about a few hundred thousand qstops but the condition never
   hit even once).

Thanks,
  


Hi Krishna,

Thanks for the work.
There is however a bit more cleaning to do regarding the USE_GTS macro.
I'll post a patch soon that will take your points in account.

Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2007-12-17 Thread Divy Le Ray

Jeff Garzik wrote:


A couple serious fixes (wireless, e100, sky2) and a bevy of minor ones.

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus




Hi Jeff,

Should I resend the 2 cxgb3 patches posted on 12/05 and 12/06 ?
I did not see them getting applied to the #upstream branch today.

Cheers,
Divy


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2 2.6.25] cxgb3 - parity initialization for T3C adapters.

2007-12-17 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Add parity initialization for T3C adapters.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h   |1 
 drivers/net/cxgb3/cxgb3_main.c|   82 
 drivers/net/cxgb3/cxgb3_offload.c |   15 ++
 drivers/net/cxgb3/regs.h  |  248 +
 drivers/net/cxgb3/sge.c   |   24 +++-
 drivers/net/cxgb3/t3_hw.c |  131 +---
 6 files changed, 472 insertions(+), 29 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 60a62f5..eb305a0 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -71,6 +71,7 @@ enum {/* adapter flags */
USING_MSI = (1  1),
USING_MSIX = (1  2),
QUEUES_BOUND = (1  3),
+   TP_PARITY_INIT = (1  4),
 };
 
 struct fl_pg_chunk {
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 944423c..d1aa777 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -306,6 +306,77 @@ static int request_msix_data_irqs(struct adapter *adap)
return 0;
 }
 
+static int await_mgmt_replies(struct adapter *adap, unsigned long init_cnt,
+ unsigned long n)
+{
+   int attempts = 5;
+
+   while (adap-sge.qs[0].rspq.offload_pkts  init_cnt + n) {
+   if (!--attempts)
+   return -ETIMEDOUT;
+   msleep(10);
+   }
+   return 0;
+}
+
+static int init_tp_parity(struct adapter *adap)
+{
+   int i;
+   struct sk_buff *skb;
+   struct cpl_set_tcb_field *greq;
+   unsigned long cnt = adap-sge.qs[0].rspq.offload_pkts;
+
+   t3_tp_set_offload_mode(adap, 1);
+
+   for (i = 0; i  16; i++) {
+   struct cpl_smt_write_req *req;
+
+   skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
+   req = (struct cpl_smt_write_req *)__skb_put(skb, sizeof(*req));
+   memset(req, 0, sizeof(*req));
+   req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i));
+   req-iff = i;
+   t3_mgmt_tx(adap, skb);
+   }
+
+   for (i = 0; i  2048; i++) {
+   struct cpl_l2t_write_req *req;
+
+   skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
+   req = (struct cpl_l2t_write_req *)__skb_put(skb, sizeof(*req));
+   memset(req, 0, sizeof(*req));
+   req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i));
+   req-params = htonl(V_L2T_W_IDX(i));
+   t3_mgmt_tx(adap, skb);
+   }
+
+   for (i = 0; i  2048; i++) {
+   struct cpl_rte_write_req *req;
+
+   skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
+   req = (struct cpl_rte_write_req *)__skb_put(skb, sizeof(*req));
+   memset(req, 0, sizeof(*req));
+   req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i));
+   req-l2t_idx = htonl(V_L2T_W_IDX(i));
+   t3_mgmt_tx(adap, skb);
+   }
+
+   skb = alloc_skb(sizeof(*greq), GFP_KERNEL | __GFP_NOFAIL);
+   greq = (struct cpl_set_tcb_field *)__skb_put(skb, sizeof(*greq));
+   memset(greq, 0, sizeof(*greq));
+   greq-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0));
+   greq-mask = cpu_to_be64(1);
+   t3_mgmt_tx(adap, skb);
+
+   i = await_mgmt_replies(adap, cnt, 16 + 2048 + 2048 + 1);
+   t3_tp_set_offload_mode(adap, 0);
+   return i;
+}
+
 /**
  * setup_rss - configure RSS
  * @adap: the adapter
@@ -817,6 +888,7 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto out;
 
+   t3_set_reg_field(adap, A_TP_PARA_REG5, 0, F_RXDDPOFFINIT);
t3_write_reg(adap, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12));
 
err = setup_sge_qsets(adap);
@@ -856,6 +928,16 @@ static int cxgb_up(struct adapter *adap)
t3_sge_start(adap);
t3_intr_enable(adap);
 
+   if (adap-params.rev = T3_REV_C  !(adap-flags  TP_PARITY_INIT) 
+   is_offload(adap)  init_tp_parity(adap) == 0)
+   adap-flags |= TP_PARITY_INIT;
+
+   if (adap-flags  TP_PARITY_INIT) {
+   t3_write_reg(adap, A_TP_INT_CAUSE,
+F_CMCACHEPERR | F_ARPLUTPERR);
+   t3_write_reg(adap, A_TP_INT_ENABLE, 0x7fbf);
+   }
+
if ((adap-flags  (USING_MSIX | QUEUES_BOUND)) == USING_MSIX)
bind_qsets(adap);
adap-flags |= QUEUES_BOUND;
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers

[PATCH 2/2 2.6.25] cxgb3 - Fix EEH, missing softirq blocking

2007-12-17 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

set_pci_drvdata() stores a pointer to the adapter,
not the net device.
Add missing softirq blocking in t3_mgmt_tx.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   14 --
 drivers/net/cxgb3/sge.c|7 ++-
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index d1aa777..0e3dcbf 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2408,9 +2408,7 @@ void t3_fatal_err(struct adapter *adapter)
 static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
 pci_channel_state_t state)
 {
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct port_info *pi = netdev_priv(dev);
-   struct adapter *adapter = pi-adapter;
+   struct adapter *adapter = pci_get_drvdata(pdev);
int i;
 
/* Stop all ports */
@@ -2444,9 +2442,7 @@ static pci_ers_result_t t3_io_error_detected(struct 
pci_dev *pdev,
  */
 static pci_ers_result_t t3_io_slot_reset(struct pci_dev *pdev)
 {
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct port_info *pi = netdev_priv(dev);
-   struct adapter *adapter = pi-adapter;
+   struct adapter *adapter = pci_get_drvdata(pdev);
 
if (pci_enable_device(pdev)) {
dev_err(pdev-dev,
@@ -2469,9 +2465,7 @@ static pci_ers_result_t t3_io_slot_reset(struct pci_dev 
*pdev)
  */
 static void t3_io_resume(struct pci_dev *pdev)
 {
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct port_info *pi = netdev_priv(dev);
-   struct adapter *adapter = pi-adapter;
+   struct adapter *adapter = pci_get_drvdata(pdev);
int i;
 
/* Restart the ports */
@@ -2491,7 +2485,7 @@ static void t3_io_resume(struct pci_dev *pdev)
 
if (is_offload(adapter)) {
__set_bit(OFFLOAD_DEVMAP_BIT, adapter-registered_device_map);
-   if (offload_open(dev))
+   if (offload_open(adapter-port[0]))
printk(KERN_WARNING
   Could not bring back offload capabilities\n);
}
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index cef153d..6367cee 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1364,7 +1364,12 @@ static void restart_ctrlq(unsigned long data)
  */
 int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb)
 {
-   return ctrl_xmit(adap, adap-sge.qs[0].txq[TXQ_CTRL], skb);
+   int ret; 
+   local_bh_disable();
+   ret = ctrl_xmit(adap, adap-sge.qs[0].txq[TXQ_CTRL], skb);
+   local_bh_enable();
+
+   return ret;
 }
 
 /**
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2007-12-17 Thread Divy Le Ray



http://vger.kernel.org/majordomo-info.html

The last thing I have from you, in netdev#upstream, is

commit 75758e8aa4b7d5c651261ce653dd8d0b716e1eda
Author: Divy Le Ray [EMAIL PROTECTED]
Date:   Wed Dec 5 10:15:01 2007 -0800

 cxgb3 - T3C support update

 Update GPIO mapping for T3C.
 Update xgmac for T3C support.
 Fix typo in mtu table.

and there's nothing in my inbox.

So if that is not the change you want, yes, please do resend.



Okay, I just resent. You originally attempted to apply these patches to 
the #upstream-fixes branch,
which failed for the 2 patches i just reposted. I guess it is why 
they're no longer in your inbox.


Cheers,
Divy

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] cxgb3 - Parity initialization for T3C adapters

2007-12-14 Thread Divy Le Ray

Divy Le Ray wrote:

Jeff Garzik wrote:


Divy Le Ray wrote:
 Jeff Garzik wrote:
 Divy Le Ray wrote:
 From: Divy Le Ray [EMAIL PROTECTED]

 Add parity initialization for T3C adapters.

 Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
 ---

  drivers/net/cxgb3/adapter.h   |1
  drivers/net/cxgb3/cxgb3_main.c|   82 
  drivers/net/cxgb3/cxgb3_offload.c |   15 ++
  drivers/net/cxgb3/regs.h  |  248
 +
  drivers/net/cxgb3/sge.c   |   24 +++-
  drivers/net/cxgb3/t3_hw.c |  131 +---
  6 files changed, 472 insertions(+), 29 deletions(-)

 dropped patches 2-3, did not apply



 Hi Jeff,

 I noticed that you applied the first one of this 3 patches series 
to the

 #upstream-fixes branch.
 These patches are intended to the #upstream (2.6.25) branch, as 
they are

 built on top of the
 last 10 patches committed - 9 from me, and the white space clean up
 (thanks!).
 May be this is the reason why they did not apply.

Ah... you need to tell me these things.  I looked for a kernel version
in your messages but did not see one.

I had put it in the introduction mail, I should have added the kernel 
version in the patch titles.

I'll do from now on.



Does the patch #1 need to be reverted for 2.6.24?


No, it can be applied to 2.6.24.
The 2 next patches seem to apply cleanly on #upstream when patch #1 is 
popped out the patch stack.



Hi Jeff,

Did you get a chance to apply these patches #upstream ?

Cheers,
Divy


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] cxgb3 - Parity initialization for T3C adapters

2007-12-07 Thread Divy Le Ray

Jeff Garzik wrote:


Divy Le Ray wrote:
 Jeff Garzik wrote:
 Divy Le Ray wrote:
 From: Divy Le Ray [EMAIL PROTECTED]

 Add parity initialization for T3C adapters.

 Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
 ---

  drivers/net/cxgb3/adapter.h   |1
  drivers/net/cxgb3/cxgb3_main.c|   82 
  drivers/net/cxgb3/cxgb3_offload.c |   15 ++
  drivers/net/cxgb3/regs.h  |  248
 +
  drivers/net/cxgb3/sge.c   |   24 +++-
  drivers/net/cxgb3/t3_hw.c |  131 +---
  6 files changed, 472 insertions(+), 29 deletions(-)

 dropped patches 2-3, did not apply



 Hi Jeff,

 I noticed that you applied the first one of this 3 patches series to the
 #upstream-fixes branch.
 These patches are intended to the #upstream (2.6.25) branch, as they are
 built on top of the
 last 10 patches committed - 9 from me, and the white space clean up
 (thanks!).
 May be this is the reason why they did not apply.

Ah... you need to tell me these things.  I looked for a kernel version
in your messages but did not see one.

I had put it in the introduction mail, I should have added the kernel 
version in the patch titles.

I'll do from now on.



Does the patch #1 need to be reverted for 2.6.24?


No, it can be applied to 2.6.24.
The 2 next patches seem to apply cleanly on #upstream when patch #1 is 
popped out the patch stack.




 On this topic, I have a question: how do I get to see all the netdev-2.6
 branches ?


git fetch -f $NETDEV_URL upstream:upstream

copies the latest upstream branch from netdev-2.6.git, and stores it as
your local upstream branch.

You may do the same for #upstream-fixes too.



That made it.
Thanks a lot!

Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] cxgb3 - Parity initialization for T3C adapters

2007-12-07 Thread Divy Le Ray

Jeff Garzik wrote:

Divy Le Ray wrote:

From: Divy Le Ray [EMAIL PROTECTED]

Add parity initialization for T3C adapters.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h   |1 
 drivers/net/cxgb3/cxgb3_main.c|   82 

 drivers/net/cxgb3/cxgb3_offload.c |   15 ++
 drivers/net/cxgb3/regs.h  |  248 
+

 drivers/net/cxgb3/sge.c   |   24 +++-
 drivers/net/cxgb3/t3_hw.c |  131 +---
 6 files changed, 472 insertions(+), 29 deletions(-)


dropped patches 2-3, did not apply




Hi Jeff,

I noticed that you applied the first one of this 3 patches series to the 
#upstream-fixes branch.
These patches are intended to the #upstream (2.6.25) branch, as they are 
built on top of the
last 10 patches committed - 9 from me, and the white space clean up 
(thanks!).

May be this is the reason why they did not apply.

On this topic, I have a question: how do I get to see all the netdev-2.6 
branches ?
After cloning a free  netdev-2.6 tree, 'git branch' shows only the 
master branch:


bash-3.1$ git --version
git version 1.5.3.rc4.29.g74276-dirty
-bash-3.1$ stg clone 
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
netdev-2.6-fresh
Cloning 
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
into netdev-2.6-fresh...

Initialized empty Git repository in /opt/sources/netdev-2.6-fresh/.git/
remote: Generating pack...
remote: Counting objects: 620879
Done counting 633562 objects.
remote: Deltifying 633562 objects...
remote:  100% (633562/633562) done
Indexing 633562 objects...
remote: Total 633562 (delta 517968), reused 594305 (delta 478716)
100% (633562/633562) done
Resolving 517968 deltas...
100% (517968/517968) done
Checking 23058 files out...
100% (23058/23058) done
done
-bash-3.1$ cd netdev-2.6-fresh/
-bash-3.1$ git branch
* master

Cheers,
Divy


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] cxgb3 - driver update

2007-12-06 Thread Divy Le Ray

Divy Le Ray wrote:

Jeff,

I'm submitting a patch series for inclusion in 2.6.25.
The patches are built against netdev#upstream.

Here is a brief description:
- Update GPIO pinning and MAC support for T3C adapters
- Enable parity error detection.

Jeff,

I posted a third patch to fix the EEH code and add a missing
softirq blocking call.

Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/2] cxgb3 - Fix EEH, missing softirq blocking

2007-12-06 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

set_pci_drvdata() stores a pointer to the adapter,
not the net device.
Add missing softirq blocking in t3_mgmt_tx.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   14 --
 drivers/net/cxgb3/sge.c|7 ++-
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index d1aa777..0e3dcbf 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2408,9 +2408,7 @@ void t3_fatal_err(struct adapter *adapter)
 static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
 pci_channel_state_t state)
 {
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct port_info *pi = netdev_priv(dev);
-   struct adapter *adapter = pi-adapter;
+   struct adapter *adapter = pci_get_drvdata(pdev);
int i;
 
/* Stop all ports */
@@ -2444,9 +2442,7 @@ static pci_ers_result_t t3_io_error_detected(struct 
pci_dev *pdev,
  */
 static pci_ers_result_t t3_io_slot_reset(struct pci_dev *pdev)
 {
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct port_info *pi = netdev_priv(dev);
-   struct adapter *adapter = pi-adapter;
+   struct adapter *adapter = pci_get_drvdata(pdev);
 
if (pci_enable_device(pdev)) {
dev_err(pdev-dev,
@@ -2469,9 +2465,7 @@ static pci_ers_result_t t3_io_slot_reset(struct pci_dev 
*pdev)
  */
 static void t3_io_resume(struct pci_dev *pdev)
 {
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct port_info *pi = netdev_priv(dev);
-   struct adapter *adapter = pi-adapter;
+   struct adapter *adapter = pci_get_drvdata(pdev);
int i;
 
/* Restart the ports */
@@ -2491,7 +2485,7 @@ static void t3_io_resume(struct pci_dev *pdev)
 
if (is_offload(adapter)) {
__set_bit(OFFLOAD_DEVMAP_BIT, adapter-registered_device_map);
-   if (offload_open(dev))
+   if (offload_open(adapter-port[0]))
printk(KERN_WARNING
   Could not bring back offload capabilities\n);
}
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index cef153d..6367cee 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1364,7 +1364,12 @@ static void restart_ctrlq(unsigned long data)
  */
 int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb)
 {
-   return ctrl_xmit(adap, adap-sge.qs[0].txq[TXQ_CTRL], skb);
+   int ret; 
+   local_bh_disable();
+   ret = ctrl_xmit(adap, adap-sge.qs[0].txq[TXQ_CTRL], skb);
+   local_bh_enable();
+
+   return ret;
 }
 
 /**
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] cxgb3 - driver update

2007-12-05 Thread Divy Le Ray

Jeff,

I'm submitting a patch series for inclusion in 2.6.25.
The patches are built against netdev#upstream.

Here is a brief description:
- Update GPIO pinning and MAC support for T3C adapters
- Enable parity error detection.

Cheers,
Divy

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] cxgb3 - Parity initialization for T3C adapters

2007-12-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Add parity initialization for T3C adapters.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h   |1 
 drivers/net/cxgb3/cxgb3_main.c|   82 
 drivers/net/cxgb3/cxgb3_offload.c |   15 ++
 drivers/net/cxgb3/regs.h  |  248 +
 drivers/net/cxgb3/sge.c   |   24 +++-
 drivers/net/cxgb3/t3_hw.c |  131 +---
 6 files changed, 472 insertions(+), 29 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 60a62f5..eb305a0 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -71,6 +71,7 @@ enum {/* adapter flags */
USING_MSI = (1  1),
USING_MSIX = (1  2),
QUEUES_BOUND = (1  3),
+   TP_PARITY_INIT = (1  4),
 };
 
 struct fl_pg_chunk {
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 944423c..d1aa777 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -306,6 +306,77 @@ static int request_msix_data_irqs(struct adapter *adap)
return 0;
 }
 
+static int await_mgmt_replies(struct adapter *adap, unsigned long init_cnt,
+ unsigned long n)
+{
+   int attempts = 5;
+
+   while (adap-sge.qs[0].rspq.offload_pkts  init_cnt + n) {
+   if (!--attempts)
+   return -ETIMEDOUT;
+   msleep(10);
+   }
+   return 0;
+}
+
+static int init_tp_parity(struct adapter *adap)
+{
+   int i;
+   struct sk_buff *skb;
+   struct cpl_set_tcb_field *greq;
+   unsigned long cnt = adap-sge.qs[0].rspq.offload_pkts;
+
+   t3_tp_set_offload_mode(adap, 1);
+
+   for (i = 0; i  16; i++) {
+   struct cpl_smt_write_req *req;
+
+   skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
+   req = (struct cpl_smt_write_req *)__skb_put(skb, sizeof(*req));
+   memset(req, 0, sizeof(*req));
+   req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i));
+   req-iff = i;
+   t3_mgmt_tx(adap, skb);
+   }
+
+   for (i = 0; i  2048; i++) {
+   struct cpl_l2t_write_req *req;
+
+   skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
+   req = (struct cpl_l2t_write_req *)__skb_put(skb, sizeof(*req));
+   memset(req, 0, sizeof(*req));
+   req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i));
+   req-params = htonl(V_L2T_W_IDX(i));
+   t3_mgmt_tx(adap, skb);
+   }
+
+   for (i = 0; i  2048; i++) {
+   struct cpl_rte_write_req *req;
+
+   skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
+   req = (struct cpl_rte_write_req *)__skb_put(skb, sizeof(*req));
+   memset(req, 0, sizeof(*req));
+   req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i));
+   req-l2t_idx = htonl(V_L2T_W_IDX(i));
+   t3_mgmt_tx(adap, skb);
+   }
+
+   skb = alloc_skb(sizeof(*greq), GFP_KERNEL | __GFP_NOFAIL);
+   greq = (struct cpl_set_tcb_field *)__skb_put(skb, sizeof(*greq));
+   memset(greq, 0, sizeof(*greq));
+   greq-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0));
+   greq-mask = cpu_to_be64(1);
+   t3_mgmt_tx(adap, skb);
+
+   i = await_mgmt_replies(adap, cnt, 16 + 2048 + 2048 + 1);
+   t3_tp_set_offload_mode(adap, 0);
+   return i;
+}
+
 /**
  * setup_rss - configure RSS
  * @adap: the adapter
@@ -817,6 +888,7 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto out;
 
+   t3_set_reg_field(adap, A_TP_PARA_REG5, 0, F_RXDDPOFFINIT);
t3_write_reg(adap, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12));
 
err = setup_sge_qsets(adap);
@@ -856,6 +928,16 @@ static int cxgb_up(struct adapter *adap)
t3_sge_start(adap);
t3_intr_enable(adap);
 
+   if (adap-params.rev = T3_REV_C  !(adap-flags  TP_PARITY_INIT) 
+   is_offload(adap)  init_tp_parity(adap) == 0)
+   adap-flags |= TP_PARITY_INIT;
+
+   if (adap-flags  TP_PARITY_INIT) {
+   t3_write_reg(adap, A_TP_INT_CAUSE,
+F_CMCACHEPERR | F_ARPLUTPERR);
+   t3_write_reg(adap, A_TP_INT_ENABLE, 0x7fbf);
+   }
+
if ((adap-flags  (USING_MSIX | QUEUES_BOUND)) == USING_MSIX)
bind_qsets(adap);
adap-flags |= QUEUES_BOUND;
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers

[PATCH 1/2] cxgb3 - T3C support update

2007-12-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Update GPIO mapping for T3C.
Update xgmac for T3C support.
Fix typo in mtu table.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h  |   27 ++-
 drivers/net/cxgb3/t3_hw.c |6 +++---
 drivers/net/cxgb3/xgmac.c |   44 +---
 3 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index a7d5f65..70e1961 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1959,6 +1959,10 @@
 
 #define A_XGM_RXFIFO_CFG 0x884
 
+#define S_RXFIFO_EMPTY31
+#define V_RXFIFO_EMPTY(x) ((x)  S_RXFIFO_EMPTY)
+#define F_RXFIFO_EMPTYV_RXFIFO_EMPTY(1U)
+
 #define S_RXFIFOPAUSEHWM17
 #define M_RXFIFOPAUSEHWM0xfff
 
@@ -1983,6 +1987,10 @@
 
 #define A_XGM_TXFIFO_CFG 0x888
 
+#define S_UNDERUNFIX22
+#define V_UNDERUNFIX(x) ((x)  S_UNDERUNFIX)
+#define F_UNDERUNFIXV_UNDERUNFIX(1U)
+
 #define S_TXIPG13
 #define M_TXIPG0xff
 #define V_TXIPG(x) ((x)  S_TXIPG)
@@ -2056,10 +2064,27 @@
 #define V_XAUIIMP(x) ((x)  S_XAUIIMP)
 
 #define A_XGM_RX_MAX_PKT_SIZE 0x8a8
-#define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4
+
+#define S_RXMAXFRAMERSIZE17
+#define M_RXMAXFRAMERSIZE0x3fff
+#define V_RXMAXFRAMERSIZE(x) ((x)  S_RXMAXFRAMERSIZE)
+#define G_RXMAXFRAMERSIZE(x) (((x)  S_RXMAXFRAMERSIZE)  M_RXMAXFRAMERSIZE)
+
+#define S_RXENFRAMER14
+#define V_RXENFRAMER(x) ((x)  S_RXENFRAMER)
+#define F_RXENFRAMERV_RXENFRAMER(1U)
+
+#define S_RXMAXPKTSIZE0
+#define M_RXMAXPKTSIZE0x3fff
+#define V_RXMAXPKTSIZE(x) ((x)  S_RXMAXPKTSIZE)
+#define G_RXMAXPKTSIZE(x) (((x)  S_RXMAXPKTSIZE)  M_RXMAXPKTSIZE)
 
 #define A_XGM_RESET_CTRL 0x8ac
 
+#define S_XGMAC_STOP_EN4
+#define V_XGMAC_STOP_EN(x) ((x)  S_XGMAC_STOP_EN)
+#define F_XGMAC_STOP_ENV_XGMAC_STOP_EN(1U)
+
 #define S_XG2G_RESET_3
 #define V_XG2G_RESET_(x) ((x)  S_XG2G_RESET_)
 #define F_XG2G_RESET_V_XG2G_RESET_(1U)
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 553dd9a..dfdda47 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -447,8 +447,8 @@ static const struct adapter_info t3_adap_info[] = {
 mi1_mdio_ops, Chelsio T302},
{1, 0, 0, 0,
 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
-F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
-SUPPORTED_1baseT_Full | SUPPORTED_AUI,
+F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
+0, SUPPORTED_1baseT_Full | SUPPORTED_AUI,
 mi1_mdio_ext_ops, Chelsio T310},
{2, 0, 0, 0,
 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
@@ -2631,7 +2631,7 @@ static void __devinit init_mtus(unsigned short mtus[])
 * it can accomodate max size TCP/IP headers when SACK and timestamps
 * are enabled and still have at least 8 bytes of payload.
 */
-   mtus[1] = 88;
+   mtus[0] = 88;
mtus[1] = 88;
mtus[2] = 256;
mtus[3] = 512;
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index 98303fd..ffdc0a1 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -106,6 +106,7 @@ int t3_mac_reset(struct cmac *mac)
t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft,
 F_RXSTRFRWRD | F_DISERRFRAMES,
 uses_xaui(adap) ? 0 : F_RXSTRFRWRD);
+   t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + oft, 0, F_UNDERUNFIX);
 
if (uses_xaui(adap)) {
if (adap-params.rev == 0) {
@@ -124,7 +125,11 @@ int t3_mac_reset(struct cmac *mac)
xaui_serdes_reset(mac);
}
 
-   val = F_MAC_RESET_;
+   t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + oft,
+V_RXMAXFRAMERSIZE(M_RXMAXFRAMERSIZE),
+V_RXMAXFRAMERSIZE(MAX_FRAME_SIZE) | F_RXENFRAMER);
+   val = F_MAC_RESET_ | F_XGMAC_STOP_EN;
+
if (is_10G(adap))
val |= F_PCS_RESET_;
else if (uses_xaui(adap))
@@ -313,8 +318,9 @@ static int rx_fifo_hwm(int mtu)
 
 int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
 {
-   int hwm, lwm;
-   unsigned int thres, v;
+   int hwm, lwm, divisor;
+   int ipg;
+   unsigned int thres, v, reg;
struct adapter *adap = mac-adapter;
 
/*
@@ -335,27 +341,32 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
hwm = min(hwm, MAC_RXFIFO_SIZE - 8192);
lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4);
 
-   if (adap-params.rev == T3_REV_B2 
+   if (adap-params.rev = T3_REV_B2 
(t3_read_reg(adap, A_XGM_RX_CTRL + mac-offset)  F_RXEN)) {
disable_exact_filters(mac);
v = t3_read_reg(adap, A_XGM_RX_CFG + mac-offset);
t3_set_reg_field(adap, A_XGM_RX_CFG + mac-offset,
 F_ENHASHMCAST

Re: [PATCH 0/3] cxgb - driver fixes.

2007-12-01 Thread Divy Le Ray

Ben Greear wrote:

Divy Le Ray wrote:

Jeff,

I'm submitting a patch series for inclusion in 2.6.24 for the cxgb 
driver.

The patches are built against Linus'git tree.

Here is a brief description:
- Ensure that GSO skbs have enough headroom before encapsulating them,
- Fix a crash in NAPI mode,
- Fix statistics accounting and report.


We ran pktgen overnight on 2.6.23 with patch 1 and 3 applied (patch 2
not needed on .23 it seems) and it was stable at about 1.5Gbps 
bi-directional

using 1500 MTU sized frames.

We'll run some more tests with user-space TCP  UDP today, but it 
looks good

so far.

Perhaps these patches should be considered for .23 stable as well?

Thanks,
Ben



Yes, patches 1 and 3 could be considered for .22 and .23-stable, along 
with the previous fix:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7de6af0f23b25df8da9719ecae1916b669d0b03d

Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cxgb - revert file mode changes.

2007-12-01 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

revert inavertant file mode changes

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/chelsio/cxgb2.c  |0 
 drivers/net/chelsio/pm3393.c |0 
 drivers/net/chelsio/sge.c|0 
 drivers/net/chelsio/sge.h|0 
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
old mode 100755
new mode 100644
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
old mode 100755
new mode 100644
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
old mode 100755
new mode 100644
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h
old mode 100755
new mode 100644
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [LIKELY_SPAM][git patches] net driver fixes

2007-12-01 Thread Divy Le Ray

Jeff Garzik wrote:


Notes:

1) Several of these are resends from the last submission.

2) That chelsio file mode change (644-755) is a bit annoying.  Can git
do chmod as a changeset by itself?



Sorry for this. I had not noticed it.
If any help, I just submitted a patch reverting the file mode changes.

Cheers,
Divy
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] cxgb - driver fixes.

2007-11-27 Thread Divy Le Ray

Jeff,

I'm submitting a patch series for inclusion in 2.6.24 for the cxgb driver.
The patches are built against Linus'git tree.

Here is a brief description:
- Ensure that GSO skbs have enough headroom before encapsulating them,
- Fix a crash in NAPI mode,
- Fix statistics accounting and report.

Cheers,
Divy


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] cxgb - fix T2 GSO

2007-11-27 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

The patch ensures that a GSO skb has enough headroom
to push an encapsulating cpl_tx_pkt_lso header.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/chelsio/cxgb2.c |3 ++-
 drivers/net/chelsio/sge.c   |   34 +++---
 drivers/net/chelsio/sge.h   |1 +
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
old mode 100644
new mode 100755
index 2dbf8dc..2461f91
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -401,7 +401,8 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
TxTso,
RxVlan,
TxVlan,
-
+   TxNeedHeadroom, 
+   
/* Interrupt stats */
rx drops,
pure_rsps,
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
old mode 100644
new mode 100755
index 4436662..e8b1036
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -991,6 +991,7 @@ void t1_sge_get_port_stats(const struct sge *sge, int port,
ss-tx_packets += st-tx_packets;
ss-tx_cso += st-tx_cso;
ss-tx_tso += st-tx_tso;
+   ss-tx_need_hdrroom += st-tx_need_hdrroom;
ss-vlan_xtract += st-vlan_xtract;
ss-vlan_insert += st-vlan_insert;
}
@@ -1848,7 +1849,8 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device 
*dev)
 {
struct adapter *adapter = dev-priv;
struct sge *sge = adapter-sge;
-   struct sge_port_stats *st = per_cpu_ptr(sge-port_stats[dev-if_port], 
smp_processor_id());
+   struct sge_port_stats *st = per_cpu_ptr(sge-port_stats[dev-if_port],
+   smp_processor_id());
struct cpl_tx_pkt *cpl;
struct sk_buff *orig_skb = skb;
int ret;
@@ -1856,6 +1858,18 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device 
*dev)
if (skb-protocol == htons(ETH_P_CPL5))
goto send;
 
+   /*
+* We are using a non-standard hard_header_len.
+* Allocate more header room in the rare cases it is not big enough.
+*/
+   if (unlikely(skb_headroom(skb)  dev-hard_header_len - ETH_HLEN)) {
+   skb = skb_realloc_headroom(skb, sizeof(struct cpl_tx_pkt_lso));
+   ++st-tx_need_hdrroom;
+   dev_kfree_skb_any(orig_skb);
+   if (!skb)
+   return NETDEV_TX_OK;
+   }
+
if (skb_shinfo(skb)-gso_size) {
int eth_type;
struct cpl_tx_pkt_lso *hdr;
@@ -1889,24 +1903,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device 
*dev)
return NETDEV_TX_OK;
}
 
-   /*
-* We are using a non-standard hard_header_len and some kernel
-* components, such as pktgen, do not handle it right.
-* Complain when this happens but try to fix things up.
-*/
-   if (unlikely(skb_headroom(skb)  dev-hard_header_len - 
ETH_HLEN)) {
-   pr_debug(%s: headroom %d header_len %d\n, dev-name,
-skb_headroom(skb), dev-hard_header_len);
-
-   if (net_ratelimit())
-   printk(KERN_ERR %s: inadequate headroom in 
-  Tx packet\n, dev-name);
-   skb = skb_realloc_headroom(skb, sizeof(*cpl));
-   dev_kfree_skb_any(orig_skb);
-   if (!skb)
-   return NETDEV_TX_OK;
-   }
-
if (!(adapter-flags  UDP_CSUM_CAPABLE) 
skb-ip_summed == CHECKSUM_PARTIAL 
ip_hdr(skb)-protocol == IPPROTO_UDP) {
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h
old mode 100644
new mode 100755
index 713d9c5..285bbb2
--- a/drivers/net/chelsio/sge.h
+++ b/drivers/net/chelsio/sge.h
@@ -64,6 +64,7 @@ struct sge_port_stats {
u64 tx_tso;  /* # of TSO requests */
u64 vlan_xtract; /* # of VLAN tag extractions */
u64 vlan_insert; /* # of VLAN tag insertions */
+   u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */
 };
 
 struct sk_buff;
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] cxgb - fix NAPI

2007-11-27 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

netif_rx_complete() should be called only 
when work_done  budget.

Signed-off-by: Divy Le ray [EMAIL PROTECTED]
---

 drivers/net/chelsio/sge.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
old mode 100755
new mode 100644
index e8b1036..4b6258f
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1625,11 +1625,9 @@ int t1_poll(struct napi_struct *napi, int budget)
 {
struct adapter *adapter = container_of(napi, struct adapter, napi);
struct net_device *dev = adapter-port[0].dev;
-   int work_done;
-
-   work_done = process_responses(adapter, budget);
+   int work_done = process_responses(adapter, budget);
 
-   if (likely(!responses_pending(adapter))) {
+   if (likely(work_done  budget)) {
netif_rx_complete(dev, napi);
writel(adapter-sge-respQ.cidx,
   adapter-regs + A_SG_SLEEPING);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] cxgb - fix stats

2007-11-27 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Fix MAC stats accounting. 
Fix get_stats.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/chelsio/cxgb2.c  |   67 +++--
 drivers/net/chelsio/pm3393.c |  112 +-
 drivers/net/chelsio/sge.c|4 --
 drivers/net/chelsio/sge.h|2 -
 4 files changed, 96 insertions(+), 89 deletions(-)

diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 2461f91..c597504 100755
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
TxInternalMACXmitError,
TxFramesWithExcessiveDeferral,
TxFCSErrors,
-
+   TxJumboFramesOk,
+   TxJumboOctetsOk,
+   
RxOctetsOK,
RxOctetsBad,
RxUnicastFramesOK,
@@ -392,11 +394,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
RxInRangeLengthErrors,
RxOutOfRangeLengthField,
RxFrameTooLongErrors,
+   RxJumboFramesOk,
+   RxJumboOctetsOk,
 
/* Port stats */
-   RxPackets,
RxCsumGood,
-   TxPackets,
TxCsumOffload,
TxTso,
RxVlan,
@@ -464,23 +466,56 @@ static void get_stats(struct net_device *dev, struct 
ethtool_stats *stats,
const struct cmac_statistics *s;
const struct sge_intr_counts *t;
struct sge_port_stats ss;
-   unsigned int len;
 
s = mac-ops-statistics_update(mac, MAC_STATS_UPDATE_FULL);
-
-   len = sizeof(u64)*(s-TxFCSErrors + 1 - s-TxOctetsOK);
-   memcpy(data, s-TxOctetsOK, len);
-   data += len;
-
-   len = sizeof(u64)*(s-RxFrameTooLongErrors + 1 - s-RxOctetsOK);
-   memcpy(data, s-RxOctetsOK, len);
-   data += len;
-
+   t = t1_sge_get_intr_counts(adapter-sge);
t1_sge_get_port_stats(adapter-sge, dev-if_port, ss);
-   memcpy(data, ss, sizeof(ss));
-   data += sizeof(ss);
 
-   t = t1_sge_get_intr_counts(adapter-sge);
+   *data++ = s-TxOctetsOK;
+   *data++ = s-TxOctetsBad;
+   *data++ = s-TxUnicastFramesOK;
+   *data++ = s-TxMulticastFramesOK;
+   *data++ = s-TxBroadcastFramesOK;
+   *data++ = s-TxPauseFrames;
+   *data++ = s-TxFramesWithDeferredXmissions;
+   *data++ = s-TxLateCollisions;
+   *data++ = s-TxTotalCollisions;
+   *data++ = s-TxFramesAbortedDueToXSCollisions;
+   *data++ = s-TxUnderrun;
+   *data++ = s-TxLengthErrors;
+   *data++ = s-TxInternalMACXmitError;
+   *data++ = s-TxFramesWithExcessiveDeferral;
+   *data++ = s-TxFCSErrors;
+   *data++ = s-TxJumboFramesOK;
+   *data++ = s-TxJumboOctetsOK;
+
+   *data++ = s-RxOctetsOK;
+   *data++ = s-RxOctetsBad;
+   *data++ = s-RxUnicastFramesOK;
+   *data++ = s-RxMulticastFramesOK;
+   *data++ = s-RxBroadcastFramesOK;
+   *data++ = s-RxPauseFrames;
+   *data++ = s-RxFCSErrors;
+   *data++ = s-RxAlignErrors;
+   *data++ = s-RxSymbolErrors;
+   *data++ = s-RxDataErrors;
+   *data++ = s-RxSequenceErrors;
+   *data++ = s-RxRuntErrors;
+   *data++ = s-RxJabberErrors;
+   *data++ = s-RxInternalMACRcvError;
+   *data++ = s-RxInRangeLengthErrors;
+   *data++ = s-RxOutOfRangeLengthField;
+   *data++ = s-RxFrameTooLongErrors;
+   *data++ = s-RxJumboFramesOK;
+   *data++ = s-RxJumboOctetsOK;
+
+   *data++ = ss.rx_cso_good;
+   *data++ = ss.tx_cso;
+   *data++ = ss.tx_tso;
+   *data++ = ss.vlan_xtract;
+   *data++ = ss.vlan_insert;
+   *data++ = ss.tx_need_hdrroom;
+   
*data++ = t-rx_drops;
*data++ = t-pure_rsps;
*data++ = t-unhandled_irqs;
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
old mode 100644
new mode 100755
index 678778a..2117c4f
--- a/drivers/net/chelsio/pm3393.c
+++ b/drivers/net/chelsio/pm3393.c
@@ -45,7 +45,7 @@
 
 #include linux/crc32.h
 
-#define OFFSET(REG_ADDR)(REG_ADDR  2)
+#define OFFSET(REG_ADDR)((REG_ADDR)  2)
 
 /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */
 #define MAX_FRAME_SIZE  9600
@@ -428,69 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, 
int speed, int duplex,
return 0;
 }
 
-static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val,
-  int over)
-{
-   u32 val0, val1, val2;
-
-   t1_tpi_read(adapter, offs, val0);
-   t1_tpi_read(adapter, offs + 4, val1);
-   t1_tpi_read(adapter, offs + 8, val2);
-
-   *val = ~0ull  40;
-   *val |= val0  0x;
-   *val |= (val1  0x)  16;
-   *val |= (u64)(val2  0xff)  32;
-
-   if (over)
-   *val += 1ull  40;
+#define RMON_UPDATE(mac, name, stat_name) \
+{ \
+   t1_tpi_read((mac)-adapter, OFFSET(name), val0); \
+   t1_tpi_read((mac)-adapter, OFFSET((name)+1), val1); \
+   t1_tpi_read((mac)-adapter, OFFSET((name)+2), val2

[PATCH 1/9] cxgb3 - fix MSI-X failure path

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Return error code when msi-x settings fail.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 61ffc92..bb0d1c8 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -839,7 +839,8 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto irq_err;
 
-   if (request_msix_data_irqs(adap)) {
+   err = request_msix_data_irqs(adap);
+   if (err) {
free_irq(adap-msix_info[0].vec, adap);
goto irq_err;
}
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9] cxgb3 - Use wild card for PCI vendor ID match

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Vendor ID is not necessarily set to 1. 
Use Vendor Id wild card for PCI device matching

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index bb0d1c8..d92da8f 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -76,20 +76,20 @@ enum {
 
 #define EEPROM_MAGIC 0x38E2F10C
 
-#define CH_DEVICE(devid, ssid, idx) \
-   { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx }
+#define CH_DEVICE(devid, idx) \
+   { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, PCI_ANY_ID, 0, 0, idx }
 
 static const struct pci_device_id cxgb3_pci_tbl[] = {
-   CH_DEVICE(0x20, 1, 0),  /* PE9000 */
-   CH_DEVICE(0x21, 1, 1),  /* T302E */
-   CH_DEVICE(0x22, 1, 2),  /* T310E */
-   CH_DEVICE(0x23, 1, 3),  /* T320X */
-   CH_DEVICE(0x24, 1, 1),  /* T302X */
-   CH_DEVICE(0x25, 1, 3),  /* T320E */
-   CH_DEVICE(0x26, 1, 2),  /* T310X */
-   CH_DEVICE(0x30, 1, 2),  /* T3B10 */
-   CH_DEVICE(0x31, 1, 3),  /* T3B20 */
-   CH_DEVICE(0x32, 1, 1),  /* T3B02 */
+   CH_DEVICE(0x20, 0), /* PE9000 */
+   CH_DEVICE(0x21, 1), /* T302E */
+   CH_DEVICE(0x22, 2), /* T310E */
+   CH_DEVICE(0x23, 3), /* T320X */
+   CH_DEVICE(0x24, 1), /* T302X */
+   CH_DEVICE(0x25, 3), /* T320E */
+   CH_DEVICE(0x26, 2), /* T310X */
+   CH_DEVICE(0x30, 2), /* T3B10 */
+   CH_DEVICE(0x31, 3), /* T3B20 */
+   CH_DEVICE(0x32, 1), /* T3B02 */
{0,}
 };
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/9] cxgb3 - Fix resources release.

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Remove sysfs entries before unregistering the net devices.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index d92da8f..9d14652 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2585,10 +2585,6 @@ static void __devexit remove_one(struct pci_dev *pdev)
sysfs_remove_group(adapter-port[0]-dev.kobj,
   cxgb3_attr_group);
 
-   for_each_port(adapter, i)
-   if (test_bit(i, adapter-registered_device_map))
-   unregister_netdev(adapter-port[i]);
-
if (is_offload(adapter)) {
cxgb3_adapter_unofld(adapter);
if (test_bit(OFFLOAD_DEVMAP_BIT,
@@ -2596,6 +2592,10 @@ static void __devexit remove_one(struct pci_dev *pdev)
offload_close(adapter-tdev);
}
 
+   for_each_port(adapter, i)
+   if (test_bit(i, adapter-registered_device_map))
+   unregister_netdev(adapter-port[i]);
+
t3_free_sge_resources(adapter);
cxgb_disable_msi(adapter);
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/9] cxgb3 - Add EEH support

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Add PCI recovery support

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |  107 
 1 files changed, 107 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 9d14652..1b9a711 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2316,6 +2316,112 @@ void t3_fatal_err(struct adapter *adapter)
 
 }
 
+/**
+ * t3_io_error_detected - called when PCI error is detected
+ * @pdev: Pointer to PCI device
+ * @state: The current pci connection state
+ *
+ * This function is called after a PCI bus error affecting
+ * this device has been detected.
+ */
+static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
+pci_channel_state_t state)
+{
+   struct net_device *dev = pci_get_drvdata(pdev);
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adapter = pi-adapter;
+   int i;
+
+   /* Stop all ports */
+   for_each_port(adapter, i) {
+   struct net_device *netdev = adapter-port[i];
+
+   if (netif_running(netdev))
+   cxgb_close(netdev);
+   }
+
+   if (is_offload(adapter)  
+   test_bit(OFFLOAD_DEVMAP_BIT, adapter-open_device_map))
+   offload_close(adapter-tdev);
+
+   /* Free sge resources */
+   t3_free_sge_resources(adapter);
+
+   adapter-flags = ~FULL_INIT_DONE;
+
+   pci_disable_device(pdev);
+
+   /* Request a slot slot reset. */
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * t3_io_slot_reset - called after the pci bus has been reset.
+ * @pdev: Pointer to PCI device
+ *
+ * Restart the card from scratch, as if from a cold-boot.
+ */
+static pci_ers_result_t t3_io_slot_reset(struct pci_dev *pdev)
+{
+   struct net_device *dev = pci_get_drvdata(pdev);
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adapter = pi-adapter;
+
+   if (pci_enable_device(pdev)) {
+   dev_err(pdev-dev,
+   Cannot re-enable PCI device after reset.\n);
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+   pci_set_master(pdev);
+
+   t3_prep_adapter(adapter, adapter-params.info, 1);
+
+   return PCI_ERS_RESULT_RECOVERED;
+}
+
+/**
+ * t3_io_resume - called when traffic can start flowing again.
+ * @pdev: Pointer to PCI device
+ *
+ * This callback is called when the error recovery driver tells us that
+ * its OK to resume normal operation.
+ */
+static void t3_io_resume(struct pci_dev *pdev)
+{
+   struct net_device *dev = pci_get_drvdata(pdev);
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adapter = pi-adapter;
+   int i;
+
+   /* Restart the ports */
+   for_each_port(adapter, i) {
+   struct net_device *netdev = adapter-port[i];
+
+   if (netif_running(netdev)) {
+   if (cxgb_open(netdev)) {
+   dev_err(pdev-dev,
+   can't bring device back up
+after reset\n);
+   continue;
+   }
+   netif_device_attach(netdev);
+   }
+   }
+
+   if (is_offload(adapter)) {
+   __set_bit(OFFLOAD_DEVMAP_BIT, adapter-registered_device_map);
+   if (offload_open(dev))
+   printk(KERN_WARNING
+  Could not bring back offload capabilities\n);
+   }
+}
+
+static struct pci_error_handlers t3_err_handler = {
+   .error_detected = t3_io_error_detected,
+   .slot_reset = t3_io_slot_reset,
+   .resume = t3_io_resume,
+};
+
 static int __devinit cxgb_enable_msix(struct adapter *adap)
 {
struct msix_entry entries[SGE_QSETS + 1];
@@ -2616,6 +2722,7 @@ static struct pci_driver driver = {
.id_table = cxgb3_pci_tbl,
.probe = init_one,
.remove = __devexit_p(remove_one),
+   .err_handler = t3_err_handler,
 };
 
 static int __init cxgb3_init_module(void)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9] cxgb3 - FW upgrade

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Bump up FW version to 5.0.
Do not downgrade FW within the same major version range.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/t3_hw.c   |   10 +++---
 drivers/net/cxgb3/version.h |4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index d4ee00d..4b6087a 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -988,13 +988,17 @@ int t3_check_fw_version(struct adapter *adapter, int 
*must_load)
CH_ERR(adapter, found wrong FW version(%u.%u), 
   driver needs version %u.%u\n, major, minor,
   FW_VERSION_MAJOR, FW_VERSION_MINOR);
-   else {
+   else if (minor  FW_VERSION_MINOR) {
*must_load = 0;
-   CH_WARN(adapter, found wrong FW minor version(%u.%u), 
+   CH_WARN(adapter, found old FW minor version(%u.%u), 
+   driver compiled for version %u.%u\n, major, minor,
+   FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   } else {
+   CH_WARN(adapter, found newer FW version(%u.%u), 
driver compiled for version %u.%u\n, major, minor,
FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   return 0;
}
-
return -EINVAL;
 }
 
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
index ef1c633..229303f 100644
--- a/drivers/net/cxgb3/version.h
+++ b/drivers/net/cxgb3/version.h
@@ -38,7 +38,7 @@
 #define DRV_VERSION 1.0-ko
 
 /* Firmware version */
-#define FW_VERSION_MAJOR 4
-#define FW_VERSION_MINOR 6
+#define FW_VERSION_MAJOR 5
+#define FW_VERSION_MINOR 0
 #define FW_VERSION_MICRO 0
 #endif /* __CHELSIO_VERSION_H */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/9] cxgb3 - driver update

2007-11-16 Thread Divy Le Ray

Jeff, Dave,

I'm submitting a patch series for inclusion in 2.6.25.
The patches are built against netdev#upstream.

Here is a brief description:
- Fix error path when requesting MSI-X resources
- Use wild card for PCI Vendor ID
- Fix sysfs resource release
- Add PCI error recovery support
- FW upgrade
- Fix interaction with pktgen
- Remove unused argument in sysfs related methods
- HW setup update
- Synchronize I/O access on Tx path

Cheers,
Divy


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9] cxgb3 - fix interaction with pktgen

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Do not use skb-cb to stash unmap info,
save the info to the descriptor state.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/sge.c |   82 +++
 1 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index c15e43a..7b13d8a 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -91,6 +91,10 @@ struct rx_desc {
 
 struct tx_sw_desc {/* SW state per Tx descriptor */
struct sk_buff *skb;
+   u8 eop;   /* set if last descriptor for packet */
+   u8 addr_idx;  /* buffer index of first SGL entry in descriptor */
+   u8 fragidx;   /* first page fragment associated with descriptor */
+   s8 sflit; /* start flit of first SGL entry in descriptor */
 };
 
 struct rx_sw_desc {/* SW state per Rx descriptor */
@@ -109,13 +113,6 @@ struct rsp_desc {  /* response queue descriptor */
u8 intr_gen;
 };
 
-struct unmap_info {/* packet unmapping info, overlays skb-cb */
-   int sflit;  /* start flit of first SGL entry in Tx 
descriptor */
-   u16 fragidx;/* first page fragment in current Tx descriptor 
*/
-   u16 addr_idx;   /* buffer index of first SGL entry in 
descriptor */
-   u32 len;/* mapped length of skb main body */
-};
-
 /*
  * Holds unmapping information for Tx packets that need deferred unmapping.
  * This structure lives at skb-head and must be allocated by callers.
@@ -209,32 +206,36 @@ static inline int need_skb_unmap(void)
  *
  * Unmap the main body of an sk_buff and its page fragments, if any.
  * Because of the fairly complicated structure of our SGLs and the desire
- * to conserve space for metadata, we keep the information necessary to
- * unmap an sk_buff partly in the sk_buff itself (in its cb), and partly
- * in the Tx descriptors (the physical addresses of the various data
- * buffers).  The send functions initialize the state in skb-cb so we
- * can unmap the buffers held in the first Tx descriptor here, and we
- * have enough information at this point to update the state for the next
- * Tx descriptor.
+ * to conserve space for metadata, the information necessary to unmap an
+ * sk_buff is spread across the sk_buff itself (buffer lengths), the HW Tx
+ * descriptors (the physical addresses of the various data buffers), and
+ * the SW descriptor state (assorted indices).  The send functions
+ * initialize the indices for the first packet descriptor so we can unmap
+ * the buffers held in the first Tx descriptor here, and we have enough
+ * information at this point to set the state for the next Tx descriptor.
+ *
+ * Note that it is possible to clean up the first descriptor of a packet
+ * before the send routines have written the next descriptors, but this
+ * race does not cause any problem.  We just end up writing the unmapping
+ * info for the descriptor first.
  */
 static inline void unmap_skb(struct sk_buff *skb, struct sge_txq *q,
 unsigned int cidx, struct pci_dev *pdev)
 {
const struct sg_ent *sgp;
-   struct unmap_info *ui = (struct unmap_info *)skb-cb;
-   int nfrags, frag_idx, curflit, j = ui-addr_idx;
+   struct tx_sw_desc *d = q-sdesc[cidx];
+   int nfrags, frag_idx, curflit, j = d-addr_idx;
 
-   sgp = (struct sg_ent *)q-desc[cidx].flit[ui-sflit];
+   sgp = (struct sg_ent *)q-desc[cidx].flit[d-sflit];
+   frag_idx = d-fragidx;
 
-   if (ui-len) {
-   pci_unmap_single(pdev, be64_to_cpu(sgp-addr[0]), ui-len,
-PCI_DMA_TODEVICE);
-   ui-len = 0;/* so we know for next descriptor for this skb 
*/
+   if (frag_idx == 0  skb_headlen(skb)) {
+   pci_unmap_single(pdev, be64_to_cpu(sgp-addr[0]),
+skb_headlen(skb), PCI_DMA_TODEVICE);
j = 1;
}
 
-   frag_idx = ui-fragidx;
-   curflit = ui-sflit + 1 + j;
+   curflit = d-sflit + 1 + j;
nfrags = skb_shinfo(skb)-nr_frags;
 
while (frag_idx  nfrags  curflit  WR_FLITS) {
@@ -250,10 +251,11 @@ static inline void unmap_skb(struct sk_buff *skb, struct 
sge_txq *q,
frag_idx++;
}
 
-   if (frag_idx  nfrags) {/* SGL continues into next Tx 
descriptor */
-   ui-fragidx = frag_idx;
-   ui-addr_idx = j;
-   ui-sflit = curflit - WR_FLITS - j; /* sflit can be -1 */
+   if (frag_idx  nfrags) {   /* SGL continues into next Tx descriptor */
+   d = cidx + 1 == q-size ? q-sdesc : d + 1;
+   d-fragidx = frag_idx;
+   d-addr_idx = j;
+   d-sflit = curflit - WR_FLITS - j; /* sflit can be -1 */
}
 }
 
@@ -281,7

[PATCH 7/9] cxgb3 - sysfs methods clean up

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Remove unused argument in sysfs methods

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   19 +--
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 1b9a711..b4ee18b 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -410,8 +410,7 @@ static int setup_sge_qsets(struct adapter *adap)
return 0;
 }
 
-static ssize_t attr_show(struct device *d, struct device_attribute *attr,
-char *buf,
+static ssize_t attr_show(struct device *d, char *buf,
 ssize_t(*format) (struct net_device *, char *))
 {
ssize_t len;
@@ -423,7 +422,7 @@ static ssize_t attr_show(struct device *d, struct 
device_attribute *attr,
return len;
 }
 
-static ssize_t attr_store(struct device *d, struct device_attribute *attr,
+static ssize_t attr_store(struct device *d,
  const char *buf, size_t len,
  ssize_t(*set) (struct net_device *, unsigned int),
  unsigned int min_val, unsigned int max_val)
@@ -457,7 +456,7 @@ static ssize_t format_##name(struct net_device *dev, char 
*buf) \
 static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
   char *buf) \
 { \
-   return attr_show(d, attr, buf, format_##name); \
+   return attr_show(d, buf, format_##name); \
 }
 
 static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
@@ -480,7 +479,7 @@ static ssize_t set_nfilters(struct net_device *dev, 
unsigned int val)
 static ssize_t store_nfilters(struct device *d, struct device_attribute *attr,
  const char *buf, size_t len)
 {
-   return attr_store(d, attr, buf, len, set_nfilters, 0, ~0);
+   return attr_store(d, buf, len, set_nfilters, 0, ~0);
 }
 
 static ssize_t set_nservers(struct net_device *dev, unsigned int val)
@@ -500,7 +499,7 @@ static ssize_t set_nservers(struct net_device *dev, 
unsigned int val)
 static ssize_t store_nservers(struct device *d, struct device_attribute *attr,
  const char *buf, size_t len)
 {
-   return attr_store(d, attr, buf, len, set_nservers, 0, ~0);
+   return attr_store(d, buf, len, set_nservers, 0, ~0);
 }
 
 #define CXGB3_ATTR_R(name, val_expr) \
@@ -524,7 +523,7 @@ static struct attribute *cxgb3_attrs[] = {
 
 static struct attribute_group cxgb3_attr_group = {.attrs = cxgb3_attrs };
 
-static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
+static ssize_t tm_attr_show(struct device *d,
char *buf, int sched)
 {
struct port_info *pi = netdev_priv(to_net_dev(d));
@@ -550,7 +549,7 @@ static ssize_t tm_attr_show(struct device *d, struct 
device_attribute *attr,
return len;
 }
 
-static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
+static ssize_t tm_attr_store(struct device *d,
 const char *buf, size_t len, int sched)
 {
struct port_info *pi = netdev_priv(to_net_dev(d));
@@ -578,12 +577,12 @@ static ssize_t tm_attr_store(struct device *d, struct 
device_attribute *attr,
 static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
   char *buf) \
 { \
-   return tm_attr_show(d, attr, buf, sched); \
+   return tm_attr_show(d, buf, sched); \
 } \
 static ssize_t store_##name(struct device *d, struct device_attribute *attr, \
const char *buf, size_t len) \
 { \
-   return tm_attr_store(d, attr, buf, len, sched); \
+   return tm_attr_store(d, buf, len, sched); \
 } \
 static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_##name)
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9] cxgb3 - Fix I/O synchronization

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Synchronize memory access before ringing 
the Tx door bell.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/sge.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 7b13d8a..666c317 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -174,6 +174,7 @@ static inline struct sge_qset *txq_to_qset(const struct 
sge_txq *q, int qidx)
 static inline void refill_rspq(struct adapter *adapter,
   const struct sge_rspq *q, unsigned int credits)
 {
+   rmb();
t3_write_reg(adapter, A_SG_RSPQ_CREDIT_RETURN,
 V_RSPQ(q-cntxt_id) | V_CREDITS(credits));
 }
@@ -458,7 +459,7 @@ nomem:  q-alloc_failed++;
}
q-credits++;
}
-
+   wmb();
t3_write_reg(adap, A_SG_KDOORBELL, V_EGRCNTX(q-cntxt_id));
 }
 
@@ -1353,6 +1354,7 @@ static void restart_ctrlq(unsigned long data)
}
 
spin_unlock(q-lock);
+   wmb();
t3_write_reg(qs-adap, A_SG_KDOORBELL,
 F_SELEGRCNTX | V_EGRCNTX(q-cntxt_id));
 }
@@ -1572,6 +1574,7 @@ static void restart_offloadq(unsigned long data)
set_bit(TXQ_RUNNING, q-flags);
set_bit(TXQ_LAST_PKT_DB, q-flags);
 #endif
+   wmb();
t3_write_reg(adap, A_SG_KDOORBELL,
 F_SELEGRCNTX | V_EGRCNTX(q-cntxt_id));
 }
@@ -1737,7 +1740,6 @@ static inline int rx_offload(struct t3cdev *tdev, struct 
sge_rspq *rq,
 struct sk_buff *skb, struct sk_buff *rx_gather[],
 unsigned int gather_idx)
 {
-   rq-offload_pkts++;
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
@@ -2031,6 +2033,7 @@ no_mem:
if (eth)
rx_eth(adap, q, skb, ethpad);
else {
+   q-offload_pkts++;
/* Preserve the RSS info in csum  priority */
skb-csum = rss_hi;
skb-priority = rss_lo;
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9] cxgb3 - HW set up updates

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Disable PEX errors. The HW generates false positives.
Update RSS hash function to a symmetric algorithm.
Update T3C HW support

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |2 +-
 drivers/net/cxgb3/regs.h   |   22 ++
 drivers/net/cxgb3/t3_hw.c  |   24 +---
 3 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index b4ee18b..f24a27b 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -336,7 +336,7 @@ static void setup_rss(struct adapter *adap)
 
t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN |
  F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN |
- V_RRCPLCPUSIZE(6), cpus, rspq_map);
+ V_RRCPLCPUSIZE(6) | F_HASHTOEPLITZ, cpus, rspq_map);
 }
 
 static void init_napi(struct adapter *adap)
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 5e1bc0d..a7d5f65 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -965,6 +965,12 @@
 #define V_LOCKTID(x) ((x)  S_LOCKTID)
 #define F_LOCKTIDV_LOCKTID(1U)
 
+#define S_TABLELATENCYDELTA0
+#define M_TABLELATENCYDELTA0xf
+#define V_TABLELATENCYDELTA(x) ((x)  S_TABLELATENCYDELTA)
+#define G_TABLELATENCYDELTA(x) \
+   (((x)  S_TABLELATENCYDELTA)  M_TABLELATENCYDELTA)
+
 #define A_TP_PC_CONFIG2 0x34c
 
 #define S_CHDRAFULL4
@@ -1146,6 +1152,10 @@
 #define V_RQFEEDBACKENABLE(x) ((x)  S_RQFEEDBACKENABLE)
 #define F_RQFEEDBACKENABLEV_RQFEEDBACKENABLE(1U)
 
+#define S_HASHTOEPLITZ2
+#define V_HASHTOEPLITZ(x) ((x)  S_HASHTOEPLITZ)
+#define F_HASHTOEPLITZV_HASHTOEPLITZ(1U)
+
 #define S_DISABLE0
 
 #define A_TP_TM_PIO_ADDR 0x418
@@ -1198,6 +1208,14 @@
 
 #define A_TP_INT_ENABLE 0x470
 
+#define S_FLMTXFLSTEMPTY30
+#define V_FLMTXFLSTEMPTY(x) ((x)  S_FLMTXFLSTEMPTY)
+#define F_FLMTXFLSTEMPTYV_FLMTXFLSTEMPTY(1U)
+
+#define S_FLMRXFLSTEMPTY29
+#define V_FLMRXFLSTEMPTY(x) ((x)  S_FLMRXFLSTEMPTY)
+#define F_FLMRXFLSTEMPTYV_FLMRXFLSTEMPTY(1U)
+
 #define A_TP_INT_CAUSE 0x474
 
 #define A_TP_TX_MOD_Q1_Q0_RATE_LIMIT 0x8
@@ -1291,6 +1309,10 @@
 
 #define A_ULPTX_CONFIG 0x580
 
+#define S_CFG_CQE_SOP_MASK1
+#define V_CFG_CQE_SOP_MASK(x) ((x)  S_CFG_CQE_SOP_MASK)
+#define F_CFG_CQE_SOP_MASKV_CFG_CQE_SOP_MASK(1U)
+
 #define S_CFG_RR_ARB0
 #define V_CFG_RR_ARB(x) ((x)  S_CFG_RR_ARB)
 #define F_CFG_RR_ARBV_CFG_RR_ARB(1U)
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 4b6087a..b8ae12d 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1280,7 +1280,7 @@ static int t3_handle_intr_status(struct adapter *adapter, 
unsigned int reg,
 #define PCIE_INTR_MASK (F_UNXSPLCPLERRR | F_UNXSPLCPLERRC | F_PCIE_PIOPARERR |\
F_PCIE_WFPARERR | F_PCIE_RFPARERR | F_PCIE_CFPARERR | \
/* V_PCIE_MSIXPARERR(M_PCIE_MSIXPARERR) | */ \
-   V_BISTERR(M_BISTERR) | F_PEXERR)
+   V_BISTERR(M_BISTERR))
 #define ULPRX_INTR_MASK F_PARERR
 #define ULPTX_INTR_MASK 0
 #define CPLSW_INTR_MASK (F_TP_FRAMING_ERROR | \
@@ -1383,8 +1383,16 @@ static void tp_intr_handler(struct adapter *adapter)
{0}
};
 
+   static struct intr_info tp_intr_info_t3c[] = {
+   { 0x1ff,  TP parity error, -1, 1 },
+   { F_FLMRXFLSTEMPTY, TP out of Rx pages, -1, 1 },
+   { F_FLMTXFLSTEMPTY, TP out of Tx pages, -1, 1 },
+   { 0 }
+   };
+
if (t3_handle_intr_status(adapter, A_TP_INT_CAUSE, 0x,
- tp_intr_info, NULL))
+ adapter-params.rev  T3_REV_C ?
+   tp_intr_info : tp_intr_info_t3c, NULL))
t3_fatal_err(adapter);
 }
 
@@ -1734,7 +1742,6 @@ void t3_intr_enable(struct adapter *adapter)
 MC7_INTR_MASK},
{A_MC5_DB_INT_ENABLE, MC5_INTR_MASK},
{A_ULPRX_INT_ENABLE, ULPRX_INTR_MASK},
-   {A_TP_INT_ENABLE, 0x3bf},
{A_PM1_TX_INT_ENABLE, PMTX_INTR_MASK},
{A_PM1_RX_INT_ENABLE, PMRX_INTR_MASK},
{A_CIM_HOST_INT_ENABLE, CIM_INTR_MASK},
@@ -1744,6 +1751,8 @@ void t3_intr_enable(struct adapter *adapter)
adapter-slow_intr_mask = PL_INTR_MASK;
 
t3_write_regs(adapter, intr_en_avp, ARRAY_SIZE(intr_en_avp), 0);
+   t3_write_reg(adapter, A_TP_INT_ENABLE,
+adapter-params.rev = T3_REV_C ? 0x2bf : 0x3bf);
 
if (adapter-params.rev  0) {
t3_write_reg(adapter, A_CPL_INTR_ENABLE,
@@ -2509,6 +2518,11 @@ static void tp_config(struct adapter *adap, const struct 
tp_params *p)
} else
t3_set_reg_field(adap, A_TP_PARA_REG3, 0

Re: [PATCH 2/9] cxgb3 - Use wild card for PCI vendor ID match

2007-11-16 Thread Divy Le Ray

Divy Le Ray wrote:

From: Divy Le Ray [EMAIL PROTECTED]

Vendor ID is not necessarily set to 1. 
  

This patch modifies the sub-device id, not the vendor id ...


Use Vendor Id wild card for PCI device matching

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index bb0d1c8..d92da8f 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -76,20 +76,20 @@ enum {
 
 #define EEPROM_MAGIC 0x38E2F10C
 
-#define CH_DEVICE(devid, ssid, idx) \

-   { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx }
+#define CH_DEVICE(devid, idx) \
+   { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, PCI_ANY_ID, 0, 0, idx }
 
 static const struct pci_device_id cxgb3_pci_tbl[] = {

-   CH_DEVICE(0x20, 1, 0),  /* PE9000 */
-   CH_DEVICE(0x21, 1, 1),  /* T302E */
-   CH_DEVICE(0x22, 1, 2),  /* T310E */
-   CH_DEVICE(0x23, 1, 3),  /* T320X */
-   CH_DEVICE(0x24, 1, 1),  /* T302X */
-   CH_DEVICE(0x25, 1, 3),  /* T320E */
-   CH_DEVICE(0x26, 1, 2),  /* T310X */
-   CH_DEVICE(0x30, 1, 2),  /* T3B10 */
-   CH_DEVICE(0x31, 1, 3),  /* T3B20 */
-   CH_DEVICE(0x32, 1, 1),  /* T3B02 */
+   CH_DEVICE(0x20, 0), /* PE9000 */
+   CH_DEVICE(0x21, 1), /* T302E */
+   CH_DEVICE(0x22, 2), /* T310E */
+   CH_DEVICE(0x23, 3), /* T320X */
+   CH_DEVICE(0x24, 1), /* T302X */
+   CH_DEVICE(0x25, 3), /* T320E */
+   CH_DEVICE(0x26, 2), /* T310X */
+   CH_DEVICE(0x30, 2), /* T3B10 */
+   CH_DEVICE(0x31, 3), /* T3B20 */
+   CH_DEVICE(0x32, 1), /* T3B02 */
{0,}
 };
 
-

To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9 RESEND] cxgb3 - Use wild card for PCI subdevice ID match

2007-11-16 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Subdevice ID is not necessarily set to 1. 
Use wild card for PCI device matching

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index bb0d1c8..d92da8f 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -76,20 +76,20 @@ enum {
 
 #define EEPROM_MAGIC 0x38E2F10C
 
-#define CH_DEVICE(devid, ssid, idx) \
-   { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx }
+#define CH_DEVICE(devid, idx) \
+   { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, PCI_ANY_ID, 0, 0, idx }
 
 static const struct pci_device_id cxgb3_pci_tbl[] = {
-   CH_DEVICE(0x20, 1, 0),  /* PE9000 */
-   CH_DEVICE(0x21, 1, 1),  /* T302E */
-   CH_DEVICE(0x22, 1, 2),  /* T310E */
-   CH_DEVICE(0x23, 1, 3),  /* T320X */
-   CH_DEVICE(0x24, 1, 1),  /* T302X */
-   CH_DEVICE(0x25, 1, 3),  /* T320E */
-   CH_DEVICE(0x26, 1, 2),  /* T310X */
-   CH_DEVICE(0x30, 1, 2),  /* T3B10 */
-   CH_DEVICE(0x31, 1, 3),  /* T3B20 */
-   CH_DEVICE(0x32, 1, 1),  /* T3B02 */
+   CH_DEVICE(0x20, 0), /* PE9000 */
+   CH_DEVICE(0x21, 1), /* T302E */
+   CH_DEVICE(0x22, 2), /* T310E */
+   CH_DEVICE(0x23, 3), /* T320X */
+   CH_DEVICE(0x24, 1), /* T302X */
+   CH_DEVICE(0x25, 3), /* T320E */
+   CH_DEVICE(0x26, 2), /* T310X */
+   CH_DEVICE(0x30, 2), /* T3B10 */
+   CH_DEVICE(0x31, 3), /* T3B20 */
+   CH_DEVICE(0x32, 1), /* T3B02 */
{0,}
 };
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: reproducible cxgb kernel panic in FC8 kernel 2.6.23.1-49

2007-11-15 Thread Divy Le Ray

Ben Greear wrote:
This panic happens (almost?) immediately after starting TCP traffic 
between

the cxgb nic on this system and another.  We also got at least one crash
on a custom/tainted 2.6.20.12 kernel, but it would run for at least
a few minutes at ~1Gbps first.

I think my serial console chomped some of this..but it's very 
reproducible,

so if you need more info I can make the terminal wider and do it again.


Hi Ben,

I just posted a patch fixing this T2 crash. It appeared in 2.6.22, when 
eth_type_trans()
was modified to set skb-dev. cxgb3 got fixed at the time, but I 
obviously forgot the
chelsio driver. I'm a bit behind on T2 updates. I will get to it in a 
few days.


Cheers,
Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] chelsio - Fix skb-dev setting

2007-11-15 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

eth_type_trans() now sets skb-dev. 
Access skb-def after it gets set.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/chelsio/sge.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index ffa7e64..4436662 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1379,11 +1379,11 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, 
unsigned int len)
}
__skb_pull(skb, sizeof(*p));
 
-   skb-dev-last_rx = jiffies;
st = per_cpu_ptr(sge-port_stats[p-iff], smp_processor_id());
st-rx_packets++;
 
skb-protocol = eth_type_trans(skb, adapter-port[p-iff].dev);
+   skb-dev-last_rx = jiffies;
if ((adapter-flags  RX_CSUM_ENABLED)  p-csum == 0x 
skb-protocol == htons(ETH_P_IP) 
(skb-data[9] == IPPROTO_TCP || skb-data[9] == IPPROTO_UDP)) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-2.6.24] cxgb3 - napi update

2007-09-09 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Embed napi_struct directly into sge_qset.
Use napi_schedule/napi_complete.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h|   20 +++---
 drivers/net/cxgb3/cxgb3_main.c |   57 ++
 drivers/net/cxgb3/sge.c|   77 +++-
 3 files changed, 55 insertions(+), 99 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index e723e7b..0442617 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -49,11 +49,13 @@
 typedef irqreturn_t(*intr_handler_t) (int, void *);
 
 struct vlan_group;
-
 struct adapter;
+struct sge_qset;
+
 struct port_info {
struct adapter *adapter;
struct vlan_group *vlan_grp;
+   struct sge_qset *qs;
const struct port_type_info *port_type;
u8 port_id;
u8 rx_csum_offload;
@@ -172,12 +174,12 @@ enum {/* per port SGE 
statistics */
SGE_PSTAT_MAX   /* must be last */
 };
 
-struct adapter_napi;
 struct sge_qset {  /* an SGE queue set */
+   struct adapter *adap;
+   struct napi_struct napi;
struct sge_rspq rspq;
struct sge_fl fl[SGE_RXQ_PER_SET];
struct sge_txq txq[SGE_TXQ_PER_SET];
-   struct adapter_napi *anapi;
struct net_device *netdev;
unsigned long txq_stopped;  /* which Tx queues are stopped */
struct timer_list tx_reclaim_timer; /* reclaims TX buffers */
@@ -189,13 +191,6 @@ struct sge {
spinlock_t reg_lock;/* guards non-atomic SGE registers (eg context) 
*/
 };
 
-struct adapter_napi {
-   struct napi_struct napi;
-   struct adapter *adapter;
-   int port;
-   int qset;
-};
-
 struct adapter {
struct t3cdev tdev;
struct list_head adapter_list;
@@ -230,8 +225,6 @@ struct adapter {
struct delayed_work adap_check_task;
struct work_struct ext_intr_handler_task;
 
-   struct adapter_napi napi[SGE_QSETS];
-
struct dentry *debugfs_root;
 
struct mutex mdio_lock;
@@ -283,8 +276,7 @@ int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
 void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p);
 int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
  int irq_vec_idx, const struct qset_params *p,
- int ntxq, struct adapter_napi *anapi,
- struct net_device *dev);
+ int ntxq, struct net_device *dev);
 int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx,
unsigned char *data);
 irqreturn_t t3_sge_intr_msix(int irq, void *cookie);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index f5ce06d..5db7d4e 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -339,24 +339,17 @@ static void setup_rss(struct adapter *adap)
  V_RRCPLCPUSIZE(6), cpus, rspq_map);
 }
 
-static int init_napi(struct adapter *adap)
+static void init_napi(struct adapter *adap)
 {
-   int i, j, napi_idx = 0;
+   int i;
 
-   for_each_port(adap, i) {
-   struct net_device *dev = adap-port[i];
-   const struct port_info *pi = netdev_priv(dev);
+   for (i = 0; i  SGE_QSETS; i++) {
+   struct sge_qset *qs = adap-sge.qs[i];
 
-   for (j = 0; j  pi-nqsets - 1; j++) {
-   netif_napi_add(dev, adap-napi[napi_idx].napi,
-  NULL, 64);
-   adap-napi[napi_idx].adapter = adap;
-   adap-napi[napi_idx].port = i;
-   adap-napi[napi_idx].qset = j;
-   napi_idx++;
-   }
+   if (qs-adap)
+   netif_napi_add(qs-netdev, qs-napi, qs-napi.poll,
+  64);
}
-   return 0;
 }
 
 /*
@@ -368,20 +361,17 @@ static void quiesce_rx(struct adapter *adap)
 {
int i;
 
-   for (i = 0; i  ARRAY_SIZE(adap-napi); i++) {
-   struct adapter_napi *anapi = adap-napi[i];
-   napi_disable(anapi-napi);
-   }
+   for (i = 0; i  SGE_QSETS; i++)
+   if (adap-sge.qs[i].adap)
+   napi_disable(adap-sge.qs[i].napi);
 }
 
 static void enable_all_napi(struct adapter *adap)
 {
int i;
-
-   for (i = 0; i  ARRAY_SIZE(adap-napi); i++) {
-   struct adapter_napi *anapi = adap-napi[i];
-   napi_enable(anapi-napi);
-   }
+   for (i = 0; i  SGE_QSETS; i++)
+   if (adap-sge.qs[i].adap)
+   napi_enable(adap-sge.qs[i].napi);
 }
 
 /**
@@ -394,7 +384,7 @@ static void enable_all_napi(struct adapter *adap)
  */
 static int setup_sge_qsets(struct adapter *adap)
 {
-   int i, j, err

Re: [PATCH 9/11] cxgb3 - engine microcode update

2007-09-05 Thread Divy Le Ray





 I think 9-14 still need to be incorporated.  I don't see them in your
 upstream branch, and they aren't in linus' tree either.

I am not the blocker here. 



Sorry for the delay - again.
I'm resubmitting these patches against net#upstream.

Cheers,
Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7 RESEND] cxgb3 - Firmware update

2007-09-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Update firmware version.
Allow the driver to be up and running with older FW image

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |2 +-
 drivers/net/cxgb3/cxgb3_main.c |9 +
 drivers/net/cxgb3/t3_hw.c  |   20 +++-
 drivers/net/cxgb3/version.h|2 +-
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 510e93f..ada5e4b 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -690,7 +690,7 @@ int t3_read_flash(struct adapter *adapter, unsigned int 
addr,
  unsigned int nwords, u32 *data, int byte_oriented);
 int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size);
 int t3_get_fw_version(struct adapter *adapter, u32 *vers);
-int t3_check_fw_version(struct adapter *adapter);
+int t3_check_fw_version(struct adapter *adapter, int *must_load);
 int t3_init_hw(struct adapter *adapter, u32 fw_params);
 void mac_prep(struct cmac *mac, struct adapter *adapter, int index);
 void early_hw_init(struct adapter *adapter, const struct adapter_info *ai);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index eabb841..ae9c213 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -832,11 +832,12 @@ static int cxgb_up(struct adapter *adap)
int must_load;
 
if (!(adap-flags  FULL_INIT_DONE)) {
-   err = t3_check_fw_version(adap);
-   if (err == -EINVAL)
+   err = t3_check_fw_version(adap, must_load);
+   if (err == -EINVAL) {
err = upgrade_fw(adap);
-   if (err)
-   goto out;
+   if (err  must_load)
+   goto out;
+   }
 
err = t3_check_tpsram_version(adap, must_load);
if (err == -EINVAL) {
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index e958bbe..2b49b96 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -960,16 +960,18 @@ int t3_get_fw_version(struct adapter *adapter, u32 *vers)
 /**
  * t3_check_fw_version - check if the FW is compatible with this driver
  * @adapter: the adapter
- *
+ * @must_load: set to 1 if loading a new FW image is required
+
  * Checks if an adapter's FW is compatible with the driver.  Returns 0
  * if the versions are compatible, a negative error otherwise.
  */
-int t3_check_fw_version(struct adapter *adapter)
+int t3_check_fw_version(struct adapter *adapter, int *must_load)
 {
int ret;
u32 vers;
unsigned int type, major, minor;
 
+   *must_load = 1;
ret = t3_get_fw_version(adapter, vers);
if (ret)
return ret;
@@ -982,9 +984,17 @@ int t3_check_fw_version(struct adapter *adapter)
minor == FW_VERSION_MINOR)
return 0;
 
-   CH_ERR(adapter, found wrong FW version(%u.%u), 
-  driver needs version %u.%u\n, major, minor,
-  FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   if (major != FW_VERSION_MAJOR)
+   CH_ERR(adapter, found wrong FW version(%u.%u), 
+  driver needs version %u.%u\n, major, minor,
+  FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   else {
+   *must_load = 0;
+   CH_WARN(adapter, found wrong FW minor version(%u.%u), 
+   driver compiled for version %u.%u\n, major, minor,
+   FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   }
+
return -EINVAL;
 }
 
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
index eb508bf..ef1c633 100644
--- a/drivers/net/cxgb3/version.h
+++ b/drivers/net/cxgb3/version.h
@@ -39,6 +39,6 @@
 
 /* Firmware version */
 #define FW_VERSION_MAJOR 4
-#define FW_VERSION_MINOR 3
+#define FW_VERSION_MINOR 6
 #define FW_VERSION_MICRO 0
 #endif /* __CHELSIO_VERSION_H */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7 RESEND] cxgb3 - log and clear PEX errors

2007-09-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Clear pciE PEX errors late at module load time.
Log details when PEX errors occur.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/t3_hw.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 2b49b96..cdcfc13 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1358,6 +1358,10 @@ static void pcie_intr_handler(struct adapter *adapter)
{0}
};
 
+   if (t3_read_reg(adapter, A_PCIE_INT_CAUSE)  F_PEXERR)
+   CH_ALERT(adapter, PEX error code 0x%x\n,
+t3_read_reg(adapter, A_PCIE_PEX_ERR));
+
if (t3_handle_intr_status(adapter, A_PCIE_INT_CAUSE, PCIE_INTR_MASK,
  pcie_intr_info, adapter-irq_stats))
t3_fatal_err(adapter);
@@ -1809,6 +1813,8 @@ void t3_intr_clear(struct adapter *adapter)
for (i = 0; i  ARRAY_SIZE(cause_reg_addr); ++i)
t3_write_reg(adapter, cause_reg_addr[i], 0x);
 
+   if (is_pcie(adapter))
+   t3_write_reg(adapter, A_PCIE_PEX_ERR, 0x);
t3_write_reg(adapter, A_PL_INT_CAUSE0, 0x);
t3_read_reg(adapter, A_PL_INT_CAUSE0);  /* flush */
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7 RESEND] cxgb3 - remove false positive in xgmac workaround

2007-09-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Qualify toggling of xgmac tx enable with not getting pause frames, 
we might not make forward progress because the peer is sending 
lots of pause frames.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |1 +
 drivers/net/cxgb3/xgmac.c  |4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index ada5e4b..7e9e43d 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -513,6 +513,7 @@ struct cmac {
u64 rx_mcnt;
unsigned int toggle_cnt;
unsigned int txen;
+   u64 rx_pause;
struct mac_stats stats;
 };
 
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index 1d1c391..ff9e9dc 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -452,6 +452,7 @@ int t3_mac_enable(struct cmac *mac, int which)
A_XGM_TX_SPI4_SOP_EOP_CNT +
oft)));
mac-rx_mcnt = s-rx_frames;
+   mac-rx_pause = s-rx_pause;
mac-rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
A_XGM_RX_SPI4_SOP_EOP_CNT +
oft)));
@@ -504,7 +505,7 @@ int t3b2_mac_watchdog_task(struct cmac *mac)
tx_xcnt = 1;/* By default tx_xcnt is making progress */
tx_tcnt = mac-tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt */
rx_xcnt = 1;/* By default rx_xcnt is making progress */
-   if (tx_mcnt == mac-tx_mcnt) {
+   if (tx_mcnt == mac-tx_mcnt  mac-rx_pause == s-rx_pause) {
tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
A_XGM_TX_SPI4_SOP_EOP_CNT +
mac-offset)));
@@ -560,6 +561,7 @@ out:
mac-tx_mcnt = s-tx_frames;
mac-rx_xcnt = rx_xcnt;
mac-rx_mcnt = s-rx_frames;
+   mac-rx_pause = s-rx_pause;
if (status == 1) {
t3_write_reg(adap, A_XGM_TX_CTRL + mac-offset, 0);
t3_read_reg(adap, A_XGM_TX_CTRL + mac-offset);  /* flush */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] cxgb3 - Add T3C rev

2007-09-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

add driver recognition for T3C rev board. 

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |1 +
 drivers/net/cxgb3/cxgb3_main.c |3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 7e9e43d..d3f276c 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -438,6 +438,7 @@ enum {  /* chip 
revisions */
T3_REV_A  = 0,
T3_REV_B  = 2,
T3_REV_B2 = 3,
+   T3_REV_C  = 4,
 };
 
 struct trace_params {
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ae9c213..9d360eb 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -768,6 +768,9 @@ static inline char t3rev2char(struct adapter *adapter)
case T3_REV_B2:
rev = 'b';
break;
+   case T3_REV_C:
+   rev = 'c';
+   break;
}
return rev;
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] cxgb3 - Update engine microcode version

2007-09-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

The new microcode engine version is set to 1.1.0

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index d3f276c..3e5b0db 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -127,8 +127,8 @@ enum {  /* adapter 
interrupt-maintained statistics */
 
 enum {
TP_VERSION_MAJOR= 1,
-   TP_VERSION_MINOR= 0,
-   TP_VERSION_MICRO= 44
+   TP_VERSION_MINOR= 1,
+   TP_VERSION_MICRO= 0
 };
 
 #define S_TP_VERSION_MAJOR 16
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7 RESEND] cxgb3 - CQ context operations time out too soon.

2007-09-05 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Currently, the driver only tries up to 5 times (5us) to get the results
of a CQ context operation.  Testing has shown the chip can take as much
as 50us to return the response on SG_CONTEXT_CMD operations.  So we up
the retry count to 100 to cover high loads.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/t3_hw.c |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index bff1d02..0583293 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1870,6 +1870,8 @@ void t3_port_intr_clear(struct adapter *adapter, int idx)
phy-ops-intr_clear(phy);
 }
 
+#define SG_CONTEXT_CMD_ATTEMPTS 100
+
 /**
  * t3_sge_write_context - write an SGE context
  * @adapter: the adapter
@@ -1889,7 +1891,7 @@ static int t3_sge_write_context(struct adapter *adapter, 
unsigned int id,
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2075,7 +2077,7 @@ int t3_sge_enable_ecntxt(struct adapter *adapter, 
unsigned int id, int enable)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_EGRESS | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2099,7 +2101,7 @@ int t3_sge_disable_fl(struct adapter *adapter, unsigned 
int id)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_FREELIST | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2123,7 +2125,7 @@ int t3_sge_disable_rspcntxt(struct adapter *adapter, 
unsigned int id)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_RESPONSEQ | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2147,7 +2149,7 @@ int t3_sge_disable_cqcntxt(struct adapter *adapter, 
unsigned int id)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_CQ | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2172,7 +2174,7 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned 
int id, unsigned int op,
t3_write_reg(adapter, A_SG_CONTEXT_CMD, V_CONTEXT_CMD_OPCODE(op) |
 V_CONTEXT(id) | F_CQ);
if (t3_wait_op_done_val(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-   0, 5, 1, val))
+   0, SG_CONTEXT_CMD_ATTEMPTS, 1, val))
return -EIO;
 
if (op = 2  op  7) {
@@ -2182,7 +2184,8 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned 
int id, unsigned int op,
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(0) | F_CQ | V_CONTEXT(id));
if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD,
-   F_CONTEXT_CMD_BUSY, 0, 5, 1))
+   F_CONTEXT_CMD_BUSY, 0,
+   SG_CONTEXT_CMD_ATTEMPTS, 1))
return -EIO;
return G_CQ_INDEX(t3_read_reg(adapter, A_SG_CONTEXT_DATA0));
}
@@ -2208,7 +2211,7 @@ static int t3_sge_read_context(unsigned int type, struct 
adapter *adapter,
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id));
if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0,
-   5, 1))
+   SG_CONTEXT_CMD_ATTEMPTS, 1))
return -EIO;
data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0);
data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.23 0/2] cxgb3 - Fix dev-priv usage

2007-08-29 Thread Divy Le Ray

Roland Dreier wrote:


Looks OK to me but I would just roll up the second patch into the
first patch and let Jeff merge it as one commit.  There's no point in
creating an intermediate tree that doesn't build -- it just breaks git
bisect for no useful purpose.



Okay, Jeff agrees too, I'll do so.


Also as a side note, when trying to test this I got the message

could not load TP SRAM: unable to load t3a_protocol_sram-1.0.44.bin

and you guys seem to only have t3b protocol sram images on your web
site.  Could you send me the t3a file (or swap out my T3A boards for
T3B boards ;)?


I'd rather fix the driver then:
First, HW folks tell me that there is no need for engine
microcode update for T3A.
Moreover, there is a bug when the file name is constructed.
We have T3B and T3B2 board revs, the driver looks for
t3b_protocol_sram-1.0.44.bin for T3B2 boards and defaults to
t3a_protocol_sram-1.0.44.bin even for T3B boards.
I submitted a patch fixing this in netdev#upstream.
I should propose the fix for 2.6.23 instead.

Cheers,
Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.23 0/2] cxgb3 driver fixes

2007-08-29 Thread Divy Le Ray

Jeff,

I'm resubmitting the cxgb3 dev-priv issue.
I'm also submitting a patch fixing the engine microcode loading.

The first patch changes in both cxgb3 and iw_cxgb3 related to
the dev-priv issue.
The second patch allows the driver to load the engine microcode
at the right time - when a port is brought up as opposed to
the module getting loaded. It does a better job at logging
the loading activity, and loosen the strict version requirement
currently in place.

Cheers,
Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.23 1/2] cxgb3 - Fix dev-priv usage

2007-08-29 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

cxgb3 used netdev_priv() and dev-priv for different purposes.
In 2.6.23, netdev_priv() == dev-priv, cxgb3 needs a fix.
This patch is a partial backport of Dave Miller's changes in the 
net-2.6.24 git branch. 

Without this fix, cxgb3 crashes on 2.6.23.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/cxio_hal.c |2 -
 drivers/net/cxgb3/adapter.h|2 +
 drivers/net/cxgb3/cxgb3_main.c |  126 ++--
 drivers/net/cxgb3/cxgb3_offload.c  |   16 +++-
 drivers/net/cxgb3/cxgb3_offload.h  |2 +
 drivers/net/cxgb3/sge.c|   23 --
 drivers/net/cxgb3/t3cdev.h |3 -
 7 files changed, 105 insertions(+), 69 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c 
b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 1518b41..beb2a38 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -916,7 +916,7 @@ int cxio_rdev_open(struct cxio_rdev *rdev_p)
PDBG(%s opening rnic dev %s\n, __FUNCTION__, rdev_p-dev_name);
memset(rdev_p-ctrl_qp, 0, sizeof(rdev_p-ctrl_qp));
if (!rdev_p-t3cdev_p)
-   rdev_p-t3cdev_p = T3CDEV(netdev_p);
+   rdev_p-t3cdev_p = dev2t3cdev(netdev_p);
rdev_p-t3cdev_p-ulp = (void *) rdev_p;
err = rdev_p-t3cdev_p-ctl(rdev_p-t3cdev_p, RDMA_GET_PARAMS,
 (rdev_p-rnic_info));
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ab72563..20e887d 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,7 +50,9 @@ typedef irqreturn_t(*intr_handler_t) (int, void *);
 
 struct vlan_group;
 
+struct adapter;
 struct port_info {
+   struct adapter *adapter;
struct vlan_group *vlan_grp;
const struct port_type_info *port_type;
u8 port_id;
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..f3bf128 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -358,11 +358,14 @@ static int init_dummy_netdevs(struct adapter *adap)
 
for (j = 0; j  pi-nqsets - 1; j++) {
if (!adap-dummy_netdev[dummy_idx]) {
-   nd = alloc_netdev(0, , ether_setup);
+   struct port_info *p;
+
+   nd = alloc_netdev(sizeof(*p), , ether_setup);
if (!nd)
goto free_all;
 
-   nd-priv = adap;
+   p = netdev_priv(nd);
+   p-adapter = adap;
nd-weight = 64;
set_bit(__LINK_STATE_START, nd-state);
adap-dummy_netdev[dummy_idx] = nd;
@@ -482,7 +485,8 @@ static ssize_t attr_store(struct device *d, struct 
device_attribute *attr,
 #define CXGB3_SHOW(name, val_expr) \
 static ssize_t format_##name(struct net_device *dev, char *buf) \
 { \
-   struct adapter *adap = dev-priv; \
+   struct port_info *pi = netdev_priv(dev); \
+   struct adapter *adap = pi-adapter; \
return sprintf(buf, %u\n, val_expr); \
 } \
 static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
@@ -493,7 +497,8 @@ static ssize_t show_##name(struct device *d, struct 
device_attribute *attr, \
 
 static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
 
if (adap-flags  FULL_INIT_DONE)
@@ -515,7 +520,8 @@ static ssize_t store_nfilters(struct device *d, struct 
device_attribute *attr,
 
 static ssize_t set_nservers(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
 
if (adap-flags  FULL_INIT_DONE)
return -EBUSY;
@@ -556,9 +562,10 @@ static struct attribute_group cxgb3_attr_group = {.attrs = 
cxgb3_attrs };
 static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
char *buf, int sched)
 {
-   ssize_t len;
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
unsigned int v, addr, bpt, cpt;
-   struct adapter *adap = to_net_dev(d)-priv;
+   ssize_t len;
 
addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
rtnl_lock();
@@ -581,10 +588,11 @@ static ssize_t tm_attr_show(struct device *d, struct 
device_attribute *attr,
 static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
 const char *buf, size_t len, int

[PATCH 2.6.23 2/2] - cxgb3 engine microcode load

2007-08-29 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Load the engine microcode when an interface 
is brought up, instead of of doing it when the module
is loaded. 
Loosen up tight binding between the driver and the 
engine microcode version. 
There is no need for microcode update with T3A boards.
Fix the file naming.
Do a better job at logging the loading activity.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |3 +
 drivers/net/cxgb3/cxgb3_main.c |  126 ++--
 drivers/net/cxgb3/t3_hw.c  |   46 +--
 3 files changed, 123 insertions(+), 52 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 1637800..2129210 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -679,7 +679,8 @@ const struct adapter_info *t3_get_adapter_info(unsigned int 
board_id);
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data);
 int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data);
 int t3_seeprom_wp(struct adapter *adapter, int enable);
-int t3_check_tpsram_version(struct adapter *adapter);
+int t3_get_tp_version(struct adapter *adapter, u32 *vers);
+int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
 int t3_check_tpsram(struct adapter *adapter, u8 *tp_ram, unsigned int size);
 int t3_set_proto_sram(struct adapter *adap, u8 *data);
 int t3_read_flash(struct adapter *adapter, unsigned int addr,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index f3bf128..5ab319c 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -729,6 +729,7 @@ static void bind_qsets(struct adapter *adap)
 }
 
 #define FW_FNAME t3fw-%d.%d.%d.bin
+#define TPSRAM_NAME t3%c_protocol_sram-%d.%d.%d.bin
 
 static int upgrade_fw(struct adapter *adap)
 {
@@ -747,6 +748,71 @@ static int upgrade_fw(struct adapter *adap)
}
ret = t3_load_fw(adap, fw-data, fw-size);
release_firmware(fw);
+
+   if (ret == 0)
+   dev_info(dev, successful upgrade to firmware %d.%d.%d\n,
+FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_MICRO);
+   else
+   dev_err(dev, failed to upgrade to firmware %d.%d.%d\n,
+   FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_MICRO);
+   
+   return ret;
+}
+
+static inline char t3rev2char(struct adapter *adapter)
+{
+   char rev = 0;
+
+   switch(adapter-params.rev) {
+   case T3_REV_B:
+   case T3_REV_B2:
+   rev = 'b';
+   break;
+   }
+   return rev;
+}
+
+int update_tpsram(struct adapter *adap)
+{
+   const struct firmware *tpsram;
+   char buf[64];
+   struct device *dev = adap-pdev-dev;
+   int ret;
+   char rev;
+   
+   rev = t3rev2char(adap);
+   if (!rev)
+   return 0;
+
+   snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
+TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
+
+   ret = request_firmware(tpsram, buf, dev);
+   if (ret  0) {
+   dev_err(dev, could not load TP SRAM: unable to load %s\n,
+   buf);
+   return ret;
+   }
+   
+   ret = t3_check_tpsram(adap, tpsram-data, tpsram-size);
+   if (ret)
+   goto release_tpsram;
+
+   ret = t3_set_proto_sram(adap, tpsram-data);
+   if (ret == 0)
+   dev_info(dev,
+successful update of protocol engine 
+to %d.%d.%d\n,
+TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
+   else
+   dev_err(dev, failed to update of protocol engine %d.%d.%d\n,
+   TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
+   if (ret)
+   dev_err(dev, loading protocol SRAM failed\n);
+
+release_tpsram:
+   release_firmware(tpsram);
+   
return ret;
 }
 
@@ -763,6 +829,7 @@ static int upgrade_fw(struct adapter *adap)
 static int cxgb_up(struct adapter *adap)
 {
int err = 0;
+   int must_load;
 
if (!(adap-flags  FULL_INIT_DONE)) {
err = t3_check_fw_version(adap);
@@ -771,6 +838,13 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto out;
 
+   err = t3_check_tpsram_version(adap, must_load);
+   if (err == -EINVAL) {
+   err = update_tpsram(adap);
+   if (err  must_load)
+   goto out;
+   }
+
err = init_dummy_netdevs(adap);
if (err)
goto out;
@@ -1110,8 +1184,10 @@ static void get_drvinfo(struct net_device *dev, struct 
ethtool_drvinfo *info)
struct port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi-adapter;
u32 fw_vers = 0;
+   u32 tp_vers = 0

Re: [PATCH 2.6.23 RESEND] cxgb3 - Fix dev-priv usage

2007-08-28 Thread Divy Le Ray

Roland Dreier wrote:

  I take that back.  Rejected -- it breaks infiniband build.

To be more precise:

drivers/infiniband/hw/cxgb3/cxio_hal.c: In function 'cxio_rdev_open':
drivers/infiniband/hw/cxgb3/cxio_hal.c:919: error: implicit declaration of 
function 'T3CDEV'

it seems the problem is that T3CDEV() has been deleted and been
replaced with the dev2t3cdev() inline function.  However a simple
replacement s/T3CDEV/dev2t3cdev/ in drivers/infiniband/hw/cxgb3
doesn't work because the function has moved from t3cdev.h to
adapter.h; and moving the function back to t3cdev.h doesn't work
because it depends on more structure definitions now.

And at that point I gave up...
  


Sorry about the compilation issue and the delay to reply.
I'll post a follow up for the iw_cxgb3 driver later this evening.
I plan to move the inlined dev2t3cdev() from adapter.h to an exported 
dev2t3cdev()

in cxgb3_offload.c.

Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.23 0/2] cxgb3 - Fix dev-priv usage

2007-08-28 Thread Divy Le Ray

Jeff/Roland,

I'm resubmitting the cxgb3 dev-priv fix for inclusion in 2.6.23.
I also submit a follow-up patch for the iw_cxgb3 driver that fixes
the previous infiniband breakage.

Cheers,
Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.23 1/2] cxgb3 - Fix dev-priv usage

2007-08-28 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

cxgb3 used netdev_priv() and dev-priv for different purposes.
In 2.6.23, netdev_priv() == dev-priv, cxgb3 needs a fix.
This patch is a partial backport of Dave Miller's changes in the 
net-2.6.24 git branch. 

Without this fix, cxgb3 crashes on 2.6.23.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h   |2 +
 drivers/net/cxgb3/cxgb3_main.c|  126 +
 drivers/net/cxgb3/cxgb3_offload.c |   16 -
 drivers/net/cxgb3/cxgb3_offload.h |2 +
 drivers/net/cxgb3/sge.c   |   23 ---
 drivers/net/cxgb3/t3cdev.h|3 -
 6 files changed, 104 insertions(+), 68 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ab72563..20e887d 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,7 +50,9 @@ typedef irqreturn_t(*intr_handler_t) (int, void *);
 
 struct vlan_group;
 
+struct adapter;
 struct port_info {
+   struct adapter *adapter;
struct vlan_group *vlan_grp;
const struct port_type_info *port_type;
u8 port_id;
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..f3bf128 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -358,11 +358,14 @@ static int init_dummy_netdevs(struct adapter *adap)
 
for (j = 0; j  pi-nqsets - 1; j++) {
if (!adap-dummy_netdev[dummy_idx]) {
-   nd = alloc_netdev(0, , ether_setup);
+   struct port_info *p;
+
+   nd = alloc_netdev(sizeof(*p), , ether_setup);
if (!nd)
goto free_all;
 
-   nd-priv = adap;
+   p = netdev_priv(nd);
+   p-adapter = adap;
nd-weight = 64;
set_bit(__LINK_STATE_START, nd-state);
adap-dummy_netdev[dummy_idx] = nd;
@@ -482,7 +485,8 @@ static ssize_t attr_store(struct device *d, struct 
device_attribute *attr,
 #define CXGB3_SHOW(name, val_expr) \
 static ssize_t format_##name(struct net_device *dev, char *buf) \
 { \
-   struct adapter *adap = dev-priv; \
+   struct port_info *pi = netdev_priv(dev); \
+   struct adapter *adap = pi-adapter; \
return sprintf(buf, %u\n, val_expr); \
 } \
 static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
@@ -493,7 +497,8 @@ static ssize_t show_##name(struct device *d, struct 
device_attribute *attr, \
 
 static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
 
if (adap-flags  FULL_INIT_DONE)
@@ -515,7 +520,8 @@ static ssize_t store_nfilters(struct device *d, struct 
device_attribute *attr,
 
 static ssize_t set_nservers(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
 
if (adap-flags  FULL_INIT_DONE)
return -EBUSY;
@@ -556,9 +562,10 @@ static struct attribute_group cxgb3_attr_group = {.attrs = 
cxgb3_attrs };
 static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
char *buf, int sched)
 {
-   ssize_t len;
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
unsigned int v, addr, bpt, cpt;
-   struct adapter *adap = to_net_dev(d)-priv;
+   ssize_t len;
 
addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
rtnl_lock();
@@ -581,10 +588,11 @@ static ssize_t tm_attr_show(struct device *d, struct 
device_attribute *attr,
 static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
 const char *buf, size_t len, int sched)
 {
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
+   unsigned int val;
char *endp;
ssize_t ret;
-   unsigned int val;
-   struct adapter *adap = to_net_dev(d)-priv;
 
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -858,8 +866,9 @@ static void schedule_chk_task(struct adapter *adap)
 
 static int offload_open(struct net_device *dev)
 {
-   struct adapter *adapter = dev-priv;
-   struct t3cdev *tdev = T3CDEV(dev);
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adapter = pi-adapter;
+   struct t3cdev *tdev = dev2t3cdev(dev);
int adap_up = adapter-open_device_map  PORT_MASK;
int err = 0;
 
@@ -924,10 +933,10 @@ static int

[PATCH 2/2] iw_cxgb3 - dev-priv fix follow up

2007-08-28 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

The RDMA driver sitting on top of cxgb3 
now uses the exported function dev2t3cdev() 
to retrieve the the t3cdev associated with 
a net_device.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/cxio_hal.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c 
b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 1518b41..beb2a38 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -916,7 +916,7 @@ int cxio_rdev_open(struct cxio_rdev *rdev_p)
PDBG(%s opening rnic dev %s\n, __FUNCTION__, rdev_p-dev_name);
memset(rdev_p-ctrl_qp, 0, sizeof(rdev_p-ctrl_qp));
if (!rdev_p-t3cdev_p)
-   rdev_p-t3cdev_p = T3CDEV(netdev_p);
+   rdev_p-t3cdev_p = dev2t3cdev(netdev_p);
rdev_p-t3cdev_p-ulp = (void *) rdev_p;
err = rdev_p-t3cdev_p-ctl(rdev_p-t3cdev_p, RDMA_GET_PARAMS,
 (rdev_p-rnic_info));
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] cxgb3 driver update

2007-08-23 Thread Divy Le Ray

Hi Jeff,

I'm submitting three more patches for inclusion in netdev#upstream.
These patches are built over the series I resent yesterday night.
The patch numbering reflects the stacking.

Here is a brief description:
-   avoid false positives in the xgmac hang workaround
-   Properly set the CQ_ERR bit in RDMA CQ contexts.
-   Update CQ context operations time out values

Cheers,
Divy


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/11] cxgb3 - remove false positive in xgmac workaround

2007-08-23 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Qualify toggling of xgmac tx enable with not getting pause frames, 
we might not make forward progress because the peer is sending 
lots of pause frames.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |1 +
 drivers/net/cxgb3/xgmac.c  |4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index ff867c2..3e5b0db 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -514,6 +514,7 @@ struct cmac {
u64 rx_mcnt;
unsigned int toggle_cnt;
unsigned int txen;
+   u64 rx_pause;
struct mac_stats stats;
 };
 
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index 1d1c391..ff9e9dc 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -452,6 +452,7 @@ int t3_mac_enable(struct cmac *mac, int which)
A_XGM_TX_SPI4_SOP_EOP_CNT +
oft)));
mac-rx_mcnt = s-rx_frames;
+   mac-rx_pause = s-rx_pause;
mac-rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
A_XGM_RX_SPI4_SOP_EOP_CNT +
oft)));
@@ -504,7 +505,7 @@ int t3b2_mac_watchdog_task(struct cmac *mac)
tx_xcnt = 1;/* By default tx_xcnt is making progress */
tx_tcnt = mac-tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt */
rx_xcnt = 1;/* By default rx_xcnt is making progress */
-   if (tx_mcnt == mac-tx_mcnt) {
+   if (tx_mcnt == mac-tx_mcnt  mac-rx_pause == s-rx_pause) {
tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
A_XGM_TX_SPI4_SOP_EOP_CNT +
mac-offset)));
@@ -560,6 +561,7 @@ out:
mac-tx_mcnt = s-tx_frames;
mac-rx_xcnt = rx_xcnt;
mac-rx_mcnt = s-rx_frames;
+   mac-rx_pause = s-rx_pause;
if (status == 1) {
t3_write_reg(adap, A_XGM_TX_CTRL + mac-offset, 0);
t3_read_reg(adap, A_XGM_TX_CTRL + mac-offset);  /* flush */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/11] cxgb3 - Set the CQ_ERR bit in CQ contexts.

2007-08-23 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

The cxgb3 driver is incorrectly configuring the HW CQ context for CQ's
that use overflow-avoidance.  Namely the RDMA control CQ.  This results
in a bad DMA from the device to bus address 0.  The solution is to set
the CQ_ERR bit in the context for these types of CQs.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/sge_defs.h |4 
 drivers/net/cxgb3/t3_hw.c|3 ++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/sge_defs.h b/drivers/net/cxgb3/sge_defs.h
index 514869e..29b6c80 100644
--- a/drivers/net/cxgb3/sge_defs.h
+++ b/drivers/net/cxgb3/sge_defs.h
@@ -106,6 +106,10 @@
 #define V_CQ_GEN(x) ((x)  S_CQ_GEN)
 #define F_CQ_GENV_CQ_GEN(1U)
 
+#define S_CQ_ERR30
+#define V_CQ_ERR(x) ((x)  S_CQ_ERR)
+#define F_CQ_ERRV_CQ_ERR(1U)
+
 #define S_CQ_OVERFLOW_MODE31
 #define V_CQ_OVERFLOW_MODE(x) ((x)  S_CQ_OVERFLOW_MODE)
 #define F_CQ_OVERFLOW_MODEV_CQ_OVERFLOW_MODE(1U)
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 538b254..9358959 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -2043,7 +2043,8 @@ int t3_sge_init_cqcntxt(struct adapter *adapter, unsigned 
int id, u64 base_addr,
base_addr = 32;
t3_write_reg(adapter, A_SG_CONTEXT_DATA2,
 V_CQ_BASE_HI((u32) base_addr) | V_CQ_RSPQ(rspq) |
-V_CQ_GEN(1) | V_CQ_OVERFLOW_MODE(ovfl_mode));
+V_CQ_GEN(1) | V_CQ_OVERFLOW_MODE(ovfl_mode) |
+V_CQ_ERR(ovfl_mode));
t3_write_reg(adapter, A_SG_CONTEXT_DATA3, V_CQ_CREDITS(credits) |
 V_CQ_CREDIT_THRES(credit_thres));
return t3_sge_write_context(adapter, id, F_CQ);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/11] cxgb3 - CQ context operations time out too soon.

2007-08-23 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Currently, the driver only tries up to 5 times (5us) to get the results
of a CQ context operation.  Testing has shown the chip can take as much
as 50us to return the response on SG_CONTEXT_CMD operations.  So we up
the retry count to 100 to cover high loads.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/t3_hw.c |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 9358959..8f6efdb 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1867,6 +1867,8 @@ void t3_port_intr_clear(struct adapter *adapter, int idx)
phy-ops-intr_clear(phy);
 }
 
+#define SG_CONTEXT_CMD_ATTEMPTS 100
+
 /**
  * t3_sge_write_context - write an SGE context
  * @adapter: the adapter
@@ -1886,7 +1888,7 @@ static int t3_sge_write_context(struct adapter *adapter, 
unsigned int id,
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2072,7 +2074,7 @@ int t3_sge_enable_ecntxt(struct adapter *adapter, 
unsigned int id, int enable)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_EGRESS | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2096,7 +2098,7 @@ int t3_sge_disable_fl(struct adapter *adapter, unsigned 
int id)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_FREELIST | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2120,7 +2122,7 @@ int t3_sge_disable_rspcntxt(struct adapter *adapter, 
unsigned int id)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_RESPONSEQ | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2144,7 +2146,7 @@ int t3_sge_disable_cqcntxt(struct adapter *adapter, 
unsigned int id)
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(1) | F_CQ | V_CONTEXT(id));
return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-  0, 5, 1);
+  0, SG_CONTEXT_CMD_ATTEMPTS, 1);
 }
 
 /**
@@ -2169,7 +2171,7 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned 
int id, unsigned int op,
t3_write_reg(adapter, A_SG_CONTEXT_CMD, V_CONTEXT_CMD_OPCODE(op) |
 V_CONTEXT(id) | F_CQ);
if (t3_wait_op_done_val(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
-   0, 5, 1, val))
+   0, SG_CONTEXT_CMD_ATTEMPTS, 1, val))
return -EIO;
 
if (op = 2  op  7) {
@@ -2179,7 +2181,8 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned 
int id, unsigned int op,
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(0) | F_CQ | V_CONTEXT(id));
if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD,
-   F_CONTEXT_CMD_BUSY, 0, 5, 1))
+   F_CONTEXT_CMD_BUSY, 0,
+   SG_CONTEXT_CMD_ATTEMPTS, 1))
return -EIO;
return G_CQ_INDEX(t3_read_reg(adapter, A_SG_CONTEXT_DATA0));
}
@@ -2205,7 +2208,7 @@ static int t3_sge_read_context(unsigned int type, struct 
adapter *adapter,
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
 V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id));
if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0,
-   5, 1))
+   SG_CONTEXT_CMD_ATTEMPTS, 1))
return -EIO;
data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0);
data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] cxgb3 driver update

2007-08-23 Thread Divy Le Ray

Hi Al,


Speaking of cxgb3, could you explain what the hell is
static int do_term(struct t3cdev *dev, struct sk_buff *skb)
{
unsigned int hwtid = ntohl(skb-priority)  8  0xf;
doing?  AFAIK, skb-priority is not net-endian...



the RDMA connection id is saved in the skb's priority field for TERM 
messages

because it is not in the CPL message that comes up from the hardware.
Yet the RDMA driver needs it, so sge.c::process_responses() overloads
the skb's priority and csum with these values.




Another odd place is
int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
{  
u16 val;

int attempts = EEPROM_MAX_POLL;
unsigned int base = adapter-params.pci.vpd_cap_addr;

if ((addr = EEPROMSIZE  addr != EEPROM_STAT_ADDR) || (addr 
 3))  
return -EINVAL;


pci_write_config_dword(adapter-pdev, base + PCI_VPD_DATA,
   cpu_to_le32(data));
with callers like
int t3_seeprom_wp(struct adapter *adapter, int enable)
{
return t3_seeprom_write(adapter, EEPROM_STAT_ADDR, enable ? 
0xc : 0);


IOW, you really get little-endian values passed to 
pci_write_config_dword()

and it expects a host-endian as the last argument...



It looks like a bug. Thanks for spotting this.

Cheers,
Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.23 RESEND] cxgb3 - Fix dev-priv usage

2007-08-23 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

cxgb3 used netdev_priv() and dev-priv for different purposes.
In 2.6.23, netdev_priv() == dev-priv, cxgb3 needs a fix.
This patch is a partial backport of Dave Miller's changes in the 
net-2.6.24 git branch. 

Without this fix, cxgb3 crashes on 2.6.23.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h   |   10 +++
 drivers/net/cxgb3/cxgb3_main.c|  126 +
 drivers/net/cxgb3/cxgb3_offload.c |6 +-
 drivers/net/cxgb3/sge.c   |   23 ---
 drivers/net/cxgb3/t3cdev.h|3 -
 5 files changed, 100 insertions(+), 68 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ab72563..c1dc344 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,7 +50,9 @@ typedef irqreturn_t(*intr_handler_t) (int, void *);
 
 struct vlan_group;
 
+struct adapter;
 struct port_info {
+   struct adapter *adapter;
struct vlan_group *vlan_grp;
const struct port_type_info *port_type;
u8 port_id;
@@ -246,6 +248,14 @@ static inline void t3_write_reg(struct adapter *adapter, 
u32 reg_addr, u32 val)
writel(val, adapter-regs + reg_addr);
 }
 
+/* Get the t3cdev associated with a net_device */
+static inline struct t3cdev *dev2t3cdev(struct net_device *dev)
+{
+   const struct port_info *pi = netdev_priv(dev);
+
+   return (struct t3cdev *)pi-adapter;
+}
+
 static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
 {
return netdev_priv(adap-port[idx]);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..f3bf128 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -358,11 +358,14 @@ static int init_dummy_netdevs(struct adapter *adap)
 
for (j = 0; j  pi-nqsets - 1; j++) {
if (!adap-dummy_netdev[dummy_idx]) {
-   nd = alloc_netdev(0, , ether_setup);
+   struct port_info *p;
+
+   nd = alloc_netdev(sizeof(*p), , ether_setup);
if (!nd)
goto free_all;
 
-   nd-priv = adap;
+   p = netdev_priv(nd);
+   p-adapter = adap;
nd-weight = 64;
set_bit(__LINK_STATE_START, nd-state);
adap-dummy_netdev[dummy_idx] = nd;
@@ -482,7 +485,8 @@ static ssize_t attr_store(struct device *d, struct 
device_attribute *attr,
 #define CXGB3_SHOW(name, val_expr) \
 static ssize_t format_##name(struct net_device *dev, char *buf) \
 { \
-   struct adapter *adap = dev-priv; \
+   struct port_info *pi = netdev_priv(dev); \
+   struct adapter *adap = pi-adapter; \
return sprintf(buf, %u\n, val_expr); \
 } \
 static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
@@ -493,7 +497,8 @@ static ssize_t show_##name(struct device *d, struct 
device_attribute *attr, \
 
 static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
 
if (adap-flags  FULL_INIT_DONE)
@@ -515,7 +520,8 @@ static ssize_t store_nfilters(struct device *d, struct 
device_attribute *attr,
 
 static ssize_t set_nservers(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
 
if (adap-flags  FULL_INIT_DONE)
return -EBUSY;
@@ -556,9 +562,10 @@ static struct attribute_group cxgb3_attr_group = {.attrs = 
cxgb3_attrs };
 static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
char *buf, int sched)
 {
-   ssize_t len;
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
unsigned int v, addr, bpt, cpt;
-   struct adapter *adap = to_net_dev(d)-priv;
+   ssize_t len;
 
addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
rtnl_lock();
@@ -581,10 +588,11 @@ static ssize_t tm_attr_show(struct device *d, struct 
device_attribute *attr,
 static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
 const char *buf, size_t len, int sched)
 {
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
+   unsigned int val;
char *endp;
ssize_t ret;
-   unsigned int val;
-   struct adapter *adap = to_net_dev(d)-priv;
 
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -858,8

[PATCH 0/11] cxgb3 - driver updates

2007-08-21 Thread Divy Le Ray

Jeff,

I'm resubmitting the last cxgb3 patch series against netdev-2.6#upstream,
minus the first patch that you already applied and the last patch.

Here is a brief description:
-   Modify max HW Rx coalescing size
-   Log SGE doorbell Fifo overflow
-   Use Tx immediate data for offload packets whenever possible
-   RDMA can get internal mem info to workaround HW issues
-   More validity checks on connection ids
-   Stop MAC when a fatal error is detected
-   Log HW serial number
-   Update internal mem operating mode
-   Update engine microcode management, version is now 1.1.0
-   Update FW management, version is now 4.6.0
-   Ignore some HW errors until the HW is initialized

Cheers,
Divy



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/11 RESEND] cxgb3 - Update rx coalescing length

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Reduce Rx coalescing length to 12288
Large bursts from the adapter to the host create back pressure
on the chip. Reducing the burst size avoids the issue.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index c46c249..55922ed 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -104,7 +104,7 @@ enum {
PROTO_SRAM_LINES = 128, /* size of TP sram */
 };
 
-#define MAX_RX_COALESCING_LEN 16224U
+#define MAX_RX_COALESCING_LEN 12288U
 
 enum {
PAUSE_RX = 1  0,
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/11 RESEND] cxgb3 - SGE doorbell overflow warning

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Log doorbell Fifo overflow

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h |8 
 drivers/net/cxgb3/sge.c  |4 
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index aa80313..2824278 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -172,6 +172,14 @@
 
 #define A_SG_INT_CAUSE 0x5c
 
+#define S_HIPIODRBDROPERR11
+#define V_HIPIODRBDROPERR(x) ((x)  S_HIPIODRBDROPERR)
+#define F_HIPIODRBDROPERRV_HIPIODRBDROPERR(1U)
+
+#define S_LOPIODRBDROPERR10
+#define V_LOPIODRBDROPERR(x) ((x)  S_LOPIODRBDROPERR)
+#define F_LOPIODRBDROPERRV_LOPIODRBDROPERR(1U)
+
 #define S_RSPQDISABLED3
 #define V_RSPQDISABLED(x) ((x)  S_RSPQDISABLED)
 #define F_RSPQDISABLEDV_RSPQDISABLED(1U)
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a2cfd68..9213cda 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2476,6 +2476,10 @@ void t3_sge_err_intr_handler(struct adapter *adapter)
 (0x%x)\n, (v  S_RSPQ0DISABLED)  0xff);
}
 
+   if (status  (F_HIPIODRBDROPERR | F_LOPIODRBDROPERR))
+   CH_ALERT(adapter, SGE dropped %s priority doorbell\n,
+status  F_HIPIODRBDROPERR ? high : lo);
+
t3_write_reg(adapter, A_SG_INT_CAUSE, status);
if (status  (F_RSPQCREDITOVERFOW | F_RSPQDISABLED))
t3_fatal_err(adapter);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/11 RESEND] cxgb3 - use immediate data for offload Tx

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Send small TX_DATA work requests as immediate data even when
there are fragments. this avoids doing multiple DMAs for 
small fragmented packets. 
The driver already implements this optimization for small
contiguous packets.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/sge.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 9213cda..dca2716 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1182,8 +1182,8 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device 
*dev)
  *
  * Writes a packet as immediate data into a Tx descriptor.  The packet
  * contains a work request at its beginning.  We must write the packet
- * carefully so the SGE doesn't read accidentally before it's written in
- * its entirety.
+ * carefully so the SGE doesn't read it accidentally before it's written
+ * in its entirety.
  */
 static inline void write_imm(struct tx_desc *d, struct sk_buff *skb,
 unsigned int len, unsigned int gen)
@@ -1191,7 +1191,11 @@ static inline void write_imm(struct tx_desc *d, struct 
sk_buff *skb,
struct work_request_hdr *from = (struct work_request_hdr *)skb-data;
struct work_request_hdr *to = (struct work_request_hdr *)d;
 
-   memcpy(to[1], from[1], len - sizeof(*from));
+   if (likely(!skb-data_len))
+   memcpy(to[1], from[1], len - sizeof(*from));
+   else
+   skb_copy_bits(skb, sizeof(*from), to[1], len - sizeof(*from));
+
to-wr_hi = from-wr_hi | htonl(F_WR_SOP | F_WR_EOP |
V_WR_BCNTLFLT(len  7));
wmb();
@@ -1261,7 +1265,7 @@ static inline void reclaim_completed_tx_imm(struct 
sge_txq *q)
 
 static inline int immediate(const struct sk_buff *skb)
 {
-   return skb-len = WR_LEN  !skb-data_len;
+   return skb-len = WR_LEN;
 }
 
 /**
@@ -1467,12 +1471,13 @@ static void write_ofld_wr(struct adapter *adap, struct 
sk_buff *skb,
  */
 static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
 {
-   unsigned int flits, cnt = skb_shinfo(skb)-nr_frags;
+   unsigned int flits, cnt;
 
-   if (skb-len = WR_LEN  cnt == 0)
+   if (skb-len = WR_LEN)
return 1;   /* packet fits as immediate data */
 
flits = skb_transport_offset(skb) / 8;  /* headers */
+   cnt = skb_shinfo(skb)-nr_frags;
if (skb-tail != skb-transport_header)
cnt++;
return flits_to_desc(flits + sgl_len(cnt));
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/11 RESEND] cxgb3 - Expose HW memory page info

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

A HW issue requires limiting the receive window size
to 23 pages of internal memory.
These pages can be configured to different sizes,
thus the RDMA driver needs to know the
page size to enforce the upper limit.

Also assign explicit enum values.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_ctl_defs.h |   52 +---
 drivers/net/cxgb3/cxgb3_offload.c  |7 +
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 2095dda..6c4f320 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -33,27 +33,29 @@
 #define _CXGB3_OFFLOAD_CTL_DEFS_H
 
 enum {
-   GET_MAX_OUTSTANDING_WR,
-   GET_TX_MAX_CHUNK,
-   GET_TID_RANGE,
-   GET_STID_RANGE,
-   GET_RTBL_RANGE,
-   GET_L2T_CAPACITY,
-   GET_MTUS,
-   GET_WR_LEN,
-   GET_IFF_FROM_MAC,
-   GET_DDP_PARAMS,
-   GET_PORTS,
-
-   ULP_ISCSI_GET_PARAMS,
-   ULP_ISCSI_SET_PARAMS,
-
-   RDMA_GET_PARAMS,
-   RDMA_CQ_OP,
-   RDMA_CQ_SETUP,
-   RDMA_CQ_DISABLE,
-   RDMA_CTRL_QP_SETUP,
-   RDMA_GET_MEM,
+   GET_MAX_OUTSTANDING_WR  = 0,
+   GET_TX_MAX_CHUNK= 1,
+   GET_TID_RANGE   = 2,
+   GET_STID_RANGE  = 3,
+   GET_RTBL_RANGE  = 4,
+   GET_L2T_CAPACITY= 5,
+   GET_MTUS= 6,
+   GET_WR_LEN  = 7,
+   GET_IFF_FROM_MAC= 8,
+   GET_DDP_PARAMS  = 9,
+   GET_PORTS   = 10,
+
+   ULP_ISCSI_GET_PARAMS= 11,
+   ULP_ISCSI_SET_PARAMS= 12,
+
+   RDMA_GET_PARAMS = 13,
+   RDMA_CQ_OP  = 14,
+   RDMA_CQ_SETUP   = 15,
+   RDMA_CQ_DISABLE = 16,
+   RDMA_CTRL_QP_SETUP  = 17,
+   RDMA_GET_MEM= 18,
+
+   GET_RX_PAGE_INFO= 50,
 };
 
 /*
@@ -161,4 +163,12 @@ struct rdma_ctrlqp_setup {
unsigned long long base_addr;
unsigned int size;
 };
+
+/*
+ * Offload TX/RX page information.
+ */
+struct ofld_page_info {
+   unsigned int page_size;  /* Page size, should be a power of 2 */
+   unsigned int num;/* Number of pages */
+};
 #endif /* _CXGB3_OFFLOAD_CTL_DEFS_H */
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index e620ed4..522c1be 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -317,6 +317,8 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned 
int req, void *data)
struct iff_mac *iffmacp;
struct ddp_params *ddpp;
struct adap_ports *ports;
+   struct ofld_page_info *rx_page_info;
+   struct tp_params *tp = adapter-params.tp;
int i;
 
switch (req) {
@@ -382,6 +384,11 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned 
int req, void *data)
if (!offload_running(adapter))
return -EAGAIN;
return cxgb_rdma_ctl(adapter, req, data);
+   case GET_RX_PAGE_INFO:
+   rx_page_info = data;
+   rx_page_info-page_size = tp-rx_pg_size;
+   rx_page_info-num = tp-rx_num_pgs;
+   break;
default:
return -EOPNOTSUPP;
}
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/11 RESEND] cxgb3 - tighten checks on TID values

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Enforce validity checks on connection ids

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_defs.h|   20 ++--
 drivers/net/cxgb3/cxgb3_offload.c |   28 +++-
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index 483a594..45e9216 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -79,9 +79,17 @@ static inline struct t3c_tid_entry *lookup_tid(const struct 
tid_info *t,
 static inline struct t3c_tid_entry *lookup_stid(const struct tid_info *t,
unsigned int tid)
 {
+   union listen_entry *e;
+
if (tid  t-stid_base || tid = t-stid_base + t-nstids)
return NULL;
-   return (stid2entry(t, tid)-t3c_tid);
+
+   e = stid2entry(t, tid);
+   if ((void *)e-next = (void *)t-tid_tab 
+   (void *)e-next  (void *)t-atid_tab[t-natids])
+   return NULL;
+
+   return e-t3c_tid;
 }
 
 /*
@@ -90,9 +98,17 @@ static inline struct t3c_tid_entry *lookup_stid(const struct 
tid_info *t,
 static inline struct t3c_tid_entry *lookup_atid(const struct tid_info *t,
unsigned int tid)
 {
+   union active_open_entry *e;
+
if (tid  t-atid_base || tid = t-atid_base + t-natids)
return NULL;
-   return (atid2entry(t, tid)-t3c_tid);
+
+   e = atid2entry(t, tid);
+   if ((void *)e-next = (void *)t-tid_tab 
+   (void *)e-next  (void *)t-atid_tab[t-natids])
+   return NULL;
+
+   return e-t3c_tid;
 }
 
 int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n);
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index 522c1be..7fb526a 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -57,7 +57,7 @@ static DEFINE_RWLOCK(adapter_list_lock);
 static LIST_HEAD(adapter_list);
 
 static const unsigned int MAX_ATIDS = 64 * 1024;
-static const unsigned int ATID_BASE = 0x10;
+static const unsigned int ATID_BASE = 0x1;
 
 static inline int offload_activated(struct t3cdev *tdev)
 {
@@ -684,10 +684,19 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb)
 {
struct cpl_pass_accept_req *req = cplhdr(skb);
unsigned int stid = G_PASS_OPEN_TID(ntohl(req-tos_tid));
+   struct tid_info *t = (T3C_DATA(dev))-tid_maps;
struct t3c_tid_entry *t3c_tid;
+   unsigned int tid = GET_TID(req);
 
-   t3c_tid = lookup_stid((T3C_DATA(dev))-tid_maps, stid);
-   if (t3c_tid-ctx  t3c_tid-client-handlers 
+   if (unlikely(tid = t-ntids)) {
+   printk(%s: passive open TID %u too large\n,
+  dev-name, tid);
+   t3_fatal_err(tdev2adap(dev));
+   return CPL_RET_BUF_DONE;
+   }
+   
+   t3c_tid = lookup_stid(t, stid);
+   if (t3c_tid  t3c_tid-ctx  t3c_tid-client-handlers 
t3c_tid-client-handlers[CPL_PASS_ACCEPT_REQ]) {
return t3c_tid-client-handlers[CPL_PASS_ACCEPT_REQ]
(dev, skb, t3c_tid-ctx);
@@ -769,16 +778,25 @@ static int do_act_establish(struct t3cdev *dev, struct 
sk_buff *skb)
 {
struct cpl_act_establish *req = cplhdr(skb);
unsigned int atid = G_PASS_OPEN_TID(ntohl(req-tos_tid));
+   struct tid_info *t = (T3C_DATA(dev))-tid_maps;
struct t3c_tid_entry *t3c_tid;
+   unsigned int tid = GET_TID(req);
 
-   t3c_tid = lookup_atid((T3C_DATA(dev))-tid_maps, atid);
+   if (unlikely(tid = t-ntids)) {
+   printk(%s: active establish TID %u too large\n,
+  dev-name, tid);
+   t3_fatal_err(tdev2adap(dev));
+   return CPL_RET_BUF_DONE;
+   }
+
+   t3c_tid = lookup_atid(t, atid);
if (t3c_tid  t3c_tid-ctx  t3c_tid-client-handlers 
t3c_tid-client-handlers[CPL_ACT_ESTABLISH]) {
return t3c_tid-client-handlers[CPL_ACT_ESTABLISH]
(dev, skb, t3c_tid-ctx);
} else {
printk(KERN_ERR %s: received clientless CPL command 0x%x\n,
-  dev-name, CPL_PASS_ACCEPT_REQ);
+  dev-name, CPL_ACT_ESTABLISH);
return CPL_RET_BUF_DONE | CPL_RET_BAD_MSG;
}
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/11 RESEND] cxgb3 - Fatal error update

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Stop the MAC when a fatal error is detected.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..a1f94cf 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2270,6 +2270,10 @@ void t3_fatal_err(struct adapter *adapter)
 
if (adapter-flags  FULL_INIT_DONE) {
t3_sge_stop(adapter);
+   t3_write_reg(adapter, A_XGM_TX_CTRL, 0);
+   t3_write_reg(adapter, A_XGM_RX_CTRL, 0);
+   t3_write_reg(adapter, XGM_REG(A_XGM_TX_CTRL, 1), 0);
+   t3_write_reg(adapter, XGM_REG(A_XGM_RX_CTRL, 1), 0);
t3_intr_disable(adapter);
}
CH_ALERT(adapter, encountered fatal error, operation suspended\n);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/11 RESEND] cxgb3 - log adapter serial number

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Log HW serial number when cxgb3 module is loaded.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |2 ++
 drivers/net/cxgb3/cxgb3_main.c |6 --
 drivers/net/cxgb3/t3_hw.c  |3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 55922ed..d54446f 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -97,6 +97,7 @@ enum {
MAX_NPORTS = 2, /* max # of ports */
MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */
EEPROMSIZE = 8192,  /* Serial EEPROM size */
+   SERNUM_LEN = 16,/* Serial # length */
RSS_TABLE_SIZE = 64,/* size of RSS lookup and mapping tables */
TCB_SIZE = 128, /* TCB size */
NMTUS = 16, /* size of MTU table */
@@ -391,6 +392,7 @@ struct vpd_params {
unsigned int uclk;
unsigned int mdc;
unsigned int mem_timing;
+   u8 sn[SERNUM_LEN + 1];
u8 eth_base[6];
u8 port_type[MAX_NPORTS];
unsigned short xauicfg[2];
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index a1f94cf..e5744e7 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2333,10 +2333,12 @@ static void __devinit print_port_info(struct adapter 
*adap,
   (adap-flags  USING_MSIX) ?  MSI-X :
   (adap-flags  USING_MSI) ?  MSI : );
if (adap-name == dev-name  adap-params.vpd.mclk)
-   printk(KERN_INFO %s: %uMB CM, %uMB PMTX, %uMB PMRX\n,
+   printk(KERN_INFO
+  %s: %uMB CM, %uMB PMTX, %uMB PMRX, S/N: %s\n,
   adap-name, t3_mc7_size(adap-cm)  20,
   t3_mc7_size(adap-pmtx)  20,
-  t3_mc7_size(adap-pmrx)  20);
+  t3_mc7_size(adap-pmrx)  20,
+  adap-params.vpd.sn);
}
 }
 
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index dd3149d..23b1a16 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -505,7 +505,7 @@ struct t3_vpd {
u8 vpdr_len[2];
VPD_ENTRY(pn, 16);  /* part number */
VPD_ENTRY(ec, 16);  /* EC level */
-   VPD_ENTRY(sn, 16);  /* serial number */
+   VPD_ENTRY(sn, SERNUM_LEN); /* serial number */
VPD_ENTRY(na, 12);  /* MAC address base */
VPD_ENTRY(cclk, 6); /* core clock */
VPD_ENTRY(mclk, 6); /* mem clock */
@@ -648,6 +648,7 @@ static int get_vpd_params(struct adapter *adapter, struct 
vpd_params *p)
p-uclk = simple_strtoul(vpd.uclk_data, NULL, 10);
p-mdc = simple_strtoul(vpd.mdc_data, NULL, 10);
p-mem_timing = simple_strtoul(vpd.mt_data, NULL, 10);
+   memcpy(p-sn, vpd.sn_data, SERNUM_LEN);
 
/* Old eeproms didn't have port information */
if (adapter-params.rev == 0  !vpd.port0_data[0]) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/11] cxgb3 - Update internal memory management

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Set PM1 internal memory to round robin mode
It balances access to this internal memory for multiport adapters.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h  |2 ++
 drivers/net/cxgb3/t3_hw.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 2824278..5e1bc0d 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1326,6 +1326,7 @@
 #define V_D0_WEIGHT(x) ((x)  S_D0_WEIGHT)
 
 #define A_PM1_RX_CFG 0x5c0
+#define A_PM1_RX_MODE 0x5c4
 
 #define A_PM1_RX_INT_ENABLE 0x5d8
 
@@ -1394,6 +1395,7 @@
 #define A_PM1_RX_INT_CAUSE 0x5dc
 
 #define A_PM1_TX_CFG 0x5e0
+#define A_PM1_TX_MODE 0x5e4
 
 #define A_PM1_TX_INT_ENABLE 0x5f8
 
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 23b1a16..13bfbec 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -3189,6 +3189,8 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
t3_set_reg_field(adapter, A_PCIX_CFG, 0, F_CLIDECEN);
 
t3_write_reg(adapter, A_PM1_RX_CFG, 0x);
+   t3_write_reg(adapter, A_PM1_RX_MODE, 0);
+   t3_write_reg(adapter, A_PM1_TX_MODE, 0);
init_hw_for_avail_ports(adapter, adapter-params.nports);
t3_sge_init(adapter, adapter-params.sge);
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/11] cxgb3 - engine microcode update

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Load microcode engine when the interface
is configured up.
Bump up version to 1.1.0.
Allow the driver to be and running with
older microcode images.
Allow ethtool to log the microcode version.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |8 ++-
 drivers/net/cxgb3/cxgb3_main.c |  116 
 drivers/net/cxgb3/t3_hw.c  |   43 +--
 3 files changed, 113 insertions(+), 54 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index d54446f..b665b20 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -127,8 +127,8 @@ enum {  /* adapter 
interrupt-maintained statistics */
 
 enum {
TP_VERSION_MAJOR= 1,
-   TP_VERSION_MINOR= 0,
-   TP_VERSION_MICRO= 44
+   TP_VERSION_MINOR= 1,
+   TP_VERSION_MICRO= 0
 };
 
 #define S_TP_VERSION_MAJOR 16
@@ -438,6 +438,7 @@ enum {  /* chip 
revisions */
T3_REV_A  = 0,
T3_REV_B  = 2,
T3_REV_B2 = 3,
+   T3_REV_C  = 4,
 };
 
 struct trace_params {
@@ -682,7 +683,8 @@ const struct adapter_info *t3_get_adapter_info(unsigned int 
board_id);
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data);
 int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data);
 int t3_seeprom_wp(struct adapter *adapter, int enable);
-int t3_check_tpsram_version(struct adapter *adapter);
+int t3_get_tp_version(struct adapter *adapter, u32 *vers);
+int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
 int t3_check_tpsram(struct adapter *adapter, u8 *tp_ram, unsigned int size);
 int t3_set_proto_sram(struct adapter *adap, u8 *data);
 int t3_read_flash(struct adapter *adapter, unsigned int addr,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index e5744e7..65ded16 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -721,6 +721,7 @@ static void bind_qsets(struct adapter *adap)
 }
 
 #define FW_FNAME t3fw-%d.%d.%d.bin
+#define TPSRAM_NAME t3%c_protocol_sram-%d.%d.%d.bin
 
 static int upgrade_fw(struct adapter *adap)
 {
@@ -742,6 +743,61 @@ static int upgrade_fw(struct adapter *adap)
return ret;
 }
 
+static inline char t3rev2char(struct adapter *adapter)
+{
+   char rev = 0;
+
+   switch(adapter-params.rev) {
+   case T3_REV_A:
+   rev = 'a';
+   break;
+   case T3_REV_B:
+   case T3_REV_B2:
+   rev = 'b';
+   break;
+   case T3_REV_C:
+   rev = 'c';
+   break;
+   }
+   return rev;
+}
+
+int update_tpsram(struct adapter *adap)
+{
+   const struct firmware *tpsram;
+   char buf[64];
+   struct device *dev = adap-pdev-dev;
+   int ret;
+   char rev;
+   
+   rev = t3rev2char(adap);
+   if (!rev)
+   return 0;
+
+   snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
+TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
+
+   ret = request_firmware(tpsram, buf, dev);
+   if (ret  0) {
+   dev_err(dev, could not load TP SRAM: unable to load %s\n,
+   buf);
+   return ret;
+   }
+   
+   ret = t3_check_tpsram(adap, tpsram-data, tpsram-size);
+   if (ret)
+   goto release_tpsram;
+
+   ret = t3_set_proto_sram(adap, tpsram-data);
+   if (ret)
+   dev_err(dev, loading protocol SRAM failed\n);
+
+release_tpsram:
+   release_firmware(tpsram);
+   
+   return ret;
+}
+
 /**
  * cxgb_up - enable the adapter
  * @adapter: adapter being enabled
@@ -755,6 +811,7 @@ static int upgrade_fw(struct adapter *adap)
 static int cxgb_up(struct adapter *adap)
 {
int err = 0;
+   int must_load;
 
if (!(adap-flags  FULL_INIT_DONE)) {
err = t3_check_fw_version(adap);
@@ -763,6 +820,13 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto out;
 
+   err = t3_check_tpsram_version(adap, must_load);
+   if (err == -EINVAL) {
+   err = update_tpsram(adap);
+   if (err  must_load)
+   goto out;
+   }
+
err = init_dummy_netdevs(adap);
if (err)
goto out;
@@ -1097,9 +1161,11 @@ static int get_eeprom_len(struct net_device *dev)
 static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
u32 fw_vers = 0;
+   u32 tp_vers = 0;
struct adapter *adapter = dev-priv;
 
t3_get_fw_version(adapter, fw_vers);
+   t3_get_tp_version(adapter, tp_vers);
 
strcpy(info-driver, DRV_NAME);
strcpy(info-version, DRV_VERSION

[PATCH 10/11] cxgb3 - Firmware update

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Update firmware version
Allow the driver to be up and running with older FW image

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |2 +-
 drivers/net/cxgb3/cxgb3_main.c |9 +
 drivers/net/cxgb3/t3_hw.c  |   20 +++-
 drivers/net/cxgb3/version.h|2 +-
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index b665b20..ff867c2 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -691,7 +691,7 @@ int t3_read_flash(struct adapter *adapter, unsigned int 
addr,
  unsigned int nwords, u32 *data, int byte_oriented);
 int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size);
 int t3_get_fw_version(struct adapter *adapter, u32 *vers);
-int t3_check_fw_version(struct adapter *adapter);
+int t3_check_fw_version(struct adapter *adapter, int *must_load);
 int t3_init_hw(struct adapter *adapter, u32 fw_params);
 void mac_prep(struct cmac *mac, struct adapter *adapter, int index);
 void early_hw_init(struct adapter *adapter, const struct adapter_info *ai);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 65ded16..eaebd7f 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -814,11 +814,12 @@ static int cxgb_up(struct adapter *adap)
int must_load;
 
if (!(adap-flags  FULL_INIT_DONE)) {
-   err = t3_check_fw_version(adap);
-   if (err == -EINVAL)
+   err = t3_check_fw_version(adap, must_load);
+   if (err == -EINVAL) {
err = upgrade_fw(adap);
-   if (err)
-   goto out;
+   if (err  must_load)
+   goto out;
+   }
 
err = t3_check_tpsram_version(adap, must_load);
if (err == -EINVAL) {
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 63032e8..3d47627 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -957,16 +957,18 @@ int t3_get_fw_version(struct adapter *adapter, u32 *vers)
 /**
  * t3_check_fw_version - check if the FW is compatible with this driver
  * @adapter: the adapter
- *
+ * @must_load: set to 1 if loading a new FW image is required
+
  * Checks if an adapter's FW is compatible with the driver.  Returns 0
  * if the versions are compatible, a negative error otherwise.
  */
-int t3_check_fw_version(struct adapter *adapter)
+int t3_check_fw_version(struct adapter *adapter, int *must_load)
 {
int ret;
u32 vers;
unsigned int type, major, minor;
 
+   *must_load = 1;
ret = t3_get_fw_version(adapter, vers);
if (ret)
return ret;
@@ -979,9 +981,17 @@ int t3_check_fw_version(struct adapter *adapter)
minor == FW_VERSION_MINOR)
return 0;
 
-   CH_ERR(adapter, found wrong FW version(%u.%u), 
-  driver needs version %u.%u\n, major, minor,
-  FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   if (major != FW_VERSION_MAJOR)
+   CH_ERR(adapter, found wrong FW version(%u.%u), 
+  driver needs version %u.%u\n, major, minor,
+  FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   else {
+   *must_load = 0;
+   CH_WARN(adapter, found wrong FW minor version(%u.%u), 
+   driver compiled for version %u.%u\n, major, minor,
+   FW_VERSION_MAJOR, FW_VERSION_MINOR);
+   }
+
return -EINVAL;
 }
 
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
index eb508bf..ef1c633 100644
--- a/drivers/net/cxgb3/version.h
+++ b/drivers/net/cxgb3/version.h
@@ -39,6 +39,6 @@
 
 /* Firmware version */
 #define FW_VERSION_MAJOR 4
-#define FW_VERSION_MINOR 3
+#define FW_VERSION_MINOR 6
 #define FW_VERSION_MICRO 0
 #endif /* __CHELSIO_VERSION_H */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/11] cxgb3 - log and clear PEX errors

2007-08-21 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Clear pciE PEX errors late at module load time.
Log details when PEX errors occur.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/t3_hw.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 3d47627..538b254 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1355,6 +1355,10 @@ static void pcie_intr_handler(struct adapter *adapter)
{0}
};
 
+   if (t3_read_reg(adapter, A_PCIE_INT_CAUSE)  F_PEXERR)
+   CH_ALERT(adapter, PEX error code 0x%x\n,
+t3_read_reg(adapter, A_PCIE_PEX_ERR));
+
if (t3_handle_intr_status(adapter, A_PCIE_INT_CAUSE, PCIE_INTR_MASK,
  pcie_intr_info, adapter-irq_stats))
t3_fatal_err(adapter);
@@ -1806,6 +1810,8 @@ void t3_intr_clear(struct adapter *adapter)
for (i = 0; i  ARRAY_SIZE(cause_reg_addr); ++i)
t3_write_reg(adapter, cause_reg_addr[i], 0x);
 
+   if (is_pcie(adapter))
+   t3_write_reg(adapter, A_PCIE_PEX_ERR, 0x);
t3_write_reg(adapter, A_PL_INT_CAUSE0, 0x);
t3_read_reg(adapter, A_PL_INT_CAUSE0);  /* flush */
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/13] cxgb3 - Update rx coalescing length

2007-08-14 Thread Divy Le Ray

Jeff Garzik wrote:


Divy Le Ray wrote:
 From: Divy Le Ray [EMAIL PROTECTED]

 Set max Rx coalescing length to 12288

 Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
 ---

  drivers/net/cxgb3/common.h |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
 index c46c249..55922ed 100644
 --- a/drivers/net/cxgb3/common.h
 +++ b/drivers/net/cxgb3/common.h
 @@ -104,7 +104,7 @@ enum {
   PROTO_SRAM_LINES = 128, /* size of TP sram */
  };
 
 -#define MAX_RX_COALESCING_LEN 16224U

 +#define MAX_RX_COALESCING_LEN 12288U

neither the patch nor description explains -why-



We're seeing back pressure from PCIe with large bursts, this patch 
allows to cut down on the burst size.


Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/13] cxgb3 - use immediate data for offload Tx

2007-08-14 Thread Divy Le Ray

Jeff Garzik wrote:


Divy Le Ray wrote:
 From: Divy Le Ray [EMAIL PROTECTED]

 Send small TX_DATA work requests as immediate data even when
 there are fragments.

 Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
 ---

  drivers/net/cxgb3/sge.c |   17 +++--
  1 files changed, 11 insertions(+), 6 deletions(-)

needs additional explanation.  don't just describe the new post-change
behavior, describe why this change is needed.


It's an optimization avoiding doing multiple DMAs for small fragmented 
packets.
The driver already implements this optimization for small contiguous 
packets.


Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/13] cxgb3 - Expose HW memory page info

2007-08-14 Thread Divy Le Ray

Jeff Garzik wrote:

Divy Le Ray wrote:

From: Divy Le Ray [EMAIL PROTECTED]

Let the RDMA driver get HW page info to work around HW issues.
Assign explicit enum values.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]


HW issues -- you need to go into far more detail, when adding a new 
interface.  what hw issues?  why was this the best/only solution?





A HW issue requires limiting the receive window size to 23 pages of 
internal memory.
These pages can be configured to different sizes, thus the RDMA driver 
needs to know the

page size to enforce the upper limit.

Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/13] cxgb3 - Update internal memory management

2007-08-14 Thread Divy Le Ray

Jeff Garzik wrote:


Divy Le Ray wrote:
 From: Divy Le Ray [EMAIL PROTECTED]

 Set PM1 internal memory to round robin mode

 Signed-off-by: Divy Le Ray [EMAIL PROTECTED]

why?


For multiport adapters, it balances access to this internal memory.

Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.23] cxgb3 - Fix dev-priv usage

2007-08-13 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

cxgb3 used netdev_priv() and dev-priv for different purposes.
In 2.6.23, netdev_priv() == dev-priv, cxgb3 needs a fix.
This patch is a partial backport of Dave Miller's changes in the 
net-2.6.24 git branch. 

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h   |   10 +++
 drivers/net/cxgb3/cxgb3_main.c|  126 +
 drivers/net/cxgb3/cxgb3_offload.c |6 +-
 drivers/net/cxgb3/sge.c   |   23 ---
 drivers/net/cxgb3/t3cdev.h|3 -
 5 files changed, 100 insertions(+), 68 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ab72563..c1dc344 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,7 +50,9 @@ typedef irqreturn_t(*intr_handler_t) (int, void *);
 
 struct vlan_group;
 
+struct adapter;
 struct port_info {
+   struct adapter *adapter;
struct vlan_group *vlan_grp;
const struct port_type_info *port_type;
u8 port_id;
@@ -246,6 +248,14 @@ static inline void t3_write_reg(struct adapter *adapter, 
u32 reg_addr, u32 val)
writel(val, adapter-regs + reg_addr);
 }
 
+/* Get the t3cdev associated with a net_device */
+static inline struct t3cdev *dev2t3cdev(struct net_device *dev)
+{
+   const struct port_info *pi = netdev_priv(dev);
+
+   return (struct t3cdev *)pi-adapter;
+}
+
 static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
 {
return netdev_priv(adap-port[idx]);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..f3bf128 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -358,11 +358,14 @@ static int init_dummy_netdevs(struct adapter *adap)
 
for (j = 0; j  pi-nqsets - 1; j++) {
if (!adap-dummy_netdev[dummy_idx]) {
-   nd = alloc_netdev(0, , ether_setup);
+   struct port_info *p;
+
+   nd = alloc_netdev(sizeof(*p), , ether_setup);
if (!nd)
goto free_all;
 
-   nd-priv = adap;
+   p = netdev_priv(nd);
+   p-adapter = adap;
nd-weight = 64;
set_bit(__LINK_STATE_START, nd-state);
adap-dummy_netdev[dummy_idx] = nd;
@@ -482,7 +485,8 @@ static ssize_t attr_store(struct device *d, struct 
device_attribute *attr,
 #define CXGB3_SHOW(name, val_expr) \
 static ssize_t format_##name(struct net_device *dev, char *buf) \
 { \
-   struct adapter *adap = dev-priv; \
+   struct port_info *pi = netdev_priv(dev); \
+   struct adapter *adap = pi-adapter; \
return sprintf(buf, %u\n, val_expr); \
 } \
 static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
@@ -493,7 +497,8 @@ static ssize_t show_##name(struct device *d, struct 
device_attribute *attr, \
 
 static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
 
if (adap-flags  FULL_INIT_DONE)
@@ -515,7 +520,8 @@ static ssize_t store_nfilters(struct device *d, struct 
device_attribute *attr,
 
 static ssize_t set_nservers(struct net_device *dev, unsigned int val)
 {
-   struct adapter *adap = dev-priv;
+   struct port_info *pi = netdev_priv(dev);
+   struct adapter *adap = pi-adapter;
 
if (adap-flags  FULL_INIT_DONE)
return -EBUSY;
@@ -556,9 +562,10 @@ static struct attribute_group cxgb3_attr_group = {.attrs = 
cxgb3_attrs };
 static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
char *buf, int sched)
 {
-   ssize_t len;
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
unsigned int v, addr, bpt, cpt;
-   struct adapter *adap = to_net_dev(d)-priv;
+   ssize_t len;
 
addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
rtnl_lock();
@@ -581,10 +588,11 @@ static ssize_t tm_attr_show(struct device *d, struct 
device_attribute *attr,
 static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
 const char *buf, size_t len, int sched)
 {
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   struct adapter *adap = pi-adapter;
+   unsigned int val;
char *endp;
ssize_t ret;
-   unsigned int val;
-   struct adapter *adap = to_net_dev(d)-priv;
 
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -858,8 +866,9 @@ static void schedule_chk_task(struct

[PATCH 1/13] cxgb3 - MAC workaround update

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Update the MAC workaround to deal with switches that do not
honor pause frames.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |1 +
 drivers/net/cxgb3/xgmac.c  |   22 +++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 1637800..c46c249 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -507,6 +507,7 @@ struct cmac {
unsigned int tx_xcnt;
u64 tx_mcnt;
unsigned int rx_xcnt;
+   unsigned int rx_ocnt;
u64 rx_mcnt;
unsigned int toggle_cnt;
unsigned int txen;
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index c302b1a..1d1c391 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -437,12 +437,13 @@ int t3_mac_enable(struct cmac *mac, int which)
struct mac_stats *s = mac-stats;

if (which  MAC_DIRECTION_TX) {
-   t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN);
t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
t3_write_reg(adap, A_TP_PIO_DATA, 0xc0ede401);
t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
t3_set_reg_field(adap, A_TP_PIO_DATA, 1  idx, 1  idx);
 
+   t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN);
+
t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx);
mac-tx_mcnt = s-tx_frames;
mac-tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
@@ -454,6 +455,7 @@ int t3_mac_enable(struct cmac *mac, int which)
mac-rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
A_XGM_RX_SPI4_SOP_EOP_CNT +
oft)));
+   mac-rx_ocnt = s-rx_fifo_ovfl;
mac-txen = F_TXEN;
mac-toggle_cnt = 0;
}
@@ -464,24 +466,19 @@ int t3_mac_enable(struct cmac *mac, int which)
 
 int t3_mac_disable(struct cmac *mac, int which)
 {
-   int idx = macidx(mac);
struct adapter *adap = mac-adapter;
-   int val;
 
if (which  MAC_DIRECTION_TX) {
t3_write_reg(adap, A_XGM_TX_CTRL + mac-offset, 0);
-   t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
-   t3_write_reg(adap, A_TP_PIO_DATA, 0xc01f);
-   t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
-   t3_set_reg_field(adap, A_TP_PIO_DATA, 1  idx, 1  idx);
mac-txen = 0;
}
if (which  MAC_DIRECTION_RX) {
+   int val = F_MAC_RESET_;
+
t3_set_reg_field(mac-adapter, A_XGM_RESET_CTRL + mac-offset,
 F_PCS_RESET_, 0);
msleep(100);
t3_write_reg(adap, A_XGM_RX_CTRL + mac-offset, 0);
-   val = F_MAC_RESET_;
if (is_10G(adap))
val |= F_PCS_RESET_;
else if (uses_xaui(adap))
@@ -541,11 +538,14 @@ int t3b2_mac_watchdog_task(struct cmac *mac)
}
 
 rxcheck:
-   if (rx_mcnt != mac-rx_mcnt)
+   if (rx_mcnt != mac-rx_mcnt) {
rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
A_XGM_RX_SPI4_SOP_EOP_CNT +
-   mac-offset)));
-   else
+   mac-offset))) +
+   (s-rx_fifo_ovfl -
+mac-rx_ocnt);
+   mac-rx_ocnt = s-rx_fifo_ovfl;
+   } else
goto out;
 
if (mac-rx_mcnt != s-rx_frames  rx_xcnt == 0 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/13] cxgb3 - Update rx coalescing length

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Set max Rx coalescing length to 12288

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index c46c249..55922ed 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -104,7 +104,7 @@ enum {
PROTO_SRAM_LINES = 128, /* size of TP sram */
 };
 
-#define MAX_RX_COALESCING_LEN 16224U
+#define MAX_RX_COALESCING_LEN 12288U
 
 enum {
PAUSE_RX = 1  0,
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/13] cxgb3 - SGE doorbell overflow warning

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Log doorbell Fifo overflow

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h |8 
 drivers/net/cxgb3/sge.c  |4 
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index aa80313..2824278 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -172,6 +172,14 @@
 
 #define A_SG_INT_CAUSE 0x5c
 
+#define S_HIPIODRBDROPERR11
+#define V_HIPIODRBDROPERR(x) ((x)  S_HIPIODRBDROPERR)
+#define F_HIPIODRBDROPERRV_HIPIODRBDROPERR(1U)
+
+#define S_LOPIODRBDROPERR10
+#define V_LOPIODRBDROPERR(x) ((x)  S_LOPIODRBDROPERR)
+#define F_LOPIODRBDROPERRV_LOPIODRBDROPERR(1U)
+
 #define S_RSPQDISABLED3
 #define V_RSPQDISABLED(x) ((x)  S_RSPQDISABLED)
 #define F_RSPQDISABLEDV_RSPQDISABLED(1U)
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a2cfd68..9213cda 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2476,6 +2476,10 @@ void t3_sge_err_intr_handler(struct adapter *adapter)
 (0x%x)\n, (v  S_RSPQ0DISABLED)  0xff);
}
 
+   if (status  (F_HIPIODRBDROPERR | F_LOPIODRBDROPERR))
+   CH_ALERT(adapter, SGE dropped %s priority doorbell\n,
+status  F_HIPIODRBDROPERR ? high : lo);
+
t3_write_reg(adapter, A_SG_INT_CAUSE, status);
if (status  (F_RSPQCREDITOVERFOW | F_RSPQDISABLED))
t3_fatal_err(adapter);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/13] cxgb3 - use immediate data for offload Tx

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Send small TX_DATA work requests as immediate data even when
there are fragments.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/sge.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 9213cda..dca2716 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1182,8 +1182,8 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device 
*dev)
  *
  * Writes a packet as immediate data into a Tx descriptor.  The packet
  * contains a work request at its beginning.  We must write the packet
- * carefully so the SGE doesn't read accidentally before it's written in
- * its entirety.
+ * carefully so the SGE doesn't read it accidentally before it's written
+ * in its entirety.
  */
 static inline void write_imm(struct tx_desc *d, struct sk_buff *skb,
 unsigned int len, unsigned int gen)
@@ -1191,7 +1191,11 @@ static inline void write_imm(struct tx_desc *d, struct 
sk_buff *skb,
struct work_request_hdr *from = (struct work_request_hdr *)skb-data;
struct work_request_hdr *to = (struct work_request_hdr *)d;
 
-   memcpy(to[1], from[1], len - sizeof(*from));
+   if (likely(!skb-data_len))
+   memcpy(to[1], from[1], len - sizeof(*from));
+   else
+   skb_copy_bits(skb, sizeof(*from), to[1], len - sizeof(*from));
+
to-wr_hi = from-wr_hi | htonl(F_WR_SOP | F_WR_EOP |
V_WR_BCNTLFLT(len  7));
wmb();
@@ -1261,7 +1265,7 @@ static inline void reclaim_completed_tx_imm(struct 
sge_txq *q)
 
 static inline int immediate(const struct sk_buff *skb)
 {
-   return skb-len = WR_LEN  !skb-data_len;
+   return skb-len = WR_LEN;
 }
 
 /**
@@ -1467,12 +1471,13 @@ static void write_ofld_wr(struct adapter *adap, struct 
sk_buff *skb,
  */
 static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
 {
-   unsigned int flits, cnt = skb_shinfo(skb)-nr_frags;
+   unsigned int flits, cnt;
 
-   if (skb-len = WR_LEN  cnt == 0)
+   if (skb-len = WR_LEN)
return 1;   /* packet fits as immediate data */
 
flits = skb_transport_offset(skb) / 8;  /* headers */
+   cnt = skb_shinfo(skb)-nr_frags;
if (skb-tail != skb-transport_header)
cnt++;
return flits_to_desc(flits + sgl_len(cnt));
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/13] cxgb3 - Expose HW memory page info

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Let the RDMA driver get HW page info to work around HW issues.
Assign explicit enum values.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_ctl_defs.h |   52 +---
 drivers/net/cxgb3/cxgb3_offload.c  |7 +
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 2095dda..6c4f320 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -33,27 +33,29 @@
 #define _CXGB3_OFFLOAD_CTL_DEFS_H
 
 enum {
-   GET_MAX_OUTSTANDING_WR,
-   GET_TX_MAX_CHUNK,
-   GET_TID_RANGE,
-   GET_STID_RANGE,
-   GET_RTBL_RANGE,
-   GET_L2T_CAPACITY,
-   GET_MTUS,
-   GET_WR_LEN,
-   GET_IFF_FROM_MAC,
-   GET_DDP_PARAMS,
-   GET_PORTS,
-
-   ULP_ISCSI_GET_PARAMS,
-   ULP_ISCSI_SET_PARAMS,
-
-   RDMA_GET_PARAMS,
-   RDMA_CQ_OP,
-   RDMA_CQ_SETUP,
-   RDMA_CQ_DISABLE,
-   RDMA_CTRL_QP_SETUP,
-   RDMA_GET_MEM,
+   GET_MAX_OUTSTANDING_WR  = 0,
+   GET_TX_MAX_CHUNK= 1,
+   GET_TID_RANGE   = 2,
+   GET_STID_RANGE  = 3,
+   GET_RTBL_RANGE  = 4,
+   GET_L2T_CAPACITY= 5,
+   GET_MTUS= 6,
+   GET_WR_LEN  = 7,
+   GET_IFF_FROM_MAC= 8,
+   GET_DDP_PARAMS  = 9,
+   GET_PORTS   = 10,
+
+   ULP_ISCSI_GET_PARAMS= 11,
+   ULP_ISCSI_SET_PARAMS= 12,
+
+   RDMA_GET_PARAMS = 13,
+   RDMA_CQ_OP  = 14,
+   RDMA_CQ_SETUP   = 15,
+   RDMA_CQ_DISABLE = 16,
+   RDMA_CTRL_QP_SETUP  = 17,
+   RDMA_GET_MEM= 18,
+
+   GET_RX_PAGE_INFO= 50,
 };
 
 /*
@@ -161,4 +163,12 @@ struct rdma_ctrlqp_setup {
unsigned long long base_addr;
unsigned int size;
 };
+
+/*
+ * Offload TX/RX page information.
+ */
+struct ofld_page_info {
+   unsigned int page_size;  /* Page size, should be a power of 2 */
+   unsigned int num;/* Number of pages */
+};
 #endif /* _CXGB3_OFFLOAD_CTL_DEFS_H */
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index e620ed4..522c1be 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -317,6 +317,8 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned 
int req, void *data)
struct iff_mac *iffmacp;
struct ddp_params *ddpp;
struct adap_ports *ports;
+   struct ofld_page_info *rx_page_info;
+   struct tp_params *tp = adapter-params.tp;
int i;
 
switch (req) {
@@ -382,6 +384,11 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned 
int req, void *data)
if (!offload_running(adapter))
return -EAGAIN;
return cxgb_rdma_ctl(adapter, req, data);
+   case GET_RX_PAGE_INFO:
+   rx_page_info = data;
+   rx_page_info-page_size = tp-rx_pg_size;
+   rx_page_info-num = tp-rx_num_pgs;
+   break;
default:
return -EOPNOTSUPP;
}
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/13] cxgb3 - Fatal error update

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Stop the MAC when a fatal error is detected.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..a1f94cf 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2270,6 +2270,10 @@ void t3_fatal_err(struct adapter *adapter)
 
if (adapter-flags  FULL_INIT_DONE) {
t3_sge_stop(adapter);
+   t3_write_reg(adapter, A_XGM_TX_CTRL, 0);
+   t3_write_reg(adapter, A_XGM_RX_CTRL, 0);
+   t3_write_reg(adapter, XGM_REG(A_XGM_TX_CTRL, 1), 0);
+   t3_write_reg(adapter, XGM_REG(A_XGM_RX_CTRL, 1), 0);
t3_intr_disable(adapter);
}
CH_ALERT(adapter, encountered fatal error, operation suspended\n);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/13] cxgb3 - log adapter derial number

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Log HW serial number when cxgb3 module is loaded.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |2 ++
 drivers/net/cxgb3/cxgb3_main.c |6 --
 drivers/net/cxgb3/t3_hw.c  |3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 55922ed..d54446f 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -97,6 +97,7 @@ enum {
MAX_NPORTS = 2, /* max # of ports */
MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */
EEPROMSIZE = 8192,  /* Serial EEPROM size */
+   SERNUM_LEN = 16,/* Serial # length */
RSS_TABLE_SIZE = 64,/* size of RSS lookup and mapping tables */
TCB_SIZE = 128, /* TCB size */
NMTUS = 16, /* size of MTU table */
@@ -391,6 +392,7 @@ struct vpd_params {
unsigned int uclk;
unsigned int mdc;
unsigned int mem_timing;
+   u8 sn[SERNUM_LEN + 1];
u8 eth_base[6];
u8 port_type[MAX_NPORTS];
unsigned short xauicfg[2];
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index a1f94cf..e5744e7 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2333,10 +2333,12 @@ static void __devinit print_port_info(struct adapter 
*adap,
   (adap-flags  USING_MSIX) ?  MSI-X :
   (adap-flags  USING_MSI) ?  MSI : );
if (adap-name == dev-name  adap-params.vpd.mclk)
-   printk(KERN_INFO %s: %uMB CM, %uMB PMTX, %uMB PMRX\n,
+   printk(KERN_INFO
+  %s: %uMB CM, %uMB PMTX, %uMB PMRX, S/N: %s\n,
   adap-name, t3_mc7_size(adap-cm)  20,
   t3_mc7_size(adap-pmtx)  20,
-  t3_mc7_size(adap-pmrx)  20);
+  t3_mc7_size(adap-pmrx)  20,
+  adap-params.vpd.sn);
}
 }
 
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index dd3149d..23b1a16 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -505,7 +505,7 @@ struct t3_vpd {
u8 vpdr_len[2];
VPD_ENTRY(pn, 16);  /* part number */
VPD_ENTRY(ec, 16);  /* EC level */
-   VPD_ENTRY(sn, 16);  /* serial number */
+   VPD_ENTRY(sn, SERNUM_LEN); /* serial number */
VPD_ENTRY(na, 12);  /* MAC address base */
VPD_ENTRY(cclk, 6); /* core clock */
VPD_ENTRY(mclk, 6); /* mem clock */
@@ -648,6 +648,7 @@ static int get_vpd_params(struct adapter *adapter, struct 
vpd_params *p)
p-uclk = simple_strtoul(vpd.uclk_data, NULL, 10);
p-mdc = simple_strtoul(vpd.mdc_data, NULL, 10);
p-mem_timing = simple_strtoul(vpd.mt_data, NULL, 10);
+   memcpy(p-sn, vpd.sn_data, SERNUM_LEN);
 
/* Old eeproms didn't have port information */
if (adapter-params.rev == 0  !vpd.port0_data[0]) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/13] cxgb3 - Update internal memory management

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Set PM1 internal memory to round robin mode

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h  |2 ++
 drivers/net/cxgb3/t3_hw.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 2824278..5e1bc0d 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1326,6 +1326,7 @@
 #define V_D0_WEIGHT(x) ((x)  S_D0_WEIGHT)
 
 #define A_PM1_RX_CFG 0x5c0
+#define A_PM1_RX_MODE 0x5c4
 
 #define A_PM1_RX_INT_ENABLE 0x5d8
 
@@ -1394,6 +1395,7 @@
 #define A_PM1_RX_INT_CAUSE 0x5dc
 
 #define A_PM1_TX_CFG 0x5e0
+#define A_PM1_TX_MODE 0x5e4
 
 #define A_PM1_TX_INT_ENABLE 0x5f8
 
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 23b1a16..13bfbec 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -3189,6 +3189,8 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
t3_set_reg_field(adapter, A_PCIX_CFG, 0, F_CLIDECEN);
 
t3_write_reg(adapter, A_PM1_RX_CFG, 0x);
+   t3_write_reg(adapter, A_PM1_RX_MODE, 0);
+   t3_write_reg(adapter, A_PM1_TX_MODE, 0);
init_hw_for_avail_ports(adapter, adapter-params.nports);
t3_sge_init(adapter, adapter-params.sge);
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/13] cxgb3 - engine microcode update

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Load microcode engine when the interface
is configured up.
Bump up version to 1.1.0.
Allow the driver to be and running with
older microcode images.
Allow ethtool to log the microcode version.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/common.h |8 ++-
 drivers/net/cxgb3/cxgb3_main.c |  116 
 drivers/net/cxgb3/t3_hw.c  |   43 +--
 3 files changed, 113 insertions(+), 54 deletions(-)

diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index d54446f..b665b20 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -127,8 +127,8 @@ enum {  /* adapter 
interrupt-maintained statistics */
 
 enum {
TP_VERSION_MAJOR= 1,
-   TP_VERSION_MINOR= 0,
-   TP_VERSION_MICRO= 44
+   TP_VERSION_MINOR= 1,
+   TP_VERSION_MICRO= 0
 };
 
 #define S_TP_VERSION_MAJOR 16
@@ -438,6 +438,7 @@ enum {  /* chip 
revisions */
T3_REV_A  = 0,
T3_REV_B  = 2,
T3_REV_B2 = 3,
+   T3_REV_C  = 4,
 };
 
 struct trace_params {
@@ -682,7 +683,8 @@ const struct adapter_info *t3_get_adapter_info(unsigned int 
board_id);
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data);
 int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data);
 int t3_seeprom_wp(struct adapter *adapter, int enable);
-int t3_check_tpsram_version(struct adapter *adapter);
+int t3_get_tp_version(struct adapter *adapter, u32 *vers);
+int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
 int t3_check_tpsram(struct adapter *adapter, u8 *tp_ram, unsigned int size);
 int t3_set_proto_sram(struct adapter *adap, u8 *data);
 int t3_read_flash(struct adapter *adapter, unsigned int addr,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index e5744e7..65ded16 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -721,6 +721,7 @@ static void bind_qsets(struct adapter *adap)
 }
 
 #define FW_FNAME t3fw-%d.%d.%d.bin
+#define TPSRAM_NAME t3%c_protocol_sram-%d.%d.%d.bin
 
 static int upgrade_fw(struct adapter *adap)
 {
@@ -742,6 +743,61 @@ static int upgrade_fw(struct adapter *adap)
return ret;
 }
 
+static inline char t3rev2char(struct adapter *adapter)
+{
+   char rev = 0;
+
+   switch(adapter-params.rev) {
+   case T3_REV_A:
+   rev = 'a';
+   break;
+   case T3_REV_B:
+   case T3_REV_B2:
+   rev = 'b';
+   break;
+   case T3_REV_C:
+   rev = 'c';
+   break;
+   }
+   return rev;
+}
+
+int update_tpsram(struct adapter *adap)
+{
+   const struct firmware *tpsram;
+   char buf[64];
+   struct device *dev = adap-pdev-dev;
+   int ret;
+   char rev;
+   
+   rev = t3rev2char(adap);
+   if (!rev)
+   return 0;
+
+   snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
+TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
+
+   ret = request_firmware(tpsram, buf, dev);
+   if (ret  0) {
+   dev_err(dev, could not load TP SRAM: unable to load %s\n,
+   buf);
+   return ret;
+   }
+   
+   ret = t3_check_tpsram(adap, tpsram-data, tpsram-size);
+   if (ret)
+   goto release_tpsram;
+
+   ret = t3_set_proto_sram(adap, tpsram-data);
+   if (ret)
+   dev_err(dev, loading protocol SRAM failed\n);
+
+release_tpsram:
+   release_firmware(tpsram);
+   
+   return ret;
+}
+
 /**
  * cxgb_up - enable the adapter
  * @adapter: adapter being enabled
@@ -755,6 +811,7 @@ static int upgrade_fw(struct adapter *adap)
 static int cxgb_up(struct adapter *adap)
 {
int err = 0;
+   int must_load;
 
if (!(adap-flags  FULL_INIT_DONE)) {
err = t3_check_fw_version(adap);
@@ -763,6 +820,13 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto out;
 
+   err = t3_check_tpsram_version(adap, must_load);
+   if (err == -EINVAL) {
+   err = update_tpsram(adap);
+   if (err  must_load)
+   goto out;
+   }
+
err = init_dummy_netdevs(adap);
if (err)
goto out;
@@ -1097,9 +1161,11 @@ static int get_eeprom_len(struct net_device *dev)
 static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
u32 fw_vers = 0;
+   u32 tp_vers = 0;
struct adapter *adapter = dev-priv;
 
t3_get_fw_version(adapter, fw_vers);
+   t3_get_tp_version(adapter, tp_vers);
 
strcpy(info-driver, DRV_NAME);
strcpy(info-version, DRV_VERSION

[PATCH 6/13] cxgb3 - tighten checks on TID values

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Enforce validity checks on connection ids

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_defs.h|   20 ++--
 drivers/net/cxgb3/cxgb3_offload.c |   28 +++-
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index 483a594..45e9216 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -79,9 +79,17 @@ static inline struct t3c_tid_entry *lookup_tid(const struct 
tid_info *t,
 static inline struct t3c_tid_entry *lookup_stid(const struct tid_info *t,
unsigned int tid)
 {
+   union listen_entry *e;
+
if (tid  t-stid_base || tid = t-stid_base + t-nstids)
return NULL;
-   return (stid2entry(t, tid)-t3c_tid);
+
+   e = stid2entry(t, tid);
+   if ((void *)e-next = (void *)t-tid_tab 
+   (void *)e-next  (void *)t-atid_tab[t-natids])
+   return NULL;
+
+   return e-t3c_tid;
 }
 
 /*
@@ -90,9 +98,17 @@ static inline struct t3c_tid_entry *lookup_stid(const struct 
tid_info *t,
 static inline struct t3c_tid_entry *lookup_atid(const struct tid_info *t,
unsigned int tid)
 {
+   union active_open_entry *e;
+
if (tid  t-atid_base || tid = t-atid_base + t-natids)
return NULL;
-   return (atid2entry(t, tid)-t3c_tid);
+
+   e = atid2entry(t, tid);
+   if ((void *)e-next = (void *)t-tid_tab 
+   (void *)e-next  (void *)t-atid_tab[t-natids])
+   return NULL;
+
+   return e-t3c_tid;
 }
 
 int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n);
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index 522c1be..7fb526a 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -57,7 +57,7 @@ static DEFINE_RWLOCK(adapter_list_lock);
 static LIST_HEAD(adapter_list);
 
 static const unsigned int MAX_ATIDS = 64 * 1024;
-static const unsigned int ATID_BASE = 0x10;
+static const unsigned int ATID_BASE = 0x1;
 
 static inline int offload_activated(struct t3cdev *tdev)
 {
@@ -684,10 +684,19 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb)
 {
struct cpl_pass_accept_req *req = cplhdr(skb);
unsigned int stid = G_PASS_OPEN_TID(ntohl(req-tos_tid));
+   struct tid_info *t = (T3C_DATA(dev))-tid_maps;
struct t3c_tid_entry *t3c_tid;
+   unsigned int tid = GET_TID(req);
 
-   t3c_tid = lookup_stid((T3C_DATA(dev))-tid_maps, stid);
-   if (t3c_tid-ctx  t3c_tid-client-handlers 
+   if (unlikely(tid = t-ntids)) {
+   printk(%s: passive open TID %u too large\n,
+  dev-name, tid);
+   t3_fatal_err(tdev2adap(dev));
+   return CPL_RET_BUF_DONE;
+   }
+   
+   t3c_tid = lookup_stid(t, stid);
+   if (t3c_tid  t3c_tid-ctx  t3c_tid-client-handlers 
t3c_tid-client-handlers[CPL_PASS_ACCEPT_REQ]) {
return t3c_tid-client-handlers[CPL_PASS_ACCEPT_REQ]
(dev, skb, t3c_tid-ctx);
@@ -769,16 +778,25 @@ static int do_act_establish(struct t3cdev *dev, struct 
sk_buff *skb)
 {
struct cpl_act_establish *req = cplhdr(skb);
unsigned int atid = G_PASS_OPEN_TID(ntohl(req-tos_tid));
+   struct tid_info *t = (T3C_DATA(dev))-tid_maps;
struct t3c_tid_entry *t3c_tid;
+   unsigned int tid = GET_TID(req);
 
-   t3c_tid = lookup_atid((T3C_DATA(dev))-tid_maps, atid);
+   if (unlikely(tid = t-ntids)) {
+   printk(%s: active establish TID %u too large\n,
+  dev-name, tid);
+   t3_fatal_err(tdev2adap(dev));
+   return CPL_RET_BUF_DONE;
+   }
+
+   t3c_tid = lookup_atid(t, atid);
if (t3c_tid  t3c_tid-ctx  t3c_tid-client-handlers 
t3c_tid-client-handlers[CPL_ACT_ESTABLISH]) {
return t3c_tid-client-handlers[CPL_ACT_ESTABLISH]
(dev, skb, t3c_tid-ctx);
} else {
printk(KERN_ERR %s: received clientless CPL command 0x%x\n,
-  dev-name, CPL_PASS_ACCEPT_REQ);
+  dev-name, CPL_ACT_ESTABLISH);
return CPL_RET_BUF_DONE | CPL_RET_BAD_MSG;
}
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/13] cxgb3 - test MSI capabilities

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Check that the HW in really in MSI/MSI-X mode
when it was succesfully enabled.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_main.c |   42 
 drivers/net/cxgb3/regs.h   |4 
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index eaebd7f..1449692 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2318,6 +2318,46 @@ void t3_fatal_err(struct adapter *adapter)
 
 }
 
+/*
+ * Interrupt handler used to check if MSI/MSI-X works on this platform.
+ */
+static irqreturn_t check_intr_handler(int irq, void *cookie)
+{
+   struct adapter *adap = cookie;
+
+   t3_set_reg_field(adap, A_PL_INT_ENABLE0, F_MI1, 0);
+   return IRQ_HANDLED;
+}
+
+static void __devinit check_msi(struct adapter *adap)
+{
+   int vec, mi1;
+
+   if (!(t3_read_reg(adap, A_PL_INT_CAUSE0)  F_MI1))
+   return;
+
+   vec = (adap-flags  USING_MSI) ? adap-pdev-irq :
+ adap-msix_info[0].vec;
+
+   if (request_irq(vec, check_intr_handler, 0, adap-name, adap))
+   return;
+
+   t3_set_reg_field(adap, A_PL_INT_ENABLE0, 0, F_MI1);
+   msleep(10);
+   mi1 = t3_read_reg(adap, A_PL_INT_ENABLE0)  F_MI1;
+   if (mi1)
+   t3_set_reg_field(adap, A_PL_INT_ENABLE0, F_MI1, 0);
+   free_irq(vec, adap);
+
+   if (mi1) {
+   cxgb_disable_msi(adap);
+   dev_info(adap-pdev-dev,
+the kernel believes that MSI is available on this 
+platform\nbut the driver's MSI test has failed.  
+Proceeding with INTx interrupts.\n);
+   }
+}
+
 static int __devinit cxgb_enable_msix(struct adapter *adap)
 {
struct msix_entry entries[SGE_QSETS + 1];
@@ -2554,6 +2594,8 @@ static int __devinit init_one(struct pci_dev *pdev,
adapter-flags |= USING_MSIX;
else if (msi  0  pci_enable_msi(pdev) == 0)
adapter-flags |= USING_MSI;
+   if (adapter-flags  (USING_MSIX | USING_MSI))
+   check_msi(adapter);
 
err = sysfs_create_group(adapter-port[0]-dev.kobj,
 cxgb3_attr_group);
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 5e1bc0d..f97f8ab 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1639,6 +1639,10 @@
 #define V_MC5A(x) ((x)  S_MC5A)
 #define F_MC5AV_MC5A(1U)
 
+#define S_MI113
+#define V_MI1(x) ((x)  S_MI1)
+#define F_MI1V_MI1(1U)
+
 #define S_CPL_SWITCH12
 #define V_CPL_SWITCH(x) ((x)  S_CPL_SWITCH)
 #define F_CPL_SWITCHV_CPL_SWITCH(1U)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/13] cxgb3 - log and clear PEX errors

2007-08-11 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Clear pciE PEX errors late at module load time.
Log details when PEX errors occur.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/t3_hw.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 3d47627..538b254 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1355,6 +1355,10 @@ static void pcie_intr_handler(struct adapter *adapter)
{0}
};
 
+   if (t3_read_reg(adapter, A_PCIE_INT_CAUSE)  F_PEXERR)
+   CH_ALERT(adapter, PEX error code 0x%x\n,
+t3_read_reg(adapter, A_PCIE_PEX_ERR));
+
if (t3_handle_intr_status(adapter, A_PCIE_INT_CAUSE, PCIE_INTR_MASK,
  pcie_intr_info, adapter-irq_stats))
t3_fatal_err(adapter);
@@ -1806,6 +1810,8 @@ void t3_intr_clear(struct adapter *adapter)
for (i = 0; i  ARRAY_SIZE(cause_reg_addr); ++i)
t3_write_reg(adapter, cause_reg_addr[i], 0x);
 
+   if (is_pcie(adapter))
+   t3_write_reg(adapter, A_PCIE_PEX_ERR, 0x);
t3_write_reg(adapter, A_PL_INT_CAUSE0, 0x);
t3_read_reg(adapter, A_PL_INT_CAUSE0);  /* flush */
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [2.6 patch] drivers/net/cxgb3/xgmac.c: remove dead code

2007-07-31 Thread Divy Le Ray

Adrian Bunk wrote:


This patch removes dead code (tx_xcnt can never be != 0 at this place)
spotted by the Coverity checker.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]


Acked-by: Divy Le Ray [EMAIL PROTECTED]



---

 drivers/net/cxgb3/xgmac.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

--- linux-2.6.22-rc6-mm1/drivers/net/cxgb3/xgmac.c.old  2007-07-24 
13:55:33.0 +0200
+++ linux-2.6.22-rc6-mm1/drivers/net/cxgb3/xgmac.c  2007-07-24 
13:57:06.0 +0200

@@ -510,38 +510,35 @@ int t3b2_mac_watchdog_task(struct cmac *
if (tx_mcnt == mac-tx_mcnt) {
tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,

A_XGM_TX_SPI4_SOP_EOP_CNT +

mac-offset)));
if (tx_xcnt == 0) {
t3_write_reg(adap, A_TP_PIO_ADDR,
 A_TP_TX_DROP_CNT_CH0 + macidx(mac));
tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
  A_TP_PIO_DATA)));
} else {
goto rxcheck;
}
} else {
mac-toggle_cnt = 0;
goto rxcheck;
}

-   if (((tx_tcnt != mac-tx_tcnt) 
-(tx_xcnt == 0)  (mac-tx_xcnt == 0)) ||
-   ((mac-tx_mcnt == tx_mcnt) 
-(tx_xcnt != 0)  (mac-tx_xcnt != 0))) {
+   if ((tx_tcnt != mac-tx_tcnt)  (mac-tx_xcnt == 0))  {
if (mac-toggle_cnt  4) {
status = 2;
goto out;
} else {
status = 1;
goto out;
}
} else {
mac-toggle_cnt = 0;
goto rxcheck;
}

 rxcheck:
if (rx_mcnt != mac-rx_mcnt)
rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,

A_XGM_RX_SPI4_SOP_EOP_CNT +

mac-offset)));



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [drivers/net/cxgb3] removed several unneeded zero initilization

2007-07-20 Thread Divy Le Ray

Denis Cheng wrote:

Cc: [EMAIL PROTECTED]
Signed-off-by: Denis Cheng [EMAIL PROTECTED]
  

Acked-by: Divy Le Ray [EMAIL PROTECTED]


---
 drivers/net/cxgb3/cxgb3_main.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 6fd1e52..45711f9 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -754,7 +754,7 @@ static int upgrade_fw(struct adapter *adap)
  */
 static int cxgb_up(struct adapter *adap)
 {
-   int err = 0;
+   int err;
 
 	if (!(adap-flags  FULL_INIT_DONE)) {

err = t3_check_fw_version(adap);
@@ -861,7 +861,7 @@ static int offload_open(struct net_device *dev)
struct adapter *adapter = dev-priv;
struct t3cdev *tdev = T3CDEV(dev);
int adap_up = adapter-open_device_map  PORT_MASK;
-   int err = 0;
+   int err;
 
 	if (test_and_set_bit(OFFLOAD_DEVMAP_BIT, adapter-open_device_map))

return 0;
@@ -1502,7 +1502,7 @@ static int set_eeprom(struct net_device *dev, struct 
ethtool_eeprom *eeprom,
  u8 * data)
 {
u8 *buf;
-   int err = 0;
+   int err;
u32 aligned_offset, aligned_len, *p;
struct adapter *adapter = dev-priv;
 
  


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Who's allowed to set a skb destructor?

2007-07-05 Thread Divy Le Ray

Andi Kleen wrote:

Brice Goglin [EMAIL PROTECTED] writes:

  

I am trying to understand whether I can setup a skb destructor in my
code (which is basically a protocol above dev_queue_xmit() and co). From
what I see in many parts in the current kernel code, the protocol (I
mean, the one who actually creates the skb) may setup a destructor.



The socket layer generally needs it for its own accounting.
Unless you never pass it up you can't use it.

  

However, I also see some places where some low-level drivers might be
using a destructor too , without apparently checking whether an upper
layer already uses one. For instance, write_ofld_wr() in cxgb3/sge.c.



Likely a bug. Normally that should not slip past code review.
  


Andi,

The destructor method is set and used for skbs originating from the RDMA 
driver sitting above cxgb3.


The patch introducing this code was discussed at the time.
http://marc.info/?l=linux-netdevm=117029329230969w=2

Cheers,
Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.22 0/5] cxgb3 - bug fixes

2007-06-05 Thread Divy Le Ray

Divy Le Ray wrote:

Divy Le Ray wrote:

Hi Jeff,

I'm submitting a set of bug fixes for inclusion in 2.6.22.
The patches are built against Linus'git tree.



The mail title was incomplete. sorry about that.

Cheers,
Divy



Hi Jeff,

Did you get a chance to review the series I posted for driver fixes and 
updates ?


Cheers,
Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.22 0/5]

2007-05-30 Thread Divy Le Ray

Hi Jeff,

I'm submitting a set of bug fixes for inclusion in 2.6.22.
The patches are built against Linus'git tree.

Here is a brief description:
- Fix skb-dev dereference in,
- Fix netpoll handler,
- Fix link status detection for direct XAUI adapters,
- Work around potential hang on MTU change,
- Fix MAC watchdog.

You have already ACK'ed the link status detection fix.
I'm not sure however where it stands in your queue, so I'm resubmitting it.
Please ignore if you already processed it.

Cheers,
Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.22 0/5] cxgb3 - bug fixes

2007-05-30 Thread Divy Le Ray

Divy Le Ray wrote:

Hi Jeff,

I'm submitting a set of bug fixes for inclusion in 2.6.22.
The patches are built against Linus'git tree.



The mail title was incomplete. sorry about that.

Cheers,
Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] cxgb3 - Stop mac RX when changing MTU

2007-05-30 Thread Divy Le Ray

[EMAIL PROTECTED] wrote:

From: Divy Le Ray [EMAIL PROTECTED]

Rx traffic needs to be halted when the MTU is changed
to avoid a potential chip hang.
Reset/restore MAC filters around a MTU change.
Also fix the pause frames high materwark setting.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
  


This patch has a flaw. The register used to stop broadcast/multicast 
traffic is wrong.

Please ignore this instance. I'm resending it.

Divy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5 RESEND] cxgb3 - Stop mac RX when changing MTU

2007-05-30 Thread Divy Le Ray
From: Divy Le Ray [EMAIL PROTECTED]

Rx traffic needs to be halted when the MTU is changed
to avoid a potential chip hang.
Reset/restore MAC filters around a MTU change.
Also fix the pause frames high materwark setting.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h  |4 +++
 drivers/net/cxgb3/xgmac.c |   70 +
 2 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index bf9d6be..020859c 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1882,6 +1882,10 @@
 #define V_COPYALLFRAMES(x) ((x)  S_COPYALLFRAMES)
 #define F_COPYALLFRAMESV_COPYALLFRAMES(1U)
 
+#define S_DISBCAST1
+#define V_DISBCAST(x) ((x)  S_DISBCAST)
+#define F_DISBCASTV_DISBCAST(1U)
+
 #define A_XGM_RX_HASH_LOW 0x814
 
 #define A_XGM_RX_HASH_HIGH 0x818
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index a506792..cbc3f04 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -231,6 +231,28 @@ int t3_mac_set_num_ucast(struct cmac *ma
return 0;
 }
 
+static void disable_exact_filters(struct cmac *mac)
+{
+   unsigned int i, reg = mac-offset + A_XGM_RX_EXACT_MATCH_LOW_1;
+
+   for (i = 0; i  EXACT_ADDR_FILTERS; i++, reg += 8) {
+   u32 v = t3_read_reg(mac-adapter, reg);
+   t3_write_reg(mac-adapter, reg, v);
+   }
+   t3_read_reg(mac-adapter, A_XGM_RX_EXACT_MATCH_LOW_1);  /* flush */
+}
+
+static void enable_exact_filters(struct cmac *mac)
+{
+   unsigned int i, reg = mac-offset + A_XGM_RX_EXACT_MATCH_HIGH_1;
+
+   for (i = 0; i  EXACT_ADDR_FILTERS; i++, reg += 8) {
+   u32 v = t3_read_reg(mac-adapter, reg);
+   t3_write_reg(mac-adapter, reg, v);
+   }
+   t3_read_reg(mac-adapter, A_XGM_RX_EXACT_MATCH_LOW_1);  /* flush */
+}
+
 /* Calculate the RX hash filter index of an Ethernet address */
 static int hash_hw_addr(const u8 * addr)
 {
@@ -281,6 +303,14 @@ int t3_mac_set_rx_mode(struct cmac *mac,
return 0;
 }
 
+static int rx_fifo_hwm(int mtu)
+{
+   int hwm;
+
+   hwm = max(MAC_RXFIFO_SIZE - 3 * mtu, (MAC_RXFIFO_SIZE * 38) / 100);
+   return min(hwm, MAC_RXFIFO_SIZE - 8192);
+}
+
 int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
 {
int hwm, lwm;
@@ -294,23 +324,41 @@ int t3_mac_set_mtu(struct cmac *mac, uns
mtu += 14;
if (mtu  MAX_FRAME_SIZE - 4)
return -EINVAL;
-   t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac-offset, mtu);
+
+   if (adap-params.rev == T3_REV_B2 
+   (t3_read_reg(adap, A_XGM_RX_CTRL + mac-offset)  F_RXEN)) {
+   disable_exact_filters(mac);
+   v = t3_read_reg(adap, A_XGM_RX_CFG + mac-offset);
+   t3_set_reg_field(adap, A_XGM_RX_CFG + mac-offset,
+F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST);
+
+   /* drain rx FIFO */
+   if (t3_wait_op_done(adap,
+   A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + mac-offset,
+   1  31, 1, 20, 5)) {
+   t3_write_reg(adap, A_XGM_RX_CFG + mac-offset, v);
+   enable_exact_filters(mac);
+   return -EIO;
+   }
+   t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac-offset, mtu);
+   t3_write_reg(adap, A_XGM_RX_CFG + mac-offset, v);
+   enable_exact_filters(mac);
+   } else
+   t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac-offset, mtu);
 
/*
 * Adjust the PAUSE frame watermarks.  We always set the LWM, and the
 * HWM only if flow-control is enabled.
 */
-   hwm = max_t(unsigned int, MAC_RXFIFO_SIZE - 3 * mtu, 
-   MAC_RXFIFO_SIZE * 38 / 100);
-   hwm = min(hwm, MAC_RXFIFO_SIZE - 8192);
-   lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4);
-
+   hwm = rx_fifo_hwm(mtu);
+   lwm = min(3 * (int) mtu, MAC_RXFIFO_SIZE /4);
v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac-offset);
v = ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM);
v |= V_RXFIFOPAUSELWM(lwm / 8);
if (G_RXFIFOPAUSEHWM(v))
v = (v  ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM)) |
V_RXFIFOPAUSEHWM(hwm / 8);
+
t3_write_reg(adap, A_XGM_RXFIFO_CFG + mac-offset, v);
 
/* Adjust the TX FIFO threshold based on the MTU */
@@ -329,7 +377,6 @@ int t3_mac_set_mtu(struct cmac *mac, uns
 (hwm - lwm) * 4 / 8);
t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac-offset,
 MAC_RXFIFO_SIZE * 4 * 8 / 512);
-
return 0;
 }
 
@@ -357,6 +404,15 @@ int t3_mac_set_speed_duplex_fc(struct cm
 V_PORTSPEED(M_PORTSPEED), val);
}
 
+   val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft);
+   val = ~V_RXFIFOPAUSEHWM

Re: [PATCH 1/7] cxgb3 - Fix SGE page management

2007-05-30 Thread Divy Le Ray

Jeff Garzik wrote:

[EMAIL PROTECTED] wrote:

From: Divy Le Ray [EMAIL PROTECTED]

Streamline page management on RX.
Fix dma mappings.



NAK #2:  You should use the page_address(page) accessor rather than 
creating a struct member in the same struct as your page, solely to 
contain the virtual address.

Jeff,

The struct member caches the value of page_address(page) + current 
offset for optimization purposes.


Divy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >