Skip to content

Commit 5520deb

Browse files
mawilli1Jeff Kirsher
authored andcommitted
iavf: Enable support for up to 16 queues
Previous devices could only allocate 4 MSI-X vectors per VF so there was a limitation of 4 queues. 800-series hardware can allocate more than 4 MSI-X vectors, so expand the limitation on the number of queues that the driver can support to account for these capabilities. Fix ethtool channel operations to accommodate this change and adjust the reporting of max number of queues to what is given to us by the PF. Since we're not requesting queues above this value, just trigger reset to activate the queues, which we already own. Finally, fix a test condition that would display an incorrect error message. Signed-off-by: Mitch Williams <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent f3beaf2 commit 5520deb

File tree

4 files changed

+11
-40
lines changed

4 files changed

+11
-40
lines changed

drivers/net/ethernet/intel/iavf/iavf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct iavf_vsi {
8181
#define IAVF_TX_DESC(R, i) (&(((struct iavf_tx_desc *)((R)->desc))[i]))
8282
#define IAVF_TX_CTXTDESC(R, i) \
8383
(&(((struct iavf_tx_context_desc *)((R)->desc))[i]))
84-
#define IAVF_MAX_REQ_QUEUES 4
84+
#define IAVF_MAX_REQ_QUEUES 16
8585

8686
#define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4)
8787
#define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4)

drivers/net/ethernet/intel/iavf/iavf_ethtool.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ static void iavf_get_channels(struct net_device *netdev,
860860
struct iavf_adapter *adapter = netdev_priv(netdev);
861861

862862
/* Report maximum channels */
863-
ch->max_combined = IAVF_MAX_REQ_QUEUES;
863+
ch->max_combined = adapter->vsi_res->num_queue_pairs;
864864

865865
ch->max_other = NONQ_VECS;
866866
ch->other_count = NONQ_VECS;
@@ -881,14 +881,7 @@ static int iavf_set_channels(struct net_device *netdev,
881881
struct ethtool_channels *ch)
882882
{
883883
struct iavf_adapter *adapter = netdev_priv(netdev);
884-
int num_req = ch->combined_count;
885-
886-
if (num_req != adapter->num_active_queues &&
887-
!(adapter->vf_res->vf_cap_flags &
888-
VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)) {
889-
dev_info(&adapter->pdev->dev, "PF is not capable of queue negotiation.\n");
890-
return -EINVAL;
891-
}
884+
u32 num_req = ch->combined_count;
892885

893886
if ((adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) &&
894887
adapter->num_tc) {
@@ -899,14 +892,19 @@ static int iavf_set_channels(struct net_device *netdev,
899892
/* All of these should have already been checked by ethtool before this
900893
* even gets to us, but just to be sure.
901894
*/
902-
if (num_req <= 0 || num_req > IAVF_MAX_REQ_QUEUES)
895+
if (num_req > adapter->vsi_res->num_queue_pairs)
903896
return -EINVAL;
904897

898+
if (num_req == adapter->num_active_queues)
899+
return 0;
900+
905901
if (ch->rx_count || ch->tx_count || ch->other_count != NONQ_VECS)
906902
return -EINVAL;
907903

908904
adapter->num_req_queues = num_req;
909-
return iavf_request_queues(adapter, num_req);
905+
adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
906+
iavf_schedule_reset(adapter);
907+
return 0;
910908
}
911909

912910
/**

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3450,7 +3450,7 @@ int iavf_process_config(struct iavf_adapter *adapter)
34503450
}
34513451

34523452
if (num_req_queues &&
3453-
num_req_queues != adapter->vsi_res->num_queue_pairs) {
3453+
num_req_queues > adapter->vsi_res->num_queue_pairs) {
34543454
/* Problem. The PF gave us fewer queues than what we had
34553455
* negotiated in our request. Need a reset to see if we can't
34563456
* get back to a working state.

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -396,33 +396,6 @@ void iavf_map_queues(struct iavf_adapter *adapter)
396396
kfree(vimi);
397397
}
398398

399-
/**
400-
* iavf_request_queues
401-
* @adapter: adapter structure
402-
* @num: number of requested queues
403-
*
404-
* We get a default number of queues from the PF. This enables us to request a
405-
* different number. Returns 0 on success, negative on failure
406-
**/
407-
int iavf_request_queues(struct iavf_adapter *adapter, int num)
408-
{
409-
struct virtchnl_vf_res_request vfres;
410-
411-
if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
412-
/* bail because we already have a command pending */
413-
dev_err(&adapter->pdev->dev, "Cannot request queues, command %d pending\n",
414-
adapter->current_op);
415-
return -EBUSY;
416-
}
417-
418-
vfres.num_queue_pairs = min_t(int, num, num_online_cpus());
419-
420-
adapter->current_op = VIRTCHNL_OP_REQUEST_QUEUES;
421-
adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
422-
return iavf_send_pf_msg(adapter, VIRTCHNL_OP_REQUEST_QUEUES,
423-
(u8 *)&vfres, sizeof(vfres));
424-
}
425-
426399
/**
427400
* iavf_add_ether_addrs
428401
* @adapter: adapter structure

0 commit comments

Comments
 (0)