Enable queue channel and cloud filter support on i40evf
Subsystems (2)
v2 cover Enable queue channel and cloud filter support on i40evf
This patch series enables the new mqprio hardware offload mechanism creating traffic classes on VFs for XL710 devices. The parameters needed to configure these traffic classes/queue channels are provides by the user via the tc tool. A maximum of four traffic classes can be created on each VF. This patch series also enables application of cloud filters to each of these traffic classes. The cloud filters are applied using the tc-flower classifier.
Example:
1. tc qdisc add dev vf0 root mqprio num_tc 4 map 0 0 0 0 1 2 2 3\
queues 2 at 0 2 at 2 1 at 4 1 at 5 hw 1 mode channel
2. tc qdisc add dev vf0 ingress
3. ethtool -K vf0 hw-tc-offload on
4. ip link set eth0 vf 0 spoofchk off
5. tc filter add dev vf0 protocol ip parent ffff: prio 1 flower dst_ip\
192.168.3.5/32 ip_proto udp dst_port 25 skip_sw hw_tc 2
Avinash Dayanand (6):
i40evf: Fix link up issue when queues are disabled
i40e: Enable ADq and create queue channel/s on VF
i40evf: Alloc queues for ADq on VF
i40e: Delete queue channel for ADq on VF
i40e: Service request to configure bandwidth for ADq on a VF
i40e: Add and delete cloud filter
Harshitha Ramamurthy (6):
virtchnl: Add virtchl structures to support queue channels i40evf : add ndo_setup_tc callback to i40evf
i40evf: Add support to configure bw via tc tool
virtchnl: Add a macro to check the size of a union
virtchnl: Add filter data structures
i40evf: Add support to apply cloud filters
drivers/net/ethernet/intel/i40e/i40e.h | 6 + drivers/net/ethernet/intel/i40e/i40e_main.c | 16 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1000 ++++++++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 20 + drivers/net/ethernet/intel/i40evf/i40evf.h | 72 ++ drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 6 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 797 +++++++++++++++- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 300 +++++- include/linux/avf/virtchnl.h | 107 ++- 10 files changed, 2232 insertions(+), 94 deletions(-)
Signature · 1 line
2.9.4
PATCH v2 1/12 i40evf: Fix link up issue when queues are disabled
One of the previous patch fixes the link up issue by ignoring it if i40evf is not in __I40EVF_RUNNING state. However this doesn't fix the race condition when queues are disabled esp for ADq on VF. Hence check if all queues are enabled before starting all queues.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 1 + .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 28 +++++++++++++++------- 3 files changed, 22 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -0
@@ -240,6 +240,7 @@ struct i40evf_adapter {#define I40EVF_FLAG_ALLMULTI_ON BIT(14)#define I40EVF_FLAG_LEGACY_RX BIT(15)#define I40EVF_FLAG_REINIT_ITR_NEEDED BIT(16) +#define I40EVF_FLAG_QUEUES_DISABLED BIT(17)/* duplicates for common code */ #define I40E_FLAG_DCB_ENABLED 0#define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -0
@@ -1895,6 +1895,7 @@ static void i40evf_reset_task(struct work_struct *work)i40evf_free_all_rx_resources (adapter);i40evf_free_all_tx_resources (adapter); + adapter->flags |=I40EVF_FLAG_QUEUES_DISABLED ;/* kill and reinit the admin queue */ i40evf_shutdown_adminq (hw); adapter->current_op =VIRTCHNL_OP_UNKNOWN ;
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +20 -8
@@ -1017,14 +1017,25 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,if (adapter->link_up == link_up)break ; -/* If we get link up message and start queues before -* our queues are configured it will trigger a TX hang. -* In that case, just ignore the link status message, -* we'll get another one after we enable queues and -* actually prepared to send traffic. -*/ -if (link_up && adapter->state != __I40EVF_RUNNING) -break ; +if (link_up) { +/* If we get link up message and start queues +* before our queues are configured it will +* trigger a TX hang. In that case, just ignore +* the link status message,we'll get another one +* after we enable queues and actually prepared +* to send traffic. +*/ +if (adapter->state != __I40EVF_RUNNING) +break ; + +/* For ADq enabled VF, we reconfigure VSIs and +* re-allocate queues. Hence wait till all +* queues are enabled. +*/ +if (adapter->flags & +I40EVF_FLAG_QUEUES_DISABLED ) +break ; + } adapter->link_up = link_up;if (link_up) {
@@ -1108,6 +1119,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,case VIRTCHNL_OP_ENABLE_QUEUES :/* enable transmits */ i40evf_irq_enable (adapter, true); + adapter->flags &= ~I40EVF_FLAG_QUEUES_DISABLED ;break ;case VIRTCHNL_OP_DISABLE_QUEUES :i40evf_free_all_tx_resources (adapter);
Signature · 1 line
2.9.4
Bowers
PATCH v2 1/12 i40evf: Fix link up issue when queues are disabled
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 01/12] i40evf: Fix link up issue when queues are disabledOne of the previous patch fixes the link up issue by ignoring it if i40evf is not in
__I40EVF_RUNNINGstate. However this doesn't fix the race condition when queues are disabled esp for ADq on VF. Hence check if all queues are enabled before starting all queues.
Quoted 7 lines
Signed-off-by Avinash Dayanand <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 1 + .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 28 +++++++++++++++----- -- 3 files changed, 22 insertions(+), 8 deletions(-)
PATCH v2 2/12 virtchnl: Add virtchl structures to support queue channels
In reply to Avinash DayanandFrom: Harshitha Ramamurthy <[email protected]>
This patch defines new structs in support of the virtchannel message that the VF sends to the PF to create a queue channel specified by the user via tc tool.
v2: Fixed structure hole on 32 bit systems.
--- include/linux/avf/virtchnl.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
include/linux/avf/virtchnl.h +40 -0
@@ -136,6 +136,8 @@ enum virtchnl_ops {VIRTCHNL_OP_ENABLE_VLAN_STRIPPING =27 ,VIRTCHNL_OP_DISABLE_VLAN_STRIPPING =28 ,VIRTCHNL_OP_REQUEST_QUEUES =29 , +VIRTCHNL_OP_ENABLE_CHANNELS =30 , + VIRTCHNL_OP_DISABLE_CHANNELS = 31, };/* This macro is used to generate a compilation error if a structure
@@ -244,6 +246,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000 +#define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ VIRTCHNL_VF_OFFLOAD_VLAN | \
@@ -496,6 +499,30 @@ struct virtchnl_rss_hena {VIRTCHNL_CHECK_STRUCT_LEN (8 , virtchnl_rss_hena); +/* VIRTCHNL_OP_ENABLE_CHANNELS +* VIRTCHNL_OP_DISABLE_CHANNELS +* VF sends these messages to enable or disable channels based on +* the user specified queue count and queue offset for each traffic class. +* This struct encompasses all the information that the PF needs from +* VF to create a channel. +*/ +struct virtchnl_channel_info { +u16 count;/* number of queues in a channel */ +u16 offset;/* queues in a channel start from 'offset' */ +u32 pad; +u64 max_tx_rate; +}; + +VIRTCHNL_CHECK_STRUCT_LEN (16 , virtchnl_channel_info); + +struct virtchnl_tc_info { +u32 num_tc; +u32 pad; +struct virtchnl_channel_info list[1 ]; +}; + +VIRTCHNL_CHECK_STRUCT_LEN (24 , virtchnl_tc_info); +/* VIRTCHNL_OP_EVENT * PF sends this message to inform the VF driver of events that may affect it. * No direct response is expected from the VF, though it may generate other
@@ -711,6 +738,19 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,case VIRTCHNL_OP_REQUEST_QUEUES : valid_len =sizeof (struct virtchnl_vf_res_request );break ; +case VIRTCHNL_OP_ENABLE_CHANNELS : + valid_len =sizeof (struct virtchnl_tc_info ); +if (msglen >= valid_len) { +struct virtchnl_tc_info *vti = + (struct virtchnl_tc_info *)msg; + valid_len += vti->num_tc * +sizeof (struct virtchnl_channel_info ); +if (vti->num_tc ==0 ) + err_msg_format = true; + } +break ; +case VIRTCHNL_OP_DISABLE_CHANNELS : +break ;/* These are always errors coming from the VF. */ case VIRTCHNL_OP_EVENT :case VIRTCHNL_OP_UNKNOWN :
Signature · 1 line
2.9.4
Bowers
PATCH v2 2/12 virtchnl: Add virtchl structures to support queue channels
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 02/12] virtchnl: Add virtchl structures to support queue channelsFrom: Harshitha Ramamurthy <[email protected]>
This patch defines new structs in support of the virtchannel message that the VF sends to the PF to create a queue channel specified by the user via tc tool.
Quoted 7 lines
v2: Fixed structure hole on 32 bit systems.
Signed-off-by Harshitha Ramamurthy <[email protected]>--- include/linux/avf/virtchnl.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
PATCH v2 3/12 i40evf : add ndo_setup_tc callback to i40evf
In reply to Avinash DayanandFrom: Harshitha Ramamurthy <[email protected]>
This patch introduces the callback to the ndo_setup_tc function in the VF driver. We add a wrapper function to make room for the upcoming cloud filter patches which add calls to different functions from setup_tc.
First, we add support for capability exchange for ADQ between the PF and VF. Next, we add support to take in the mqprio configuration and configure queues as per the traffic classes, rate limit and the priorities specified by the user. This is done by passing the channel config to the PF driver through a virtchannel message.
The flags and bits added, track if ADq is enabled, set max number of traffic classes to 4 and provide ability to negotiate capability with the PF.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 22 +++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 154 +++++++++++++++++++++ .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 82 ++++++++++- 3 files changed, 257 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +22 -0
@@ -52,6 +52,7 @@#include <linux/socket.h> #include <linux/jiffies.h> #include <net/ip6_checksum.h> +#include <net/pkt_cls.h> #include <net/udp.h> #include "i40e_type.h"
@@ -168,6 +169,20 @@ struct i40evf_vlan_filter {bool add;/* filter needs to be added */ }; +#define I40EVF_MAX_TRAFFIC_CLASS 4 +/* State of traffic class creation */ +enum i40evf_tc_state_t { + __I40EVF_TC_INVALID,/* no traffic class, default state */ + __I40EVF_TC_RUNNING,/* traffic classes have been created */ +}; + +/* channel info */ +struct i40evf_channel_config { +struct virtchnl_channel_info ch_info[I40EVF_MAX_TRAFFIC_CLASS ]; +enum i40evf_tc_state_t state; +u8 total_qps; +}; +/* Driver state. The order of these is important! */ enum i40evf_state_t { __I40EVF_STARTUP,/* driver loaded, probe complete */
@@ -269,6 +284,8 @@ struct i40evf_adapter {#define I40EVF_FLAG_AQ_RELEASE_ALLMULTI BIT(18)#define I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING BIT(19)#define I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING BIT(20) +#define I40EVF_FLAG_AQ_ENABLE_CHANNELS BIT(21) +#define I40EVF_FLAG_AQ_DISABLE_CHANNELS BIT(22)/* OS defined structs */ struct net_device *netdev;
@@ -314,6 +331,9 @@ struct i40evf_adapter {u16 rss_lut_size;u8 *rss_key;u8 *rss_lut; +/* ADQ related members */ +struct i40evf_channel_config ch_config; +u8 num_tc; };
@@ -380,4 +400,6 @@ 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,bool reset); +void i40evf_enable_channels (struct i40evf_adapter *adapter); +void i40evf_disable_channels (struct i40evf_adapter *adapter);#endif /* _I40EVF_H_ */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +154 -0
172 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +81 -1
100 lines not on this page · raw message
Signature · 1 line
2.9.4
Bowers
PATCH v2 3/12 i40evf : add ndo_setup_tc callback to i40evf
Quoted 23 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 03/12] i40evf : addndo_setup_tccallback to i40evfFrom: Harshitha Ramamurthy <[email protected]>
This patch introduces the callback to the
ndo_setup_tcfunction in the VF driver. We add a wrapper function to make room for the upcoming cloud filter patches which add calls to different functions fromsetup_tc.First, we add support for capability exchange for ADQ between the PF and VF. Next, we add support to take in the mqprio configuration and configure queues as per the traffic classes, rate limit and the priorities specified by the user. This is done by passing the channel config to the PF driver through a virtchannel message.
The flags and bits added, track if ADq is enabled, set max number of traffic classes to 4 and provide ability to negotiate capability with the PF.
Quoted 7 lines
Signed-off-by Harshitha Ramamurthy <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf.h | 22 +++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 154 +++++++++++++++++++++ .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 82 ++++++++++- 3 files changed, 257 insertions(+), 1 deletion(-)
PATCH v2 4/12 i40e: Enable ADq and create queue channel/s on VF
In reply to Avinash DayanandThis patch enables ADq and creates queue channels on a VF. An ADq enabled VF can have upto 4 VSIs and each one of them represents a traffic class and this is termed as a queue channel. Each of these VSIs can have up to 4 queues. This patch services the request for enabling ADq and adds queue channel based on the TC mqprio info provided by the user in the VF.
Initially a check is made to see if spoof check is OFF, if not ADq will not be enabled. PF notifies VF for a reset in order to complete the creation of ADq resources i.e. creation of additional VSIs and allocation of queues as per TC information, all in the reset path.
Steps:
======
1. Turn off the spoof check
2. Enable ADq using tc mqprio command with or without rate limit.
3. Pass traffic.
Example:
========
% ip link set dev eth0 vf 0 spoofchk off
% tc qdisc add dev $iface root mqprio num_tc 4 map\ 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 queues\ 4 at 0 4 at 4 4 at 8 4 at 8 hw 1 mode channel
Expected results:
=================
1. Total number of queues for the VF should be sum of queues of all TCs.
2. Traffic flow should be normal without errors.
--- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 429 +++++++++++++++++---- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 17 + 3 files changed, 379 insertions(+), 69 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -1
@@ -39,7 +39,7 @@#define I40E_MASK (mask, shift) ((u32)(mask) << (shift))#define I40E_MAX_VSI_QP 16 -#define I40E_MAX_VF_VSI 3 +#define I40E_MAX_VF_VSI 4#define I40E_MAX_CHAINED_RX_BUFFERS 5#define I40E_MAX_PF_UDP_OFFLOAD_PORTS 16
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +361 -68
606 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +17 -0
@@ -69,6 +69,18 @@ enum i40e_vf_capabilities { I40E_VIRTCHNL_VF_CAP_IWARP, }; +/* In ADq, max 4 VSI's can be allocated per VF including primary VF VSI. +* These variables are used to store indices, id's and number of queues +* for each VSI including that of primary VF VSI. Each Traffic class is +* termed as channel and each channel can in-turn have 4 queues which +* means max 16 queues overall per VF. +*/ +struct i40evf_channel { +u16 vsi_idx;/* index in PF struct for all channel VSIs */ +u16 vsi_id;/* VSI ID used by firmware */ +u16 num_qps;/* number of queue pairs requested by user */ +}; +/* VF information structure */ struct i40e_vf {struct i40e_pf *pf;
@@ -111,6 +123,11 @@ struct i40e_vf {u16 num_mac;u16 num_vlan; +/* ADq related variables */ +bool adq_enabled;/* flag to enable adq */ +u8 num_tc; +struct i40evf_channel ch[I40E_MAX_VF_VSI ]; +/* RDMA Client */ struct virtchnl_iwarp_qvlist_info *qvlist_info; };
Signature · 1 line
2.9.4
Bowers
PATCH v2 4/12 i40e: Enable ADq and create queue channel/s on VF
Quoted 37 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 04/12] i40e: Enable ADq and create queue channel/s on VFThis patch enables ADq and creates queue channels on a VF. An ADq enabled VF can have upto 4 VSIs and each one of them represents a traffic class and this is termed as a queue channel. Each of these VSIs can have up to 4 queues. This patch services the request for enabling ADq and adds queue channel based on the TC mqprio info provided by the user in the VF.
Initially a check is made to see if spoof check is OFF, if not ADq will not be enabled. PF notifies VF for a reset in order to complete the creation of ADq resources i.e. creation of additional VSIs and allocation of queues as per TC information, all in the reset path.
Steps:
======
1. Turn off the spoof check
2. Enable ADq using tc mqprio command with or without rate limit.
3. Pass traffic.Example:
========
% ip link set dev eth0 vf 0 spoofchk off % tc qdisc add dev $iface root mqprionum_tc 4 map\ 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 queues\ 4 at 0 4 at 4 4 at 8 4 at 8 hw 1 mode channelExpected results:
=================
1. Total number of queues for the VF should be sum of queues of all TCs.
2. Traffic flow should be normal without errors.
Quoted 7 lines
Signed-off-by Avinash Dayanand <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 429 +++++++++++++++++---- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 17 + 3 files changed, 379 insertions(+), 69 deletions(-)
PATCH v2 5/12 i40evf: Alloc queues for ADq on VF
In reply to Avinash DayanandThis patch allocates number of queues requested by the user as a part of TC command when ADq is enabled on a VF.
In order to be consistent in design with PF implementation of ADq, don't allow to set channels via ethtool from VF when ADq is already enabled. This means the users will not be able to change the number of queues/channels via ethtool for a VF when ADq is ON. In order to be able to use set channels, users will be required to disable ADq first and then try setting the channels again.
When ADq is enabled on VF, it goes through a reset during which VSIs and queues are re-configured. Meanwhile if we receive link status message from PF even before the queues are re-configured, just ignore this link up message.
--- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 6 ++++++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+)
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +6 -0
@@ -695,6 +695,12 @@ static int i40evf_set_channels(struct net_device *netdev,return -EINVAL ; } +if ((adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && + adapter->num_tc) { +dev_info (&adapter->pdev->dev,"Cannot set channels since ADq is enabled.\n" ); +return -EINVAL ; + } +/* All of these should have already been checked by ethtool before this * even gets to us, but just to be sure. */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +14 -0
@@ -1146,6 +1146,9 @@ static int i40evf_alloc_queues(struct i40evf_adapter *adapter)*/ if (adapter->num_req_queues) num_active_queues = adapter->num_req_queues; +else if ((adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && + adapter->num_tc) + num_active_queues = adapter->ch_config.total_qps;else num_active_queues = min_t(int, adapter->vsi_res->num_queue_pairs,
@@ -1473,6 +1476,16 @@ int i40evf_init_interrupt_scheme(struct i40evf_adapter *adapter) goto err_alloc_q_vectors; } +/* If we've made it so far while ADq flag being ON, then we haven't +* bailed out anywhere in middle. And ADq isn't just enabled but actual +* resources have been allocated in the reset path. +* Now we can truly claim that ADq is enabled. +*/ +if ((adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && + adapter->num_tc) +dev_info (&adapter->pdev->dev,"ADq Enabled, %u TCs created" , + adapter->num_tc); +dev_info (&adapter->pdev->dev,"Multiqueue %s: Queue pair count = %u" , (adapter->num_active_queues >1 ) ?"Enabled" :"Disabled" , adapter->num_active_queues);
@@ -3244,6 +3257,7 @@ static void i40evf_remove(struct pci_dev *pdev)/* Shut down all the garbage mashers on the detention level */ adapter->state = __I40EVF_REMOVE; adapter->aq_required =0 ; + adapter->flags &= ~I40EVF_FLAG_REINIT_ITR_NEEDED ;i40evf_request_reset (adapter);msleep (50 );/* If the FW isn't responding, kick it once, but only once. */
Signature · 1 line
2.9.4
PATCH v2 6/12 i40e: Delete queue channel for ADq on VF
In reply to Avinash DayanandThis patch takes care of freeing up all the VSIs, queues and other ADq related software and hardware resources, when a user requests for deletion of ADq on VF.
Example command:
tc qdisc del dev eth0 root
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +63 -0
@@ -1673,6 +1673,27 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) }/** +* i40e_del_qch - delete all the additional VSI's created as a part of ADq +* @vf: pointer to VF structure +**/ +static void i40e_del_qch (struct i40e_vf *vf) +{ +struct i40e_pf *pf = vf->pf; +int i; + +/* first element in the array belongs to primary VF VSI and we shouldn't +* delete it. we should however delete the rest of the VSIs created +*/ +for (i =1 ; i < vf->num_tc; i++) { +if (vf->ch[i].vsi_idx) { +i40e_vsi_release (pf->vsi[vf->ch[i].vsi_idx]); + vf->ch[i].vsi_idx =0 ; + vf->ch[i].vsi_id =0 ; + } + } +} + +/** * i40e_vc_get_vf_resources_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer
@@ -2979,6 +3000,45 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg) }/** +* i40e_vc_del_qch_msg +* @vf: pointer to the VF info +* @msg: pointer to the msg buffer +**/ +static int i40e_vc_del_qch_msg (struct i40e_vf *vf,u8 *msg) +{ +struct i40e_pf *pf = vf->pf; +i40e_status aq_ret =0 ; + +if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { + aq_ret =I40E_ERR_PARAM ; + goto err; + } + +if (vf->adq_enabled) { +i40e_del_qch (vf); + vf->adq_enabled = false; + vf->num_tc =0 ; +dev_info (&pf->pdev->dev, +"Deleting Queue Channels for ADq on VF %d\n" , + vf->vf_id); + }else { +dev_info (&pf->pdev->dev,"VF %d trying to delete queue channels but ADq isn't enabled\n" , + vf->vf_id); + aq_ret =I40E_ERR_PARAM ; + } + +/* reset the VF in order to allocate resources */ +i40e_vc_notify_vf_reset (vf); +i40e_reset_vf (vf, false); + +return I40E_SUCCESS ; + +err: +return i40e_vc_send_resp_to_vf (vf,VIRTCHNL_OP_DISABLE_CHANNELS , + aq_ret); +} + +/** * i40e_vc_process_vf_msg * @pf: pointer to the PF structure * @vf_id: source VF id
@@ -3110,6 +3170,9 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,case VIRTCHNL_OP_ENABLE_CHANNELS : ret =i40e_vc_add_qch_msg (vf, msg);break ; +case VIRTCHNL_OP_DISABLE_CHANNELS : + ret =i40e_vc_del_qch_msg (vf, msg); +break ;case VIRTCHNL_OP_UNKNOWN :default : dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n",
Signature · 1 line
2.9.4
Bowers
PATCH v2 6/12 i40e: Delete queue channel for ADq on VF
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 06/12] i40e: Delete queue channel for ADq on VFThis patch takes care of freeing up all the VSIs, queues and other ADq related software and hardware resources, when a user requests for deletion of ADq on VF.
Quoted 8 lines
Example command:
tc qdisc del dev eth0 rootSigned-off-by Avinash Dayanand <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+)
PATCH v2 7/12 i40evf: Add support to configure bw via tc tool
In reply to Avinash DayanandFrom: Harshitha Ramamurthy <[email protected]>
This patch adds support to configure bandwidth for the traffic classes via tc tool. The required information is passed to the PF which is used in the process of setting up the traffic classes.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 66 +++++++++++++++++++++- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 + 3 files changed, 67 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -0
@@ -107,6 +107,7 @@ struct i40e_vsi {#define I40EVF_HKEY_ARRAY_SIZE ((I40E_VFQF_HKEY_MAX_INDEX + 1) * 4)#define I40EVF_HLUT_ARRAY_SIZE ((I40E_VFQF_HLUT_MAX_INDEX + 1) * 4) +#define I40EVF_MBPS_DIVISOR 125000/* divisor to convert to Mbps */ /* MAX_MSIX_Q_VECTORS of these are allocated, * but we only use one per queue-specific vector.
drivers/net/ethernet/intel/i40evf/i40evf_main.c +63 -3
104 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +3 -0
@@ -1003,6 +1003,9 @@ void i40evf_enable_channels(struct i40evf_adapter *adapter)for (i =0 ; i < vti->num_tc; i++) { vti->list[i].count = adapter->ch_config.ch_info[i].count; vti->list[i].offset = adapter->ch_config.ch_info[i].offset; + vti->list[i].pad =0 ; + vti->list[i].max_tx_rate = + adapter->ch_config.ch_info[i].max_tx_rate; } adapter->ch_config.state = __I40EVF_TC_RUNNING;
Signature · 1 line
2.9.4
Bowers
PATCH v2 7/12 i40evf: Add support to configure bw via tc tool
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 07/12] i40evf: Add support to configure bw via tc toolFrom: Harshitha Ramamurthy <[email protected]>
This patch adds support to configure bandwidth for the traffic classes via tc tool. The required information is passed to the PF which is used in the process of setting up the traffic classes.
Quoted 7 lines
Signed-off-by Harshitha Ramamurthy <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 66 +++++++++++++++++++++- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 + 3 files changed, 67 insertions(+), 3 deletions(-)
PATCH v2 8/12 i40e: Service request to configure bandwidth for ADq on a VF
In reply to Avinash DayanandThis patch handles the request from ADq enabled VF to allocate bandwidth to each traffic class which means for each VSI.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 56 ++++++++++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 1 + 2 files changed, 54 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +53 -3
@@ -711,6 +711,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, u8 idx)struct i40e_mac_filter *f =NULL ;struct i40e_pf *pf = vf->pf;struct i40e_vsi *vsi; +u64 max_tx_rate =0 ;int ret =0 ; vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid,
@@ -770,8 +771,15 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, u8 idx)/* Set VF bandwidth if specified */ if (vf->tx_rate) { + max_tx_rate = vf->tx_rate; + }else if (vf->ch[idx].max_tx_rate) { + max_tx_rate = vf->ch[idx].max_tx_rate; + } + +if (max_tx_rate) { + max_tx_rate =div_u64 (max_tx_rate,I40E_BW_CREDIT_DIVISOR ); ret =i40e_aq_config_vsi_bw_limit (&pf->hw, vsi->seid, - vf->tx_rate /50 ,0 ,NULL ); + max_tx_rate,0 ,NULL );if (ret)dev_err (&pf->pdev->dev,"Unable to set tx rate, VF %d, error code %d.\n" , vf->vf_id, ret);
@@ -2918,7 +2926,8 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)struct virtchnl_tc_info *tci = (struct virtchnl_tc_info *)msg;struct i40e_pf *pf = vf->pf; -int i, adq_request_qps =0 ; +struct i40e_link_status *ls = &pf->hw.phy.link_info; +int i, adq_request_qps =0 , speed =0 ;i40e_status aq_ret =0 ;if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) {
@@ -2979,10 +2988,51 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg) vf->num_queue_pairs =I40E_MAX_VF_QUEUES ; } +/* get link speed in MB to validate rate limit */ +switch (ls->link_speed) { +case VIRTCHNL_LINK_SPEED_100MB : + speed =SPEED_100 ; +break ; +case VIRTCHNL_LINK_SPEED_1GB : + speed =SPEED_1000 ; +break ; +case VIRTCHNL_LINK_SPEED_10GB : + speed =SPEED_10000 ; +break ; +case VIRTCHNL_LINK_SPEED_20GB : + speed =SPEED_20000 ; +break ; +case VIRTCHNL_LINK_SPEED_25GB : + speed =SPEED_25000 ; +break ; +case VIRTCHNL_LINK_SPEED_40GB : + speed =SPEED_40000 ; +break ; +default : +dev_err (&pf->pdev->dev, +"Cannot detect link speed\n" ); + aq_ret =I40E_ERR_PARAM ; + goto err; + } +/* parse data from the queue channel info */ vf->num_tc = tci->num_tc; -for (i =0 ; i < vf->num_tc; i++) +for (i =0 ; i < vf->num_tc; i++) { +if (tci->list[i].max_tx_rate) { +if (tci->list[i].max_tx_rate > speed) { +dev_err (&pf->pdev->dev, +"Invalid max tx rate %llu specified for VF %d." , + tci->list[i].max_tx_rate, + vf->vf_id); + aq_ret =I40E_ERR_PARAM ; + goto err; + }else { + vf->ch[i].max_tx_rate = + tci->list[i].max_tx_rate; + } + } vf->ch[i].num_qps = tci->list[i].count; + }/* set this flag only after making sure all inputs are sane */ vf->adq_enabled = true;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +1 -0
@@ -79,6 +79,7 @@ struct i40evf_channel {u16 vsi_idx;/* index in PF struct for all channel VSIs */ u16 vsi_id;/* VSI ID used by firmware */ u16 num_qps;/* number of queue pairs requested by user */ +u64 max_tx_rate;/* bandwidth rate allocation for VSIs */ };/* VF information structure */
Signature · 1 line
2.9.4
Bowers
PATCH v2 8/12 i40e: Service request to configure bandwidth for ADq on a VF
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 08/12] i40e: Service request to configure bandwidth for ADq on a VFThis patch handles the request from ADq enabled VF to allocate bandwidth to each traffic class which means for each VSI.
Quoted 6 lines
Signed-off-by Avinash Dayanand <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 56 ++++++++++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 1 + 2 files changed, 54 insertions(+), 3 deletions(-)
PATCH v2 9/12 virtchnl: Add a macro to check the size of a union
In reply to Avinash DayanandFrom: Harshitha Ramamurthy <[email protected]>
This patch adds a macro to check if the size of a union is correct. It throws a divide by zero error if the union is not of the correct size.
--- include/linux/avf/virtchnl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
include/linux/avf/virtchnl.h +5 -3
@@ -140,13 +140,15 @@ enum virtchnl_ops { VIRTCHNL_OP_DISABLE_CHANNELS = 31, }; -/* This macro is used to generate a compilation error if a structure +/* These macros are used to generate compilation errors if a structure/union * is not exactly the correct length. It gives a divide by zero error if the -* structure is not of the correct size, otherwise it creates an enum that is -* never used. +* structure/union is not of the correct size, otherwise it creates an enum +* that is never used. */ #define VIRTCHNL_CHECK_STRUCT_LEN (n,X ) enum virtchnl_static_assert_enum_##X \ { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) } +#define VIRTCHNL_CHECK_UNION_LEN (n,X ) enum virtchnl_static_asset_enum_##X \ + { virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }/* Virtual channel message descriptor. This overlays the admin queue * descriptor. All other data is passed in external buffers.
Signature · 1 line
2.9.4
Bowers
PATCH v2 9/12 virtchnl: Add a macro to check the size of a union
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 09/12] virtchnl: Add a macro to check the size of a unionFrom: Harshitha Ramamurthy <[email protected]>
Quoted 7 lines
This patch adds a macro to check if the size of a union is correct. It throws a divide by zero error if the union is not of the correct size.
Signed-off-by Harshitha Ramamurthy <[email protected]>--- include/linux/avf/virtchnl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
PATCH v2 10/12 virtchnl: Add filter data structures
In reply to Avinash DayanandFrom: Harshitha Ramamurthy <[email protected]>
This patch adds infrastructure to send virtchnl messages to the PF to configure filters on the VF. The patch adds a struct called virtchnl_filter which contains information about the fields in the user-specified tc filter.
--- include/linux/avf/virtchnl.h | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
include/linux/avf/virtchnl.h +59 -0
@@ -138,6 +138,8 @@ enum virtchnl_ops {VIRTCHNL_OP_REQUEST_QUEUES =29 ,VIRTCHNL_OP_ENABLE_CHANNELS =30 ,VIRTCHNL_OP_DISABLE_CHANNELS =31 , +VIRTCHNL_OP_ADD_CLOUD_FILTER =32 , + VIRTCHNL_OP_DEL_CLOUD_FILTER = 33, };/* These macros are used to generate compilation errors if a structure/union
@@ -525,6 +527,57 @@ struct virtchnl_tc_info {VIRTCHNL_CHECK_STRUCT_LEN (24 , virtchnl_tc_info); +/* VIRTCHNL_ADD_CLOUD_FILTER +* VIRTCHNL_DEL_CLOUD_FILTER +* VF sends these messages to add or delete a cloud filter based on the +* user specified match and action filters. These structures encompass +* all the information that the PF needs from the VF to add/delete a +* cloud filter. +*/ + +struct virtchnl_l4_spec { +u8 src_mac[ETH_ALEN ]; +u8 dst_mac[ETH_ALEN ]; +__be16 vlan_id; +__be16 pad;/* reserved for future use */ +__be32 src_ip[4 ]; +__be32 dst_ip[4 ]; +__be16 src_port; +__be16 dst_port; +}; + +VIRTCHNL_CHECK_STRUCT_LEN (52 , virtchnl_l4_spec); + +union virtchnl_flow_spec { +struct virtchnl_l4_spec tcp_spec; +u8 buffer[128 ];/* reserved for future use */ +}; + +VIRTCHNL_CHECK_UNION_LEN (128 , virtchnl_flow_spec); + +enum virtchnl_action { +/* action types */ +VIRTCHNL_ACTION_DROP =0 , +VIRTCHNL_ACTION_TC_REDIRECT , +}; + +enum virtchnl_flow_type { +/* flow types */ +VIRTCHNL_TCP_V4_FLOW =0 , +VIRTCHNL_TCP_V6_FLOW , +}; + +struct virtchnl_filter { +union virtchnl_flow_spec data; +union virtchnl_flow_spec mask; +enum virtchnl_flow_type flow_type; +enum virtchnl_action action; +u32 action_meta; +__u8 field_flags; +}; + +VIRTCHNL_CHECK_STRUCT_LEN (272 , virtchnl_filter); +/* VIRTCHNL_OP_EVENT * PF sends this message to inform the VF driver of events that may affect it. * No direct response is expected from the VF, though it may generate other
@@ -753,6 +806,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,break ;case VIRTCHNL_OP_DISABLE_CHANNELS :break ; +case VIRTCHNL_OP_ADD_CLOUD_FILTER : + valid_len =sizeof (struct virtchnl_filter ); +break ; +case VIRTCHNL_OP_DEL_CLOUD_FILTER : + valid_len =sizeof (struct virtchnl_filter ); +break ;/* These are always errors coming from the VF. */ case VIRTCHNL_OP_EVENT :case VIRTCHNL_OP_UNKNOWN :
Signature · 1 line
2.9.4
Bowers
PATCH v2 10/12 virtchnl: Add filter data structures
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 10/12] virtchnl: Add filter data structuresFrom: Harshitha Ramamurthy <[email protected]>
This patch adds infrastructure to send virtchnl messages to the PF to configure filters on the VF. The patch adds a struct called
virtchnl_filterwhich contains information about the fields in the user-specified tc filter.
Quoted 5 lines
Signed-off-by Harshitha Ramamurthy <[email protected]>--- include/linux/avf/virtchnl.h | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
PATCH v2 11/12 i40evf: Add support to apply cloud filters
In reply to Avinash DayanandFrom: Harshitha Ramamurthy <[email protected]>
This patch enables a tc filter to be applied as a cloud filter for the VF. This patch adds functions which parse the tc filter, extract the necessary fields needed to configure the filter and package them in a virtchnl message to be sent to the PF to apply them.
v2: made i40evf_print_cloud_filter function static.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 48 ++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 574 ++++++++++++++++++++- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 187 +++++++ 3 files changed, 805 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +48 -0
@@ -54,6 +54,8 @@#include <net/ip6_checksum.h> #include <net/pkt_cls.h> #include <net/udp.h> +#include <net/tc_act/tc_gact.h> +#include <net/tc_act/tc_mirred.h> #include "i40e_type.h" #include <linux/avf/virtchnl.h>
@@ -184,6 +186,14 @@ struct i40evf_channel_config {u8 total_qps; }; +/* State of cloud filter */ +enum i40evf_cloud_filter_state_t { + __I40EVF_CF_INVALID,/* cloud filter not added */ + __I40EVF_CF_ADD_PENDING,/* cloud filter pending add by the PF */ + __I40EVF_CF_DEL_PENDING,/* cloud filter pending del by the PF */ + __I40EVF_CF_ACTIVE,/* cloud filter is active */ +}; +/* Driver state. The order of these is important! */ enum i40evf_state_t { __I40EVF_STARTUP,/* driver loaded, probe complete */
@@ -205,6 +215,36 @@ enum i40evf_critical_section_t { __I40EVF_IN_REMOVE_TASK, /* device being removed */ }; +#define I40EVF_CLOUD_FIELD_OMAC 0x01 +#define I40EVF_CLOUD_FIELD_IMAC 0x02 +#define I40EVF_CLOUD_FIELD_IVLAN 0x04 +#define I40EVF_CLOUD_FIELD_TEN_ID 0x08 +#define I40EVF_CLOUD_FIELD_IIP 0x10 + +#define I40EVF_CF_FLAGS_OMAC I40EVF_CLOUD_FIELD_OMAC +#define I40EVF_CF_FLAGS_IMAC I40EVF_CLOUD_FIELD_IMAC +#define I40EVF_CF_FLAGS_IMAC_IVLAN (I40EVF_CLOUD_FIELD_IMAC |\ + I40EVF_CLOUD_FIELD_IVLAN) +#define I40EVF_CF_FLAGS_IMAC_TEN_ID (I40EVF_CLOUD_FIELD_IMAC |\ + I40EVF_CLOUD_FIELD_TEN_ID) +#define I40EVF_CF_FLAGS_OMAC_TEN_ID_IMAC (I40EVF_CLOUD_FIELD_OMAC |\ + I40EVF_CLOUD_FIELD_IMAC |\ + I40EVF_CLOUD_FIELD_TEN_ID) +#define I40EVF_CF_FLAGS_IMAC_IVLAN_TEN_ID (I40EVF_CLOUD_FIELD_IMAC |\ + I40EVF_CLOUD_FIELD_IVLAN |\ + I40EVF_CLOUD_FIELD_TEN_ID) +#define I40EVF_CF_FLAGS_IIP I40E_CLOUD_FIELD_IIP + +/* bookkeeping of cloud filters */ +struct i40evf_cloud_filter { +enum i40evf_cloud_filter_state_t state; +struct list_head list; +struct virtchnl_filter f; +unsigned long cookie; +bool del;/* filter needs to be deleted */ +bool add;/* filter needs to be added */ +}; +/* board specific private data structure */ struct i40evf_adapter {struct timer_list watchdog_timer;
@@ -287,6 +327,8 @@ struct i40evf_adapter {#define I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING BIT(20)#define I40EVF_FLAG_AQ_ENABLE_CHANNELS BIT(21)#define I40EVF_FLAG_AQ_DISABLE_CHANNELS BIT(22) +#define I40EVF_FLAG_AQ_ADD_CLOUD_FILTER BIT(23) +#define I40EVF_FLAG_AQ_DEL_CLOUD_FILTER BIT(24)/* OS defined structs */ struct net_device *netdev;
@@ -335,6 +377,10 @@ struct i40evf_adapter {/* ADQ related members */ struct i40evf_channel_config ch_config;u8 num_tc; +struct list_head cloud_filter_list; +/* lock to protest access to the cloud filter list */ +spinlock_t cloud_filter_list_lock; +u16 num_cloud_filters; };
@@ -403,4 +449,6 @@ void i40evf_notify_client_open(struct i40e_vsi *vsi);void i40evf_notify_client_close (struct i40e_vsi *vsi,bool reset);void i40evf_enable_channels (struct i40evf_adapter *adapter);void i40evf_disable_channels (struct i40evf_adapter *adapter); +void i40evf_add_cloud_filter (struct i40evf_adapter *adapter); +void i40evf_del_cloud_filter (struct i40evf_adapter *adapter);#endif /* _I40EVF_H_ */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +570 -4
685 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +187 -0
205 lines not on this page · raw message
Signature · 1 line
2.9.4
Bowers
PATCH v2 11/12 i40evf: Add support to apply cloud filters
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 11/12] i40evf: Add support to apply cloud filtersFrom: Harshitha Ramamurthy <[email protected]>
This patch enables a tc filter to be applied as a cloud filter for the VF. This patch adds functions which parse the tc filter, extract the necessary fields needed to configure the filter and package them in a virtchnl message to be sent to the PF to apply them.
v2: made
i40evf_print_cloud_filterfunction static.
Quoted 7 lines
Signed-off-by Harshitha Ramamurthy <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf.h | 48 ++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 574 ++++++++++++++++++++- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 187 +++++++ 3 files changed, 805 insertions(+), 4 deletions(-)
PATCH v2 12/12 i40e: Add and delete cloud filter
In reply to Avinash DayanandThis patch provides support to add or delete cloud filter for queue channels created for ADq on VF.
We are using the HW's cloud filter feature and programming it to act as a TC filter applied to a group of queues.
There are two possible modes for a VF when applying a cloud filter
1. Basic Mode: Intended to apply filters that don't need a VF to be
Trusted. This would include the following
Dest MAC + L4 port
Dest MAC + VLAN + L4 port
2. Advanced Mode: This mode is only for filters with combination that requires VF to be Trusted.
Dest IP + L4 port
When cloud filters are applied on a Trusted VF and for some reason the same VF is later made as unTrusted then all cloud filters will be deleted. All cloud filters has to be re-applied in such a case.
Cloud filters are also deleted when queue channel is deleted.
Testing-Hints:
=============
1. Adding Basic Mode filter should be possible on a VF in Non-Trusted mode.
2. In Advanced mode all filters should be able to be created.
Steps:
======
1. Enable ADq and create TCs using TC mqprio command
2. Apply cloud filter.
3. Turn-off the spoof check.
4. Pass traffic.
Example:
========
1. tc qdisc add dev enp4s2 root mqprio num_tc 4 map 0 0 0 0 1 2 2 3\
queues 2 at 0 2 at 2 1 at 4 1 at 5 hw 1 mode channel
2. tc qdisc add dev enp4s2 ingress
3. ethtool -K enp4s2 hw-tc-offload on
4. ip link set ens261f0 vf 0 spoofchk off
5. tc filter add dev enp4s2 protocol ip parent ffff: prio 1 flower\
dst_ip 192.168.3.5/32 ip_proto udp dst_port 25 skip_sw hw_tc 2
v2: made i40e_find_vsi_from_seid and i40e_del_all_cloud_filters functions
as static.
--- drivers/net/ethernet/intel/i40e/i40e.h | 6 + drivers/net/ethernet/intel/i40e/i40e_main.c | 16 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 458 ++++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + 4 files changed, 470 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +6 -0
@@ -1108,4 +1108,10 @@ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi)int i40e_create_queue_channel (struct i40e_vsi *vsi,struct i40e_channel *ch);int i40e_set_bw_limit (struct i40e_vsi *vsi,u16 seid,u64 max_tx_rate); +int i40e_add_del_cloud_filter (struct i40e_vsi *vsi, +struct i40e_cloud_filter *filter, +bool add); +int i40e_add_del_cloud_filter_big_buf (struct i40e_vsi *vsi, +struct i40e_cloud_filter *filter, +bool add);#endif /* _I40E_H_ */
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -11
@@ -69,12 +69,6 @@ static int i40e_reset(struct i40e_pf *pf);static void i40e_rebuild (struct i40e_pf *pf,bool reinit,bool lock_acquired);static void i40e_fdir_sb_setup (struct i40e_pf *pf);static int i40e_veb_get_bw_info (struct i40e_veb *veb); -static int i40e_add_del_cloud_filter (struct i40e_vsi *vsi, -struct i40e_cloud_filter *filter, -bool add); -static int i40e_add_del_cloud_filter_big_buf (struct i40e_vsi *vsi, -struct i40e_cloud_filter *filter, -bool add);static int i40e_get_capabilities (struct i40e_pf *pf,enum i40e_admin_queue_opc list_type);
@@ -6922,8 +6916,8 @@ i40e_set_cld_element(struct i40e_cloud_filter *filter,* Add or delete a cloud filter for a specific flow spec. * Returns 0 if the filter were successfully added. **/ -static int i40e_add_del_cloud_filter (struct i40e_vsi *vsi, -struct i40e_cloud_filter *filter,bool add) +int i40e_add_del_cloud_filter (struct i40e_vsi *vsi, +struct i40e_cloud_filter *filter,bool add) {struct i40e_aqc_cloud_filters_element_data cld_filter;struct i40e_pf *pf = vsi->back;
@@ -6989,9 +6983,9 @@ static int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,* Add or delete a cloud filter for a specific flow spec using big buffer. * Returns 0 if the filter were successfully added. **/ -static int i40e_add_del_cloud_filter_big_buf (struct i40e_vsi *vsi, -struct i40e_cloud_filter *filter, -bool add) +int i40e_add_del_cloud_filter_big_buf (struct i40e_vsi *vsi, +struct i40e_cloud_filter *filter, +bool add) {struct i40e_aqc_cloud_filters_element_bb cld_filter;struct i40e_pf *pf = vsi->back;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +457 -1
492 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +2 -0
@@ -128,6 +128,8 @@ struct i40e_vf {bool adq_enabled;/* flag to enable adq */ u8 num_tc;struct i40evf_channel ch[I40E_MAX_VF_VSI ]; +struct hlist_head cloud_filter_list; +u16 num_cloud_filters;/* RDMA Client */ struct virtchnl_iwarp_qvlist_info *qvlist_info;
Signature · 1 line
2.9.4
Bowers
PATCH v2 12/12 i40e: Add and delete cloud filter
Quoted 51 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Avinash Dayanand
Sent: Wednesday, January 17, 2018 8:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 next-queue 12/12] i40e: Add and delete cloud filterThis patch provides support to add or delete cloud filter for queue channels created for ADq on VF.
We are using the HW's cloud filter feature and programming it to act as a TC filter applied to a group of queues.There are two possible modes for a VF when applying a cloud filter
1. Basic Mode: Intended to apply filters that don't need a VF to be
Trusted. This would include the following
Dest MAC + L4 port
Dest MAC + VLAN + L4 port
2. Advanced Mode: This mode is only for filters with combination that requires VF to be Trusted.
Dest IP + L4 portWhen cloud filters are applied on a Trusted VF and for some reason the same VF is later made as unTrusted then all cloud filters will be deleted. All cloud filters has to be re-applied in such a case.
Cloud filters are also deleted when queue channel is deleted.Testing-Hints:
=============
1. Adding Basic Mode filter should be possible on a VF in Non-Trusted mode.
2. In Advanced mode all filters should be able to be created.Steps:
======
1. Enable ADq and create TCs using TC mqprio command 2. Apply cloud filter.
3. Turn-off the spoof check.
4. Pass traffic.Example:
========
1. tc qdisc add dev enp4s2 root mqprionum_tc4 map 0 0 0 0 1 2 2 3\
queues 2 at 0 2 at 2 1 at 4 1 at 5 hw 1 mode channel 2. tc qdisc add dev
enp4s2 ingress 3. ethtool -K enp4s2 hw-tc-offload on 4. ip link set ens261f0 vf 0 spoofchk off 5. tc filter add dev enp4s2 protocol ip parent ffff: prio 1flower\ dst_ip 192.168.3.5/32 ip_proto udp dst_port 25 skip_sw hw_tc 2v2: made
i40e_find_vsi_from_seidandi40e_del_all_cloud_filtersfunctions
as static.
Quoted 8 lines
Signed-off-by Avinash Dayanand <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 6 + drivers/net/ethernet/intel/i40e/i40e_main.c | 16 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 458 ++++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + 4 files changed, 470 insertions(+), 12 deletions(-)