aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/adapter.h
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-10-03 19:41:36 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:45 -0400
commitbea3348eef27e6044b6161fd04c3152215f96411 (patch)
treef0990b263e5ce42505d290a4c346fe990bcd4c33 /drivers/net/cxgb3/adapter.h
parentdde4e47e8fe333a5649a3fa0e7db1fa7c08d6158 (diff)
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net device, and some have a single interrupt doorbell for several queues. In either case, it's easier to support layouts like that if the structure representing the poll is independant from the net device itself. The signature of the ->poll() call back goes from: int foo_poll(struct net_device *dev, int *budget) to int foo_poll(struct napi_struct *napi, int budget) The caller is returned the number of RX packets processed (or the number of "NAPI credits" consumed if you want to get abstract). The callee no longer messes around bumping dev->quota, *budget, etc. because that is all handled in the caller upon return. The napi_struct is to be embedded in the device driver private data structures. Furthermore, it is the driver's responsibility to disable all NAPI instances in it's ->stop() device close handler. Since the napi_struct is privatized into the driver's private data structures, only the driver knows how to get at all of the napi_struct instances it may have per-device. With lots of help and suggestions from Rusty Russell, Roland Dreier, Michael Chan, Jeff Garzik, and Jamal Hadi Salim. Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra, Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan. [ Ported to current tree and all drivers converted. Integrated Stephen's follow-on kerneldoc additions, and restored poll_list handling to the old style to fix mutual exclusion issues. -DaveM ] Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/adapter.h')
-rw-r--r--drivers/net/cxgb3/adapter.h22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 20e887de254..04426170338 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -49,11 +49,13 @@
49typedef irqreturn_t(*intr_handler_t) (int, void *); 49typedef irqreturn_t(*intr_handler_t) (int, void *);
50 50
51struct vlan_group; 51struct vlan_group;
52
53struct adapter; 52struct adapter;
53struct sge_qset;
54
54struct port_info { 55struct port_info {
55 struct adapter *adapter; 56 struct adapter *adapter;
56 struct vlan_group *vlan_grp; 57 struct vlan_group *vlan_grp;
58 struct sge_qset *qs;
57 const struct port_type_info *port_type; 59 const struct port_type_info *port_type;
58 u8 port_id; 60 u8 port_id;
59 u8 rx_csum_offload; 61 u8 rx_csum_offload;
@@ -173,10 +175,12 @@ enum { /* per port SGE statistics */
173}; 175};
174 176
175struct sge_qset { /* an SGE queue set */ 177struct sge_qset { /* an SGE queue set */
178 struct adapter *adap;
179 struct napi_struct napi;
176 struct sge_rspq rspq; 180 struct sge_rspq rspq;
177 struct sge_fl fl[SGE_RXQ_PER_SET]; 181 struct sge_fl fl[SGE_RXQ_PER_SET];
178 struct sge_txq txq[SGE_TXQ_PER_SET]; 182 struct sge_txq txq[SGE_TXQ_PER_SET];
179 struct net_device *netdev; /* associated net device */ 183 struct net_device *netdev;
180 unsigned long txq_stopped; /* which Tx queues are stopped */ 184 unsigned long txq_stopped; /* which Tx queues are stopped */
181 struct timer_list tx_reclaim_timer; /* reclaims TX buffers */ 185 struct timer_list tx_reclaim_timer; /* reclaims TX buffers */
182 unsigned long port_stats[SGE_PSTAT_MAX]; 186 unsigned long port_stats[SGE_PSTAT_MAX];
@@ -221,12 +225,6 @@ struct adapter {
221 struct delayed_work adap_check_task; 225 struct delayed_work adap_check_task;
222 struct work_struct ext_intr_handler_task; 226 struct work_struct ext_intr_handler_task;
223 227
224 /*
225 * Dummy netdevices are needed when using multiple receive queues with
226 * NAPI as each netdevice can service only one queue.
227 */
228 struct net_device *dummy_netdev[SGE_QSETS - 1];
229
230 struct dentry *debugfs_root; 228 struct dentry *debugfs_root;
231 229
232 struct mutex mdio_lock; 230 struct mutex mdio_lock;
@@ -253,12 +251,6 @@ static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
253 return netdev_priv(adap->port[idx]); 251 return netdev_priv(adap->port[idx]);
254} 252}
255 253
256/*
257 * We use the spare atalk_ptr to map a net device to its SGE queue set.
258 * This is a macro so it can be used as l-value.
259 */
260#define dev2qset(netdev) ((netdev)->atalk_ptr)
261
262#define OFFLOAD_DEVMAP_BIT 15 254#define OFFLOAD_DEVMAP_BIT 15
263 255
264#define tdev2adap(d) container_of(d, struct adapter, tdev) 256#define tdev2adap(d) container_of(d, struct adapter, tdev)
@@ -284,7 +276,7 @@ int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
284void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p); 276void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p);
285int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, 277int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
286 int irq_vec_idx, const struct qset_params *p, 278 int irq_vec_idx, const struct qset_params *p,
287 int ntxq, struct net_device *netdev); 279 int ntxq, struct net_device *dev);
288int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, 280int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx,
289 unsigned char *data); 281 unsigned char *data);
290irqreturn_t t3_sge_intr_msix(int irq, void *cookie); 282irqreturn_t t3_sge_intr_msix(int irq, void *cookie);