diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-01-30 22:43:50 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-05 16:58:50 -0500 |
commit | 14ab989245069907622ab9fd930275c086cee069 (patch) | |
tree | 936634558782631f67ff2f1b69e35a6d6200f074 /drivers/net/cxgb3/cxgb3_main.c | |
parent | 4aac38990843b4f165ccf467b772e18827bff84c (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/cxgb3_main.c')
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 68 |
1 files changed, 44 insertions, 24 deletions
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 | ||
652 | static 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 | |||
670 | static 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 | |||
711 | out: | 747 | out: |
712 | return err; | 748 | return err; |
713 | irq_err: | 749 | irq_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; |