@@ -1580,6 +1580,20 @@ static void fm10k_set_num_queues(struct fm10k_intfc *interface)
1580
1580
fm10k_set_rss_queues (interface );
1581
1581
}
1582
1582
1583
+ /**
1584
+ * fm10k_reset_num_queues - Reset the number of queues to zero
1585
+ * @interface: board private structure
1586
+ *
1587
+ * This function should be called whenever we need to reset the number of
1588
+ * queues after an error condition.
1589
+ */
1590
+ static void fm10k_reset_num_queues (struct fm10k_intfc * interface )
1591
+ {
1592
+ interface -> num_tx_queues = 0 ;
1593
+ interface -> num_rx_queues = 0 ;
1594
+ interface -> num_q_vectors = 0 ;
1595
+ }
1596
+
1583
1597
/**
1584
1598
* fm10k_alloc_q_vector - Allocate memory for a single interrupt vector
1585
1599
* @interface: board private structure to initialize
@@ -1763,9 +1777,7 @@ static int fm10k_alloc_q_vectors(struct fm10k_intfc *interface)
1763
1777
return 0 ;
1764
1778
1765
1779
err_out :
1766
- interface -> num_tx_queues = 0 ;
1767
- interface -> num_rx_queues = 0 ;
1768
- interface -> num_q_vectors = 0 ;
1780
+ fm10k_reset_num_queues (interface );
1769
1781
1770
1782
while (v_idx -- )
1771
1783
fm10k_free_q_vector (interface , v_idx );
@@ -1785,9 +1797,7 @@ static void fm10k_free_q_vectors(struct fm10k_intfc *interface)
1785
1797
{
1786
1798
int v_idx = interface -> num_q_vectors ;
1787
1799
1788
- interface -> num_tx_queues = 0 ;
1789
- interface -> num_rx_queues = 0 ;
1790
- interface -> num_q_vectors = 0 ;
1800
+ fm10k_reset_num_queues (interface );
1791
1801
1792
1802
while (v_idx -- )
1793
1803
fm10k_free_q_vector (interface , v_idx );
@@ -1995,14 +2005,15 @@ int fm10k_init_queueing_scheme(struct fm10k_intfc *interface)
1995
2005
if (err ) {
1996
2006
dev_err (& interface -> pdev -> dev ,
1997
2007
"Unable to initialize MSI-X capability\n" );
1998
- return err ;
2008
+ goto err_init_msix ;
1999
2009
}
2000
2010
2001
2011
/* Allocate memory for queues */
2002
2012
err = fm10k_alloc_q_vectors (interface );
2003
2013
if (err ) {
2004
- fm10k_reset_msix_capability (interface );
2005
- return err ;
2014
+ dev_err (& interface -> pdev -> dev ,
2015
+ "Unable to allocate queue vectors\n" );
2016
+ goto err_alloc_q_vectors ;
2006
2017
}
2007
2018
2008
2019
/* Map rings to devices, and map devices to physical queues */
@@ -2012,6 +2023,12 @@ int fm10k_init_queueing_scheme(struct fm10k_intfc *interface)
2012
2023
fm10k_init_reta (interface );
2013
2024
2014
2025
return 0 ;
2026
+
2027
+ err_alloc_q_vectors :
2028
+ fm10k_reset_msix_capability (interface );
2029
+ err_init_msix :
2030
+ fm10k_reset_num_queues (interface );
2031
+ return err ;
2015
2032
}
2016
2033
2017
2034
/**
0 commit comments