aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4vf/cxgb4vf_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb4vf/cxgb4vf_main.c')
-rw-r--r--drivers/net/cxgb4vf/cxgb4vf_main.c88
1 files changed, 56 insertions, 32 deletions
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index c3449bbc585a..6bf464afa90e 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -816,40 +816,48 @@ static struct net_device_stats *cxgb4vf_get_stats(struct net_device *dev)
816} 816}
817 817
818/* 818/*
819 * Collect up to maxaddrs worth of a netdevice's unicast addresses into an 819 * Collect up to maxaddrs worth of a netdevice's unicast addresses, starting
820 * array of addrss pointers and return the number collected. 820 * at a specified offset within the list, into an array of addrss pointers and
821 * return the number collected.
821 */ 822 */
822static inline int collect_netdev_uc_list_addrs(const struct net_device *dev, 823static inline unsigned int collect_netdev_uc_list_addrs(const struct net_device *dev,
823 const u8 **addr, 824 const u8 **addr,
824 unsigned int maxaddrs) 825 unsigned int offset,
826 unsigned int maxaddrs)
825{ 827{
828 unsigned int index = 0;
826 unsigned int naddr = 0; 829 unsigned int naddr = 0;
827 const struct netdev_hw_addr *ha; 830 const struct netdev_hw_addr *ha;
828 831
829 for_each_dev_addr(dev, ha) { 832 for_each_dev_addr(dev, ha)
830 addr[naddr++] = ha->addr; 833 if (index++ >= offset) {
831 if (naddr >= maxaddrs) 834 addr[naddr++] = ha->addr;
832 break; 835 if (naddr >= maxaddrs)
833 } 836 break;
837 }
834 return naddr; 838 return naddr;
835} 839}
836 840
837/* 841/*
838 * Collect up to maxaddrs worth of a netdevice's multicast addresses into an 842 * Collect up to maxaddrs worth of a netdevice's multicast addresses, starting
839 * array of addrss pointers and return the number collected. 843 * at a specified offset within the list, into an array of addrss pointers and
844 * return the number collected.
840 */ 845 */
841static inline int collect_netdev_mc_list_addrs(const struct net_device *dev, 846static inline unsigned int collect_netdev_mc_list_addrs(const struct net_device *dev,
842 const u8 **addr, 847 const u8 **addr,
843 unsigned int maxaddrs) 848 unsigned int offset,
849 unsigned int maxaddrs)
844{ 850{
851 unsigned int index = 0;
845 unsigned int naddr = 0; 852 unsigned int naddr = 0;
846 const struct netdev_hw_addr *ha; 853 const struct netdev_hw_addr *ha;
847 854
848 netdev_for_each_mc_addr(ha, dev) { 855 netdev_for_each_mc_addr(ha, dev)
849 addr[naddr++] = ha->addr; 856 if (index++ >= offset) {
850 if (naddr >= maxaddrs) 857 addr[naddr++] = ha->addr;
851 break; 858 if (naddr >= maxaddrs)
852 } 859 break;
860 }
853 return naddr; 861 return naddr;
854} 862}
855 863
@@ -862,16 +870,20 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
862 u64 mhash = 0; 870 u64 mhash = 0;
863 u64 uhash = 0; 871 u64 uhash = 0;
864 bool free = true; 872 bool free = true;
865 u16 filt_idx[7]; 873 unsigned int offset, naddr;
866 const u8 *addr[7]; 874 const u8 *addr[7];
867 int ret, naddr = 0; 875 int ret;
868 const struct port_info *pi = netdev_priv(dev); 876 const struct port_info *pi = netdev_priv(dev);
869 877
870 /* first do the secondary unicast addresses */ 878 /* first do the secondary unicast addresses */
871 naddr = collect_netdev_uc_list_addrs(dev, addr, ARRAY_SIZE(addr)); 879 for (offset = 0; ; offset += naddr) {
872 if (naddr > 0) { 880 naddr = collect_netdev_uc_list_addrs(dev, addr, offset,
881 ARRAY_SIZE(addr));
882 if (naddr == 0)
883 break;
884
873 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, 885 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free,
874 naddr, addr, filt_idx, &uhash, sleep); 886 naddr, addr, NULL, &uhash, sleep);
875 if (ret < 0) 887 if (ret < 0)
876 return ret; 888 return ret;
877 889
@@ -879,12 +891,17 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
879 } 891 }
880 892
881 /* next set up the multicast addresses */ 893 /* next set up the multicast addresses */
882 naddr = collect_netdev_mc_list_addrs(dev, addr, ARRAY_SIZE(addr)); 894 for (offset = 0; ; offset += naddr) {
883 if (naddr > 0) { 895 naddr = collect_netdev_mc_list_addrs(dev, addr, offset,
896 ARRAY_SIZE(addr));
897 if (naddr == 0)
898 break;
899
884 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, 900 ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free,
885 naddr, addr, filt_idx, &mhash, sleep); 901 naddr, addr, NULL, &mhash, sleep);
886 if (ret < 0) 902 if (ret < 0)
887 return ret; 903 return ret;
904 free = false;
888 } 905 }
889 906
890 return t4vf_set_addr_hash(pi->adapter, pi->viid, uhash != 0, 907 return t4vf_set_addr_hash(pi->adapter, pi->viid, uhash != 0,
@@ -2252,6 +2269,7 @@ static void __devinit cfg_queues(struct adapter *adapter)
2252{ 2269{
2253 struct sge *s = &adapter->sge; 2270 struct sge *s = &adapter->sge;
2254 int q10g, n10g, qidx, pidx, qs; 2271 int q10g, n10g, qidx, pidx, qs;
2272 size_t iqe_size;
2255 2273
2256 /* 2274 /*
2257 * We should not be called till we know how many Queue Sets we can 2275 * We should not be called till we know how many Queue Sets we can
@@ -2296,6 +2314,13 @@ static void __devinit cfg_queues(struct adapter *adapter)
2296 s->ethqsets = qidx; 2314 s->ethqsets = qidx;
2297 2315
2298 /* 2316 /*
2317 * The Ingress Queue Entry Size for our various Response Queues needs
2318 * to be big enough to accommodate the largest message we can receive
2319 * from the chip/firmware; which is 64 bytes ...
2320 */
2321 iqe_size = 64;
2322
2323 /*
2299 * Set up default Queue Set parameters ... Start off with the 2324 * Set up default Queue Set parameters ... Start off with the
2300 * shortest interrupt holdoff timer. 2325 * shortest interrupt holdoff timer.
2301 */ 2326 */
@@ -2303,7 +2328,7 @@ static void __devinit cfg_queues(struct adapter *adapter)
2303 struct sge_eth_rxq *rxq = &s->ethrxq[qs]; 2328 struct sge_eth_rxq *rxq = &s->ethrxq[qs];
2304 struct sge_eth_txq *txq = &s->ethtxq[qs]; 2329 struct sge_eth_txq *txq = &s->ethtxq[qs];
2305 2330
2306 init_rspq(&rxq->rspq, 0, 0, 1024, L1_CACHE_BYTES); 2331 init_rspq(&rxq->rspq, 0, 0, 1024, iqe_size);
2307 rxq->fl.size = 72; 2332 rxq->fl.size = 72;
2308 txq->q.size = 1024; 2333 txq->q.size = 1024;
2309 } 2334 }
@@ -2312,8 +2337,7 @@ static void __devinit cfg_queues(struct adapter *adapter)
2312 * The firmware event queue is used for link state changes and 2337 * The firmware event queue is used for link state changes and
2313 * notifications of TX DMA completions. 2338 * notifications of TX DMA completions.
2314 */ 2339 */
2315 init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, 2340 init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, iqe_size);
2316 L1_CACHE_BYTES);
2317 2341
2318 /* 2342 /*
2319 * The forwarded interrupt queue is used when we're in MSI interrupt 2343 * The forwarded interrupt queue is used when we're in MSI interrupt
@@ -2329,7 +2353,7 @@ static void __devinit cfg_queues(struct adapter *adapter)
2329 * any time ... 2353 * any time ...
2330 */ 2354 */
2331 init_rspq(&s->intrq, SGE_TIMER_RSTRT_CNTR, 0, MSIX_ENTRIES + 1, 2355 init_rspq(&s->intrq, SGE_TIMER_RSTRT_CNTR, 0, MSIX_ENTRIES + 1,
2332 L1_CACHE_BYTES); 2356 iqe_size);
2333} 2357}
2334 2358
2335/* 2359/*