aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2007-01-30 22:43:50 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-05 16:58:50 -0500
commit14ab989245069907622ab9fd930275c086cee069 (patch)
tree936634558782631f67ff2f1b69e35a6d6200f074 /drivers/net/cxgb3
parent4aac38990843b4f165ccf467b772e18827bff84c (diff)
cxgb3 - bind qsets on multiport adapter
Inform FW about the queue set->interface mapping. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/adapter.h2
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c68
-rw-r--r--drivers/net/cxgb3/sge.c8
3 files changed, 54 insertions, 24 deletions
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 16643f6d00a9..8902007e8941 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -46,6 +46,7 @@ enum { /* adapter flags */
46 FULL_INIT_DONE = (1 << 0), 46 FULL_INIT_DONE = (1 << 0),
47 USING_MSI = (1 << 1), 47 USING_MSI = (1 << 1),
48 USING_MSIX = (1 << 2), 48 USING_MSIX = (1 << 2),
49 QUEUES_BOUND = (1 << 3),
49}; 50};
50 51
51struct rx_desc; 52struct rx_desc;
@@ -244,6 +245,7 @@ void t3_free_sge_resources(struct adapter *adap);
244void t3_sge_err_intr_handler(struct adapter *adapter); 245void t3_sge_err_intr_handler(struct adapter *adapter);
245intr_handler_t t3_intr_handler(struct adapter *adap, int polling); 246intr_handler_t t3_intr_handler(struct adapter *adap, int polling);
246int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev); 247int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev);
248int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
247void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p); 249void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p);
248int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, 250int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
249 int irq_vec_idx, const struct qset_params *p, 251 int irq_vec_idx, const struct qset_params *p,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 804414637ec7..7e7ee7ae177b 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -649,6 +649,37 @@ static void init_port_mtus(struct adapter *adapter)
649 t3_write_reg(adapter, A_TP_MTU_PORT_TABLE, mtus); 649 t3_write_reg(adapter, A_TP_MTU_PORT_TABLE, mtus);
650} 650}
651 651
652static void send_pktsched_cmd(struct adapter *adap, int sched, int qidx, int lo,
653 int hi, int port)
654{
655 struct sk_buff *skb;
656 struct mngt_pktsched_wr *req;
657
658 skb = alloc_skb(sizeof(*req), GFP_KERNEL | __GFP_NOFAIL);
659 req = (struct mngt_pktsched_wr *)skb_put(skb, sizeof(*req));
660 req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_MNGT));
661 req->mngt_opcode = FW_MNGTOPCODE_PKTSCHED_SET;
662 req->sched = sched;
663 req->idx = qidx;
664 req->min = lo;
665 req->max = hi;
666 req->binding = port;
667 t3_mgmt_tx(adap, skb);
668}
669
670static void bind_qsets(struct adapter *adap)
671{
672 int i, j;
673
674 for_each_port(adap, i) {
675 const struct port_info *pi = adap2pinfo(adap, i);
676
677 for (j = 0; j < pi->nqsets; ++j)
678 send_pktsched_cmd(adap, 1, pi->first_qset + j, -1,
679 -1, i);
680 }
681}
682
652/** 683/**
653 * cxgb_up - enable the adapter 684 * cxgb_up - enable the adapter
654 * @adapter: adapter being enabled 685 * @adapter: adapter being enabled
@@ -708,6 +739,11 @@ static int cxgb_up(struct adapter *adap)
708 739
709 t3_sge_start(adap); 740 t3_sge_start(adap);
710 t3_intr_enable(adap); 741 t3_intr_enable(adap);
742
743 if ((adap->flags & (USING_MSIX | QUEUES_BOUND)) == USING_MSIX)
744 bind_qsets(adap);
745 adap->flags |= QUEUES_BOUND;
746
711out: 747out:
712 return err; 748 return err;
713irq_err: 749irq_err:
@@ -1830,34 +1866,18 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1830 break; 1866 break;
1831 } 1867 }
1832 case CHELSIO_SET_PKTSCHED:{ 1868 case CHELSIO_SET_PKTSCHED:{
1833 struct sk_buff *skb;
1834 struct ch_pktsched_params p; 1869 struct ch_pktsched_params p;
1835 struct mngt_pktsched_wr *req;
1836 1870
1837 if (!(adapter->flags & FULL_INIT_DONE)) 1871 if (!capable(CAP_NET_ADMIN))
1838 return -EIO; /* uP must be up and running */ 1872 return -EPERM;
1873 if (!adapter->open_device_map)
1874 return -EAGAIN; /* uP and SGE must be running */
1839 if (copy_from_user(&p, useraddr, sizeof(p))) 1875 if (copy_from_user(&p, useraddr, sizeof(p)))
1840 return -EFAULT; 1876 return -EFAULT;
1841 skb = alloc_skb(sizeof(*req), GFP_KERNEL); 1877 send_pktsched_cmd(adapter, p.sched, p.idx, p.min, p.max,
1842 if (!skb) 1878 p.binding);
1843 return -ENOMEM;
1844 req =
1845 (struct mngt_pktsched_wr *)skb_put(skb,
1846 sizeof(*req));
1847 req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_MNGT));
1848 req->mngt_opcode = FW_MNGTOPCODE_PKTSCHED_SET;
1849 req->sched = p.sched;
1850 req->idx = p.idx;
1851 req->min = p.min;
1852 req->max = p.max;
1853 req->binding = p.binding;
1854 printk(KERN_INFO
1855 "pktsched: sched %u idx %u min %u max %u binding %u\n",
1856 req->sched, req->idx, req->min, req->max,
1857 req->binding);
1858 skb->priority = 1;
1859 offload_tx(&adapter->tdev, skb);
1860 break; 1879 break;
1880
1861 } 1881 }
1862 default: 1882 default:
1863 return -EOPNOTSUPP; 1883 return -EOPNOTSUPP;
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 6c77f4bab62f..ccea06a04402 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1198,6 +1198,14 @@ static void restart_ctrlq(unsigned long data)
1198 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); 1198 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
1199} 1199}
1200 1200
1201/*
1202 * Send a management message through control queue 0
1203 */
1204int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb)
1205{
1206 return ctrl_xmit(adap, &adap->sge.qs[0].txq[TXQ_CTRL], skb);
1207}
1208
1201/** 1209/**
1202 * write_ofld_wr - write an offload work request 1210 * write_ofld_wr - write an offload work request
1203 * @adap: the adapter 1211 * @adap: the adapter