@@ -1621,6 +1621,71 @@ int fbnic_alloc_resources(struct fbnic_net *fbn)
1621
1621
return err ;
1622
1622
}
1623
1623
1624
+ static void fbnic_set_netif_napi (struct fbnic_napi_vector * nv )
1625
+ {
1626
+ int i , j ;
1627
+
1628
+ /* Associate Tx queue with NAPI */
1629
+ for (i = 0 ; i < nv -> txt_count ; i ++ ) {
1630
+ struct fbnic_q_triad * qt = & nv -> qt [i ];
1631
+
1632
+ netif_queue_set_napi (nv -> napi .dev , qt -> sub0 .q_idx ,
1633
+ NETDEV_QUEUE_TYPE_TX , & nv -> napi );
1634
+ }
1635
+
1636
+ /* Associate Rx queue with NAPI */
1637
+ for (j = 0 ; j < nv -> rxt_count ; j ++ , i ++ ) {
1638
+ struct fbnic_q_triad * qt = & nv -> qt [i ];
1639
+
1640
+ netif_queue_set_napi (nv -> napi .dev , qt -> cmpl .q_idx ,
1641
+ NETDEV_QUEUE_TYPE_RX , & nv -> napi );
1642
+ }
1643
+ }
1644
+
1645
+ static void fbnic_reset_netif_napi (struct fbnic_napi_vector * nv )
1646
+ {
1647
+ int i , j ;
1648
+
1649
+ /* Disassociate Tx queue from NAPI */
1650
+ for (i = 0 ; i < nv -> txt_count ; i ++ ) {
1651
+ struct fbnic_q_triad * qt = & nv -> qt [i ];
1652
+
1653
+ netif_queue_set_napi (nv -> napi .dev , qt -> sub0 .q_idx ,
1654
+ NETDEV_QUEUE_TYPE_TX , NULL );
1655
+ }
1656
+
1657
+ /* Disassociate Rx queue from NAPI */
1658
+ for (j = 0 ; j < nv -> rxt_count ; j ++ , i ++ ) {
1659
+ struct fbnic_q_triad * qt = & nv -> qt [i ];
1660
+
1661
+ netif_queue_set_napi (nv -> napi .dev , qt -> cmpl .q_idx ,
1662
+ NETDEV_QUEUE_TYPE_RX , NULL );
1663
+ }
1664
+ }
1665
+
1666
+ int fbnic_set_netif_queues (struct fbnic_net * fbn )
1667
+ {
1668
+ int i , err ;
1669
+
1670
+ err = netif_set_real_num_queues (fbn -> netdev , fbn -> num_tx_queues ,
1671
+ fbn -> num_rx_queues );
1672
+ if (err )
1673
+ return err ;
1674
+
1675
+ for (i = 0 ; i < fbn -> num_napi ; i ++ )
1676
+ fbnic_set_netif_napi (fbn -> napi [i ]);
1677
+
1678
+ return 0 ;
1679
+ }
1680
+
1681
+ void fbnic_reset_netif_queues (struct fbnic_net * fbn )
1682
+ {
1683
+ int i ;
1684
+
1685
+ for (i = 0 ; i < fbn -> num_napi ; i ++ )
1686
+ fbnic_reset_netif_napi (fbn -> napi [i ]);
1687
+ }
1688
+
1624
1689
static void fbnic_disable_twq0 (struct fbnic_ring * txr )
1625
1690
{
1626
1691
u32 twq_ctl = fbnic_ring_rd32 (txr , FBNIC_QUEUE_TWQ0_CTL );
@@ -1801,10 +1866,6 @@ void fbnic_flush(struct fbnic_net *fbn)
1801
1866
tx_queue = netdev_get_tx_queue (nv -> napi .dev ,
1802
1867
qt -> sub0 .q_idx );
1803
1868
netdev_tx_reset_queue (tx_queue );
1804
-
1805
- /* Disassociate Tx queue from NAPI */
1806
- netif_queue_set_napi (nv -> napi .dev , qt -> sub0 .q_idx ,
1807
- NETDEV_QUEUE_TYPE_TX , NULL );
1808
1869
}
1809
1870
1810
1871
/* Flush any processed Rx Queue Triads and drop the rest */
@@ -1820,10 +1881,6 @@ void fbnic_flush(struct fbnic_net *fbn)
1820
1881
1821
1882
fbnic_put_pkt_buff (nv , qt -> cmpl .pkt , 0 );
1822
1883
qt -> cmpl .pkt -> buff .data_hard_start = NULL ;
1823
-
1824
- /* Disassociate Rx queue from NAPI */
1825
- netif_queue_set_napi (nv -> napi .dev , qt -> cmpl .q_idx ,
1826
- NETDEV_QUEUE_TYPE_RX , NULL );
1827
1884
}
1828
1885
}
1829
1886
}
@@ -1836,29 +1893,12 @@ void fbnic_fill(struct fbnic_net *fbn)
1836
1893
struct fbnic_napi_vector * nv = fbn -> napi [i ];
1837
1894
int j , t ;
1838
1895
1839
- /* Configure NAPI mapping for Tx */
1840
- for (t = 0 ; t < nv -> txt_count ; t ++ ) {
1841
- struct fbnic_q_triad * qt = & nv -> qt [t ];
1842
-
1843
- /* Nothing to do if Tx queue is disabled */
1844
- if (qt -> sub0 .flags & FBNIC_RING_F_DISABLED )
1845
- continue ;
1846
-
1847
- /* Associate Tx queue with NAPI */
1848
- netif_queue_set_napi (nv -> napi .dev , qt -> sub0 .q_idx ,
1849
- NETDEV_QUEUE_TYPE_TX , & nv -> napi );
1850
- }
1851
-
1852
1896
/* Configure NAPI mapping and populate pages
1853
1897
* in the BDQ rings to use for Rx
1854
1898
*/
1855
- for (j = 0 ; j < nv -> rxt_count ; j ++ , t ++ ) {
1899
+ for (j = 0 , t = nv -> txt_count ; j < nv -> rxt_count ; j ++ , t ++ ) {
1856
1900
struct fbnic_q_triad * qt = & nv -> qt [t ];
1857
1901
1858
- /* Associate Rx queue with NAPI */
1859
- netif_queue_set_napi (nv -> napi .dev , qt -> cmpl .q_idx ,
1860
- NETDEV_QUEUE_TYPE_RX , & nv -> napi );
1861
-
1862
1902
/* Populate the header and payload BDQs */
1863
1903
fbnic_fill_bdq (nv , & qt -> sub0 );
1864
1904
fbnic_fill_bdq (nv , & qt -> sub1 );
0 commit comments