i40e-shared: fix up recent proxy and wol bits for X722_SUPPORT
Subsystems (2)
PATCH 1/4 i40e-shared: fix up recent proxy and wol bits for X722_SUPPORT
From: Shannon Nelson <[email protected]>
Some opcodes added & reordered to be in numerical order with the rest of the opcodes.
This patch adds admin queue structs to support Wake on LAN feature for X722.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 65 +++++++++++++++++++++- .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 65 +++++++++++++++++++++- 2 files changed, 128 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +64 -1
@@ -132,6 +132,10 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_list_func_capabilities =0x000A , i40e_aqc_opc_list_dev_capabilities =0x000B , +/* Proxy commands */ + i40e_aqc_opc_set_proxy_config =0x0104 , + i40e_aqc_opc_set_ns_proxy_table_entry =0x0105 , +/* LAA */ i40e_aqc_opc_mac_address_read =0x0107 , i40e_aqc_opc_mac_address_write = 0x0108,
@@ -139,6 +143,10 @@ enum i40e_admin_queue_opc {/* PXE */ i40e_aqc_opc_clear_pxe_mode =0x0110 , +/* WoL commands */ + i40e_aqc_opc_set_wol_filter =0x0120 , + i40e_aqc_opc_get_wake_reason =0x0121 , +/* internal switch commands */ i40e_aqc_opc_get_switch_config =0x0200 , i40e_aqc_opc_add_statistics = 0x0201,
@@ -177,6 +185,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_remove_control_packet_filter =0x025B , i40e_aqc_opc_add_cloud_filters =0x025C , i40e_aqc_opc_remove_cloud_filters =0x025D , + i40e_aqc_opc_clear_wol_switch_filters =0x025E , i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule = 0x0261,
@@ -563,6 +572,56 @@ struct i40e_aqc_clear_pxe {I40E_CHECK_CMD_LENGTH (i40e_aqc_clear_pxe); +/* Set WoL Filter (0x0120) */ + +struct i40e_aqc_set_wol_filter { +__le16 filter_index; +#define I40E_AQC_MAX_NUM_WOL_FILTERS 8 +#define I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_SHIFT 15 +#define I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_MASK (0x1 << \ + I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_SHIFT) + +#define I40E_AQC_SET_WOL_FILTER_INDEX_SHIFT 0 +#define I40E_AQC_SET_WOL_FILTER_INDEX_MASK (0x7 << \ + I40E_AQC_SET_WOL_FILTER_INDEX_SHIFT) +__le16 cmd_flags; +#define I40E_AQC_SET_WOL_FILTER 0x8000 +#define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000 +#define I40E_AQC_SET_WOL_FILTER_ACTION_CLEAR 0 +#define I40E_AQC_SET_WOL_FILTER_ACTION_SET 1 +__le16 valid_flags; +#define I40E_AQC_SET_WOL_FILTER_ACTION_VALID 0x8000 +#define I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID 0x4000 +u8 reserved[2 ]; +__le32 address_high; +__le32 address_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_set_wol_filter); + +struct i40e_aqc_set_wol_filter_data { +u8 filter[128 ]; +u8 mask[16 ]; +}; + +I40E_CHECK_STRUCT_LEN (0x90 , i40e_aqc_set_wol_filter_data); + +/* Get Wake Reason (0x0121) */ + +struct i40e_aqc_get_wake_reason_completion { +u8 reserved_1[2 ]; +__le16 wake_reason; +#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT 0 +#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_MASK (0xFF << \ + I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT) +#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT 8 +#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_MASK (0xFF << \ + I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT) +u8 reserved_2[12 ]; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_get_wake_reason_completion); +/* Switch configuration commands (0x02xx) */ /* Used by many indirect commands that only pass an seid and a buffer in the
@@ -645,6 +704,8 @@ struct i40e_aqc_set_port_parameters {#define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS 2/* must set! */ #define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA 4__le16 bad_frame_vsi; +#define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_SHIFT 0x0 +#define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_MASK 0x3FF__le16 default_seid;/* reserved for command */ u8 reserved[10 ]; };
@@ -696,6 +757,7 @@ I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp);/* Set Switch Configuration (direct 0x0205) */ struct i40e_aqc_set_switch_config {__le16 flags; +/* flags used for both fields below */ #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001#define I40E_AQ_SET_SWITCH_CFG_L2_FILTER 0x0002__le16 valid_flags;
@@ -1844,11 +1906,12 @@ struct i40e_aqc_get_link_status {#define I40E_AQ_CONFIG_FEC_RS_ENA 0x02#define I40E_AQ_CONFIG_CRC_ENA 0x04#define I40E_AQ_CONFIG_PACING_MASK 0x78 -u8 external_power_ability; +u8 power_desc;#define I40E_AQ_LINK_POWER_CLASS_1 0x00#define I40E_AQ_LINK_POWER_CLASS_2 0x01#define I40E_AQ_LINK_POWER_CLASS_3 0x02#define I40E_AQ_LINK_POWER_CLASS_4 0x03 +#define I40E_AQ_PWR_CLASS_MASK 0x03u8 reserved[4 ]; };
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +64 -1
111 lines not on this page · raw message
Signature · 1 line
2.4.11
PATCH 2/4 i40evf: add client interface
From: Mitch Williams <[email protected]>
In preparation for upcoming RDMA-capable hardware, add a client interface to the VF driver. This is a slightly-simplified version of the PF client interface, with the names changed to protect the innocent.
Due to the nature of the VF<->PF interactions, the client interface sometimes needs to call back into itself to pass messages. Because of this, we can't use the coarse-grained locking like the PF's client interface uses. Instead, we handle all client interactions in a separate thread so the watchdog can still run and process virtual channel messages.
--- drivers/net/ethernet/intel/i40evf/Makefile | 2 +- drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 33 ++ drivers/net/ethernet/intel/i40evf/i40evf.h | 24 +- drivers/net/ethernet/intel/i40evf/i40evf_client.c | 563 +++++++++++++++++++++ drivers/net/ethernet/intel/i40evf/i40evf_client.h | 166 ++++++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 83 ++- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 13 +- 7 files changed, 873 insertions(+), 11 deletions(-) create mode 100644 drivers/net/ethernet/intel/i40evf/i40evf_client.c create mode 100644 drivers/net/ethernet/intel/i40evf/i40evf_client.h
drivers/net/ethernet/intel/i40evf/Makefile +1 -1
@@ -32,5 +32,5 @@ obj-$(CONFIG_I40EVF) += i40evf.o i40evf-objs := i40evf_main.o i40evf_ethtool.o i40evf_virtchnl.o \ - i40e_txrx.o i40e_common.o i40e_adminq.o + i40e_txrx.o i40e_common.o i40e_adminq.o i40evf_client.o
drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h +33 -0
@@ -81,7 +81,9 @@ enum i40e_virtchnl_ops {I40E_VIRTCHNL_OP_GET_STATS =15 ,I40E_VIRTCHNL_OP_FCOE =16 ,I40E_VIRTCHNL_OP_EVENT =17 ,/* must ALWAYS be 17 */ +I40E_VIRTCHNL_OP_IWARP =20 ,I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP =21 , +I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP =22 ,I40E_VIRTCHNL_OP_CONFIG_RSS_KEY =23 ,I40E_VIRTCHNL_OP_CONFIG_RSS_LUT =24 , I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
@@ -393,6 +395,37 @@ struct i40e_virtchnl_pf_event {int severity; }; +/* I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP +* VF uses this message to request PF to map IWARP vectors to IWARP queues. +* The request for this originates from the VF IWARP driver through +* a client interface between VF LAN and VF IWARP driver. +* A vector could have an AEQ and CEQ attached to it although +* there is a single AEQ per VF IWARP instance in which case +* most vectors will have an INVALID_IDX for aeq and valid idx for ceq. +* There will never be a case where there will be multiple CEQs attached +* to a single vector. +* PF configures interrupt mapping and returns status. +*/ + +/* HW does not define a type value for AEQ; only for RX/TX and CEQ. +* In order for us to keep the interface simple, SW will define a +* unique type value for AEQ. +*/ +#define I40E_QUEUE_TYPE_PE_AEQ 0x80 +#define I40E_QUEUE_INVALID_IDX 0xFFFF + +struct i40e_virtchnl_iwarp_qv_info { +u32 v_idx;/* msix_vector */ +u16 ceq_idx; +u16 aeq_idx; +u8 itr_idx; +}; + +struct i40e_virtchnl_iwarp_qvlist_info { +u32 num_vectors; +struct i40e_virtchnl_iwarp_qv_info qv_info[1 ]; +}; +/* VF reset states - these are written into the RSTAT register: * I40E_VFGEN_RSTAT1 on the PF * I40E_VFGEN_RSTAT on the VF
drivers/net/ethernet/intel/i40evf/i40evf.h +20 -4
@@ -60,6 +60,7 @@ struct i40e_vsi {int base_vector;u16 work_limit;u16 qs_handle; +void *priv;/* client driver data reference. */ };/* How many Rx Buffers do we bundle into one write to the hardware ? */
@@ -169,6 +170,7 @@ enum i40evf_state_t {enum i40evf_critical_section_t { __I40EVF_IN_CRITICAL_TASK,/* cannot be interrupted */ + __I40EVF_IN_CLIENT_TASK, };/* make common code happy */ #define __I40E_DOWN __I40EVF_DOWN
@@ -178,6 +180,7 @@ struct i40evf_adapter {struct timer_list watchdog_timer;struct work_struct reset_task;struct work_struct adminq_task; +struct delayed_work client_task;struct delayed_work init_task;struct i40e_q_vector *q_vectors;struct list_head vlan_filter_list;
@@ -195,7 +198,10 @@ struct i40evf_adapter {u64 hw_csum_rx_error;u32 rx_desc_count;int num_msix_vectors; +int num_iwarp_msix; +int iwarp_base_vector;u32 client_pending; +struct i40e_client_instance *cinst;struct msix_entry *msix_entries;u32 flags;
@@ -211,8 +217,11 @@ struct i40evf_adapter {#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(12)#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(13)#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(14) -#define I40EVF_FLAG_PROMISC_ON BIT(15) -#define I40EVF_FLAG_ALLMULTI_ON BIT(16) +#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(15) +#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(16) +#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(17) +#define I40EVF_FLAG_PROMISC_ON BIT(18) +#define I40EVF_FLAG_ALLMULTI_ON BIT(19)/* duplicates for common code */ #define I40E_FLAG_FDIR_ATR_ENABLED 0#define I40E_FLAG_DCB_ENABLED 0
@@ -258,10 +267,11 @@ struct i40evf_adapter {bool link_up;enum i40e_aq_link_speed link_speed;enum i40e_virtchnl_ops current_op; -#define CLIENT_ENABLED (_a) ((_a)->vf_res ? \ +#define CLIENT_ALLOWED (_a) ((_a)->vf_res ? \ (_a)->vf_res->vf_offload_flags & \ I40E_VIRTCHNL_VF_OFFLOAD_IWARP : \ 0) +#define CLIENT_ENABLED (_a) ((_a)->cinst)/* RSS by the PF should be preferred over RSS via other methods. */ #define RSS_PF (_a) ((_a)->vf_res->vf_offload_flags & \ I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -292,6 +302,12 @@ struct i40evf_adapter {/* Ethtool Private Flags */ +/* lan device */ +struct i40e_device { +struct list_head list; +struct i40evf_adapter *vf; +}; +/* needed by i40evf_ethtool.c */ extern char i40evf_driver_name[];extern const char i40evf_driver_version[];
@@ -343,5 +359,5 @@ void i40evf_client_subtask(struct i40evf_adapter *adapter);void i40evf_notify_client_message (struct i40e_vsi *vsi,u8 *msg,u16 len);void i40evf_notify_client_l2_params (struct i40e_vsi *vsi);void i40evf_notify_client_open (struct i40e_vsi *vsi); -void i40evf_notify_client_close (struct i40e_vsi *vsi); +void i40evf_notify_client_close (struct i40e_vsi *vsi,bool reset);#endif /* _I40EVF_H_ */
drivers/net/ethernet/intel/i40evf/i40evf_client.c new file +563 -0
563 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_client.h new file +166 -0
166 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_main.c +78 -5
165 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +12 -1
@@ -26,6 +26,7 @@#include "i40evf.h" #include "i40e_prototype.h" +#include "i40evf_client.h" /* busy wait delay in msec */ #define I40EVF_BUSY_WAIT_DELAY 10
@@ -999,6 +1000,16 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,if (v_opcode != adapter->current_op)return ;break ; +case I40E_VIRTCHNL_OP_IWARP : +/* Gobble zero-length replies from the PF. They indicate that +* a previous message was received OK, and the client doesn't +* care about that. +*/ +if (msglen &&CLIENT_ENABLED (adapter)) +i40evf_notify_client_message (&adapter->vsi, + msg, msglen); +break ; +case I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP : adapter->client_pending &= ~(BIT (I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ));
@@ -1014,7 +1025,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, }break ;default : -if (v_opcode != adapter->current_op) +if (adapter->current_op && (v_opcode != adapter->current_op))dev_warn (&adapter->pdev->dev,"Expected response %d from PF, received %d\n" , adapter->current_op, v_opcode);break ;
Signature · 1 line
2.4.11
PATCH 3/4 i40e: KISS the client interface
In reply to Bimmy PujariFrom: Mitch Williams <[email protected]>
(KISS is Keep It Simple, Stupid. Or is it?)
The client interface vastly overengineered for what it needs to do. It was originally designed to support multiple clients on multiple netdevs, possibly even with multiple drivers. None of this happened, and now we know that there will only ever be one client for i40e (i40iw) and one for i40evf (i40iwvf). So, time for some KISS. Since i40e and i40evf are a Dynasty, we'll simplify this one to match the VF interface.
First, be a Destroyer and remove all of the lists and locks required to support multiple clients. Keep one static around to keep track of one client, and track the client instances for each netdev in the driver's pf (or adapter) struct. Now it's Almost Human.
Since we already know the client type is iWarp, get rid of any checks for this. Same for VSI type - it's always going to be the same type, so it's just a Parasite.
While we're at it, fix up some comments. This makes the function headers actually match the functions.
These changes reduce code complexity, simplify maintenance, squash some lurking timing bugs, and allow us to Rock and Roll All Nite.
--- drivers/net/ethernet/intel/i40e/i40e.h | 8 +- drivers/net/ethernet/intel/i40e/i40e_client.c | 457 +++++++-------------- drivers/net/ethernet/intel/i40e/i40e_client.h | 8 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 32 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +- 5 files changed, 179 insertions(+), 328 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +5 -3
@@ -387,8 +387,10 @@ struct i40e_pf {#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51)#define I40E_FLAG_HAVE_CRT_RETIMER BIT_ULL(52)#define I40E_FLAG_PTP_L4_CAPABLE BIT_ULL(53) -#define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(54) +#define I40E_FLAG_CLIENT_RESET BIT_ULL(54)#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55) +#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(56) +#define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(57)/* tracks features that get auto disabled by errors */ u64 auto_disable_flags;
@@ -397,6 +399,7 @@ struct i40e_pf {struct i40e_fcoe fcoe;#endif /* I40E_FCOE */ +struct i40e_client_instance *cinst;bool stat_offsets_loaded;struct i40e_hw_port_stats stats;struct i40e_hw_port_stats stats_offsets;
@@ -859,8 +862,7 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi);void i40e_notify_client_of_netdev_close (struct i40e_vsi *vsi,bool reset);void i40e_notify_client_of_vf_enable (struct i40e_pf *pf,u32 num_vfs);void i40e_notify_client_of_vf_reset (struct i40e_pf *pf,u32 vf_id); -int i40e_vf_client_capable (struct i40e_pf *pf,u32 vf_id, -enum i40e_client_type type); +int i40e_vf_client_capable (struct i40e_pf *pf,u32 vf_id);/** * i40e_irq_dynamic_enable - Enable default interrupt generation settings * @vsi: pointer to a vsi
drivers/net/ethernet/intel/i40e/i40e_client.c +150 -307
667 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_client.h +2 -6
@@ -57,11 +57,6 @@ enum i40e_client_instance_state { __I40E_CLIENT_INSTANCE_OPENED, }; -enum i40e_client_type { -I40E_CLIENT_IWARP , -I40E_CLIENT_VMDQ2 -}; -struct i40e_ops ;struct i40e_client ;
@@ -214,7 +209,8 @@ struct i40e_client {u32 flags;#define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)#define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2) -enum i40e_client_type type; +u8 type; +#define I40E_CLIENT_IWARP 0const struct i40e_client_ops *ops;/* client ops provided by the client */ };
drivers/net/ethernet/intel/i40e/i40e_main.c +21 -11
@@ -2500,6 +2500,7 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) {struct i40e_netdev_priv *np =netdev_priv (netdev);struct i40e_vsi *vsi = np->vsi; +struct i40e_pf *pf = vsi->back;if (i40e_enabled_xdp_vsi (vsi)) {int max_frame = new_mtu +ETH_HLEN +ETH_FCS_LEN +VLAN_HLEN ;
@@ -2513,7 +2514,8 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) netdev->mtu = new_mtu;if (netif_running (netdev))i40e_vsi_reinit_locked (vsi); -i40e_notify_client_of_l2_param_changes (vsi); + pf->flags |= (I40E_FLAG_SERVICE_CLIENT_REQUESTED | +I40E_FLAG_CLIENT_L2_CHANGE );return 0 ; }
@@ -4590,17 +4592,16 @@ static void i40e_napi_disable_all(struct i40e_vsi *vsi)**/ static void i40e_vsi_close (struct i40e_vsi *vsi) { -bool reset = false; - +struct i40e_pf *pf = vsi->back;if (!test_and_set_bit (__I40E_DOWN, &vsi->state))i40e_down (vsi);i40e_vsi_free_irq (vsi);i40e_vsi_free_tx_resources (vsi);i40e_vsi_free_rx_resources (vsi); vsi->current_netdev_flags =0 ; -if (test_bit (__I40E_RESET_RECOVERY_PENDING, &vsi->back->state)) - reset = true; -i40e_notify_client_of_netdev_close (vsi, reset); + pf->flags |=I40E_FLAG_SERVICE_CLIENT_REQUESTED ; +if (test_bit (__I40E_RESET_RECOVERY_PENDING, &pf->state)) + pf->flags |=I40E_FLAG_CLIENT_RESET ; }/**
@@ -5684,8 +5685,6 @@ void i40e_down(struct i40e_vsi *vsi)i40e_clean_rx_ring (vsi->rx_rings[i]); } -i40e_notify_client_of_netdev_close (vsi, false); - }/**
@@ -6182,8 +6181,8 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,i40e_service_event_schedule (pf); }else {i40e_pf_unquiesce_all_vsi (pf); -/* Notify the client for the DCB changes */ -i40e_notify_client_of_l2_param_changes (pf->vsi[pf->lan_vsi]); + pf->flags |= (I40E_FLAG_SERVICE_CLIENT_REQUESTED | +I40E_FLAG_CLIENT_L2_CHANGE ); } exit:
@@ -7573,7 +7572,18 @@ static void i40e_service_task(struct work_struct *work)i40e_vc_process_vflr_event (pf);i40e_watchdog_subtask (pf);i40e_fdir_reinit_subtask (pf); -i40e_client_subtask (pf); +if (pf->flags &I40E_FLAG_CLIENT_RESET ) { +/* Client subtask will reopen next time through. */ +i40e_notify_client_of_netdev_close (pf->vsi[pf->lan_vsi], true); + pf->flags &= ~I40E_FLAG_CLIENT_RESET ; + }else { +i40e_client_subtask (pf); +if (pf->flags &I40E_FLAG_CLIENT_L2_CHANGE ) { +i40e_notify_client_of_l2_param_changes ( + pf->vsi[pf->lan_vsi]); + pf->flags &= ~I40E_FLAG_CLIENT_L2_CHANGE ; + } + }i40e_sync_filters_subtask (pf);i40e_sync_udp_filters_subtask (pf);i40e_clean_adminq_subtask (pf);
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
@@ -1361,7 +1361,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)if (!vsi->info.pvid) vfres->vf_offload_flags |=I40E_VIRTCHNL_VF_OFFLOAD_VLAN ; -if (i40e_vf_client_capable (pf, vf->vf_id,I40E_CLIENT_IWARP ) && +if (i40e_vf_client_capable (pf, vf->vf_id) && (vf->driver_caps &I40E_VIRTCHNL_VF_OFFLOAD_IWARP )) { vfres->vf_offload_flags |=I40E_VIRTCHNL_VF_OFFLOAD_IWARP ;set_bit (I40E_VF_STAT_IWARPENA , &vf->vf_states);
Signature · 1 line
2.4.11
PATCH 4/4 i40e: don't add more vectors to num_lan_msix than number of CPUs
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
This is a solution to avoid adding too many queues to num_lan_msix. A recent refactor of queue pairs accidentally added all remaining vectors to the num_lan_msix which can have adverse performance issues, due to enabling more queues than the number of CPU cores.
This patch removes the old calculation, and replaces it with a simple algorithm.
1) add queue pairs up to num_online_cpus(), but capped at half of total vectors
2) then add alternative features such as flow directory and similar
3) finally, add the remaining vectors back to queue pairs, but capped such that the total number of queue pairs does not exceed num_online_cpus().
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +27 -3
@@ -8027,6 +8027,7 @@ static int i40e_reserve_msix_vectors(struct i40e_pf *pf, int vectors)static int i40e_init_msix (struct i40e_pf *pf) {struct i40e_hw *hw = &pf->hw; +int cpus, extra_vectors;int vectors_left;int v_budget, i;int v_actual;
@@ -8062,10 +8063,16 @@ static int i40e_init_msix(struct i40e_pf *pf) vectors_left--; } -/* reserve vectors for the main PF traffic queues */ - pf->num_lan_msix =min_t (int,num_online_cpus (), vectors_left); +/* reserve some vectors for the main PF traffic queues. Initially we +* only reserve at most 50% of the available vectors, in the case that +* the number of online CPUs is large. This ensures that we can enable +* extra features as well. Once we've enabled the other features, we +* will use any remaining vectors to reach as close as we can to the +* number of online CPUs. +*/ + cpus =num_online_cpus (); + pf->num_lan_msix =min_t (int, cpus, vectors_left /2 ); vectors_left -= pf->num_lan_msix; - v_budget += pf->num_lan_msix;/* reserve one vector for sideband flow director */ if (pf->flags &I40E_FLAG_FD_SB_ENABLED ) {
@@ -8128,6 +8135,23 @@ static int i40e_init_msix(struct i40e_pf *pf) } } +/* On systems with a large number of SMP cores, we previously limited +* the number of vectors for num_lan_msix to be at most 50% of the +* available vectors, to allow for other features. Now, we add back +* the remaining vectors. However, we ensure that the total +* num_lan_msix will not exceed num_online_cpus(). To do this, we +* calculate the number of vectors we can add without going over the +* cap of CPUs. For systems with a small number of CPUs this will be +* zero. +*/ + extra_vectors =min_t (int, cpus - pf->num_lan_msix, vectors_left); + pf->num_lan_msix += extra_vectors; + vectors_left -= extra_vectors; + +WARN (vectors_left <0 , +"Calculation of remaining vectors underflowed. This is an accounting bug when determining total MSI-X vectors.\n" ); + + v_budget += pf->num_lan_msix; pf->msix_entries =kcalloc (v_budget,sizeof (struct msix_entry ),GFP_KERNEL );if (!pf->msix_entries)
Signature · 1 line
2.4.11