Re: [Intel-wired-lan] [PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier
On 8/1/2017 12:16 PM, Shannon Nelson wrote: > On 7/31/2017 5:38 PM, Amritha Nambiar wrote: >> This patch enables tc-flower based hardware offloads. tc/flower >> filter provided by the kernel is configured as driver specific >> cloud filter. The patch implements functions and admin queue >> commands needed to support cloud filters in the driver and >> adds cloud filters to configure these tc-flower filters. >> >> The only action supported is to redirect packets to a traffic class >> on the same device. >> >> # tc qdisc add dev eth0 ingress >> # ethtool -K eth0 hw-tc-offload on >> >> # tc filter add dev eth0 protocol ip parent :\ >>prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw indev eth0\ >>action mirred ingress redirect dev eth0 tc 0 >> >> # tc filter add dev eth0 protocol ip parent :\ >>prio 2 flower dst_ip 192.168.3.5/32\ >>ip_proto udp dst_port 25 skip_sw indev eth0\ >>action mirred ingress redirect dev eth0 tc 1 >> >> # tc filter add dev eth0 protocol ipv6 parent :\ >>prio 3 flower dst_ip fe8::200:1\ >>ip_proto udp dst_port 66 skip_sw indev eth0\ >>action mirred ingress redirect dev eth0 tc 2 >> >> Delete tc flower filter: >> Example: >> >> # tc filter del dev eth0 parent : prio 3 handle 0x1 flower >> # tc filter del dev eth0 parent : >> >> Flow Director Sideband is disabled while configuring cloud filters >> via tc-flower. > > Only while configuring, or the whole time there is a cloud filter? This > is unclear here. The entire time cloud filters exists. Will make the comment clearer in v2. > >> >> Unsupported matches when cloud filters are added using enhanced >> big buffer cloud filter mode of underlying switch include: >> 1. source port and source IP >> 2. Combined MAC address and IP fields. >> 3. Not specfying L4 port > > s/specfying/specifying/ Will fix in v2. > >> >> These filter matches can however be used to redirect traffic to >> the main VSI (tc 0) which does not require the enhanced big buffer >> cloud filter support. >> >> Signed-off-by: Amritha Nambiar>> Signed-off-by: Kiran Patil >> --- >> drivers/net/ethernet/intel/i40e/i40e.h | 46 + >> drivers/net/ethernet/intel/i40e/i40e_common.c| 180 >> drivers/net/ethernet/intel/i40e/i40e_main.c | 952 >> ++ >> drivers/net/ethernet/intel/i40e/i40e_prototype.h | 17 >> 4 files changed, 1193 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/i40e/i40e.h >> b/drivers/net/ethernet/intel/i40e/i40e.h >> index 5c0cad5..7288265 100644 >> --- a/drivers/net/ethernet/intel/i40e/i40e.h >> +++ b/drivers/net/ethernet/intel/i40e/i40e.h >> @@ -55,6 +55,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> #include "i40e_type.h" >> #include "i40e_prototype.h" >> #include "i40e_client.h" >> @@ -252,10 +254,51 @@ struct i40e_fdir_filter { >> u32 fd_id; >> }; >> >> +#define I40E_CLOUD_FIELD_OMAC 0x01 >> +#define I40E_CLOUD_FIELD_IMAC 0x02 >> +#define I40E_CLOUD_FIELD_IVLAN 0x04 >> +#define I40E_CLOUD_FIELD_TEN_ID 0x08 >> +#define I40E_CLOUD_FIELD_IIP0x10 >> + >> +#define I40E_CLOUD_FILTER_FLAGS_OMACI40E_CLOUD_FIELD_OMAC >> +#define I40E_CLOUD_FILTER_FLAGS_IMACI40E_CLOUD_FIELD_IMAC >> +#define I40E_CLOUD_FILTER_FLAGS_IMAC_IVLAN (I40E_CLOUD_FIELD_IMAC | \ >> + I40E_CLOUD_FIELD_IVLAN) >> +#define I40E_CLOUD_FILTER_FLAGS_IMAC_TEN_ID (I40E_CLOUD_FIELD_IMAC | \ >> + I40E_CLOUD_FIELD_TEN_ID) >> +#define I40E_CLOUD_FILTER_FLAGS_OMAC_TEN_ID_IMAC (I40E_CLOUD_FIELD_OMAC | \ >> + I40E_CLOUD_FIELD_IMAC | \ >> + I40E_CLOUD_FIELD_TEN_ID) >> +#define I40E_CLOUD_FILTER_FLAGS_IMAC_IVLAN_TEN_ID (I40E_CLOUD_FIELD_IMAC | \ >> + I40E_CLOUD_FIELD_IVLAN | \ >> + I40E_CLOUD_FIELD_TEN_ID) >> +#define I40E_CLOUD_FILTER_FLAGS_IIP I40E_CLOUD_FIELD_IIP >> + >> struct i40e_cloud_filter { >> struct hlist_node cloud_node; >> /* cloud filter input set follows */ >> unsigned long cookie; >> +u8 dst_mac[ETH_ALEN]; >> +u8 src_mac[ETH_ALEN]; >> +__be16 vlan_id; >> +__be32 dst_ip[4]; >> +__be32 src_ip[4]; >> +u8 dst_ipv6[16]; >> +u8 src_ipv6[16]; >> +__be16 dst_port; >> +__be16 src_port; >> +/* matter only when IP based filtering is set */ >> +bool is_ipv6; >> +/* IPPROTO value */ >> +u8 ip_proto; >> +/* L4 port type: src or destination port */ >> +#define I40E_CLOUD_FILTER_PORT_SRC 0x01 >> +#define I40E_CLOUD_FILTER_PORT_DEST 0x02 >> +u8 port_type; >> +u32 tenant_id; >> +u8 flags; >> +#define I40E_CLOUD_TNL_TYPE_NONE0xff >> +u8 tunnel_type; >> /* filter
Re: [PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier
On 8/2/2017 5:02 AM, Jamal Hadi Salim wrote: > On 17-08-01 10:13 PM, Nambiar, Amritha wrote: >> >> On 8/1/2017 3:56 AM, Jamal Hadi Salim wrote: >>> On 17-07-31 08:38 PM, Amritha Nambiar wrote: This patch enables tc-flower based hardware offloads. tc/flower filter provided by the kernel is configured as driver specific cloud filter. The patch implements functions and admin queue commands needed to support cloud filters in the driver and adds cloud filters to configure these tc-flower filters. The only action supported is to redirect packets to a traffic class on the same device. # tc qdisc add dev eth0 ingress # ethtool -K eth0 hw-tc-offload on # tc filter add dev eth0 protocol ip parent :\ prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 0 >>> >>> Out of curiosity - did you need to say "indev eth0" there? >> >> It looks like I don't need to specify "indev eth0". I will need to look >> up how this part is offloaded and probably validate in the driver when >> this is specified. >> >>> Also: Is it possible to add an skbmark? Example something like >>> these that directs two flows to the same queue but different >>> skb marks: >>> >>> # tc filter add dev eth0 protocol ip parent : \ >>> prio 2 flower dst_ip 192.168.3.5/32 \ >>> ip_proto udp dst_port 2a skip_sw \ >>> action skbedit mark 11 \ >>> action mirred ingress redirect dev eth0 tcqueue 1 >>> >>> # tc filter add dev eth0 protocol ip parent : \ >>> prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw \ >>> action skbedit mark 12 \ >>> action mirred ingress redirect dev eth0 tcqueue 1 >>> >> >> It is possible to support the skbedit mark action for the first rule >> here (L3 and L4) which I can take up in a subsequent patch, but this >> cannot be supported on our device for L2 based match in the second rule. >> > > Ok, thanks. So the issue is one of hardware limitation? > Right. Our hardware does not have this support now. > cheers, > jamal >
Re: [PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier
On 17-08-01 10:13 PM, Nambiar, Amritha wrote: On 8/1/2017 3:56 AM, Jamal Hadi Salim wrote: On 17-07-31 08:38 PM, Amritha Nambiar wrote: This patch enables tc-flower based hardware offloads. tc/flower filter provided by the kernel is configured as driver specific cloud filter. The patch implements functions and admin queue commands needed to support cloud filters in the driver and adds cloud filters to configure these tc-flower filters. The only action supported is to redirect packets to a traffic class on the same device. # tc qdisc add dev eth0 ingress # ethtool -K eth0 hw-tc-offload on # tc filter add dev eth0 protocol ip parent :\ prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 0 Out of curiosity - did you need to say "indev eth0" there? It looks like I don't need to specify "indev eth0". I will need to look up how this part is offloaded and probably validate in the driver when this is specified. Also: Is it possible to add an skbmark? Example something like these that directs two flows to the same queue but different skb marks: # tc filter add dev eth0 protocol ip parent : \ prio 2 flower dst_ip 192.168.3.5/32 \ ip_proto udp dst_port 2a skip_sw \ action skbedit mark 11 \ action mirred ingress redirect dev eth0 tcqueue 1 # tc filter add dev eth0 protocol ip parent : \ prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw \ action skbedit mark 12 \ action mirred ingress redirect dev eth0 tcqueue 1 It is possible to support the skbedit mark action for the first rule here (L3 and L4) which I can take up in a subsequent patch, but this cannot be supported on our device for L2 based match in the second rule. Ok, thanks. So the issue is one of hardware limitation? cheers, jamal
Re: [PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier
On 8/1/2017 3:56 AM, Jamal Hadi Salim wrote: > On 17-07-31 08:38 PM, Amritha Nambiar wrote: >> This patch enables tc-flower based hardware offloads. tc/flower >> filter provided by the kernel is configured as driver specific >> cloud filter. The patch implements functions and admin queue >> commands needed to support cloud filters in the driver and >> adds cloud filters to configure these tc-flower filters. >> >> The only action supported is to redirect packets to a traffic class >> on the same device. >> >> # tc qdisc add dev eth0 ingress >> # ethtool -K eth0 hw-tc-offload on >> >> # tc filter add dev eth0 protocol ip parent :\ >>prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw indev eth0\ >>action mirred ingress redirect dev eth0 tc 0 >> > > Out of curiosity - did you need to say "indev eth0" there? It looks like I don't need to specify "indev eth0". I will need to look up how this part is offloaded and probably validate in the driver when this is specified. > Also: Is it possible to add an skbmark? Example something like > these that directs two flows to the same queue but different > skb marks: > > # tc filter add dev eth0 protocol ip parent : \ >prio 2 flower dst_ip 192.168.3.5/32 \ >ip_proto udp dst_port 2a skip_sw \ >action skbedit mark 11 \ >action mirred ingress redirect dev eth0 tcqueue 1 > > # tc filter add dev eth0 protocol ip parent : \ > prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw \ > action skbedit mark 12 \ > action mirred ingress redirect dev eth0 tcqueue 1 > It is possible to support the skbedit mark action for the first rule here (L3 and L4) which I can take up in a subsequent patch, but this cannot be supported on our device for L2 based match in the second rule. > cheers, > jamal >
Re: [Intel-wired-lan] [PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier
On 7/31/2017 5:38 PM, Amritha Nambiar wrote: This patch enables tc-flower based hardware offloads. tc/flower filter provided by the kernel is configured as driver specific cloud filter. The patch implements functions and admin queue commands needed to support cloud filters in the driver and adds cloud filters to configure these tc-flower filters. The only action supported is to redirect packets to a traffic class on the same device. # tc qdisc add dev eth0 ingress # ethtool -K eth0 hw-tc-offload on # tc filter add dev eth0 protocol ip parent :\ prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 0 # tc filter add dev eth0 protocol ip parent :\ prio 2 flower dst_ip 192.168.3.5/32\ ip_proto udp dst_port 25 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 1 # tc filter add dev eth0 protocol ipv6 parent :\ prio 3 flower dst_ip fe8::200:1\ ip_proto udp dst_port 66 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 2 Delete tc flower filter: Example: # tc filter del dev eth0 parent : prio 3 handle 0x1 flower # tc filter del dev eth0 parent : Flow Director Sideband is disabled while configuring cloud filters via tc-flower. Only while configuring, or the whole time there is a cloud filter? This is unclear here. Unsupported matches when cloud filters are added using enhanced big buffer cloud filter mode of underlying switch include: 1. source port and source IP 2. Combined MAC address and IP fields. 3. Not specfying L4 port s/specfying/specifying/ These filter matches can however be used to redirect traffic to the main VSI (tc 0) which does not require the enhanced big buffer cloud filter support. Signed-off-by: Amritha NambiarSigned-off-by: Kiran Patil --- drivers/net/ethernet/intel/i40e/i40e.h | 46 + drivers/net/ethernet/intel/i40e/i40e_common.c| 180 drivers/net/ethernet/intel/i40e/i40e_main.c | 952 ++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 17 4 files changed, 1193 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 5c0cad5..7288265 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -55,6 +55,8 @@ #include #include #include +#include +#include #include "i40e_type.h" #include "i40e_prototype.h" #include "i40e_client.h" @@ -252,10 +254,51 @@ struct i40e_fdir_filter { u32 fd_id; }; +#define I40E_CLOUD_FIELD_OMAC 0x01 +#define I40E_CLOUD_FIELD_IMAC 0x02 +#define I40E_CLOUD_FIELD_IVLAN 0x04 +#define I40E_CLOUD_FIELD_TEN_ID0x08 +#define I40E_CLOUD_FIELD_IIP 0x10 + +#define I40E_CLOUD_FILTER_FLAGS_OMAC I40E_CLOUD_FIELD_OMAC +#define I40E_CLOUD_FILTER_FLAGS_IMAC I40E_CLOUD_FIELD_IMAC +#define I40E_CLOUD_FILTER_FLAGS_IMAC_IVLAN (I40E_CLOUD_FIELD_IMAC | \ +I40E_CLOUD_FIELD_IVLAN) +#define I40E_CLOUD_FILTER_FLAGS_IMAC_TEN_ID(I40E_CLOUD_FIELD_IMAC | \ +I40E_CLOUD_FIELD_TEN_ID) +#define I40E_CLOUD_FILTER_FLAGS_OMAC_TEN_ID_IMAC (I40E_CLOUD_FIELD_OMAC | \ + I40E_CLOUD_FIELD_IMAC | \ + I40E_CLOUD_FIELD_TEN_ID) +#define I40E_CLOUD_FILTER_FLAGS_IMAC_IVLAN_TEN_ID (I40E_CLOUD_FIELD_IMAC | \ + I40E_CLOUD_FIELD_IVLAN | \ + I40E_CLOUD_FIELD_TEN_ID) +#define I40E_CLOUD_FILTER_FLAGS_IIPI40E_CLOUD_FIELD_IIP + struct i40e_cloud_filter { struct hlist_node cloud_node; /* cloud filter input set follows */ unsigned long cookie; + u8 dst_mac[ETH_ALEN]; + u8 src_mac[ETH_ALEN]; + __be16 vlan_id; + __be32 dst_ip[4]; + __be32 src_ip[4]; + u8 dst_ipv6[16]; + u8 src_ipv6[16]; + __be16 dst_port; + __be16 src_port; + /* matter only when IP based filtering is set */ + bool is_ipv6; + /* IPPROTO value */ + u8 ip_proto; + /* L4 port type: src or destination port */ +#define I40E_CLOUD_FILTER_PORT_SRC 0x01 +#define I40E_CLOUD_FILTER_PORT_DEST0x02 + u8 port_type; + u32 tenant_id; + u8 flags; +#define I40E_CLOUD_TNL_TYPE_NONE 0xff + u8 tunnel_type; /* filter control */ u16 seid; }; @@ -574,6 +617,9 @@ struct i40e_pf { u16 phy_led_val; u16 override_q_count; + u16 last_sw_conf_flags; + u16 last_sw_conf_valid_flags; + Unnecessary blank line }; /** diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index d0e8138..bfbe304 100644 ---
[PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier
This patch enables tc-flower based hardware offloads. tc/flower filter provided by the kernel is configured as driver specific cloud filter. The patch implements functions and admin queue commands needed to support cloud filters in the driver and adds cloud filters to configure these tc-flower filters. The only action supported is to redirect packets to a traffic class on the same device. # tc qdisc add dev eth0 ingress # ethtool -K eth0 hw-tc-offload on # tc filter add dev eth0 protocol ip parent :\ prio 1 flower dst_mac 3c:fd:fe:a0:d6:70 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 0 # tc filter add dev eth0 protocol ip parent :\ prio 2 flower dst_ip 192.168.3.5/32\ ip_proto udp dst_port 25 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 1 # tc filter add dev eth0 protocol ipv6 parent :\ prio 3 flower dst_ip fe8::200:1\ ip_proto udp dst_port 66 skip_sw indev eth0\ action mirred ingress redirect dev eth0 tc 2 Delete tc flower filter: Example: # tc filter del dev eth0 parent : prio 3 handle 0x1 flower # tc filter del dev eth0 parent : Flow Director Sideband is disabled while configuring cloud filters via tc-flower. Unsupported matches when cloud filters are added using enhanced big buffer cloud filter mode of underlying switch include: 1. source port and source IP 2. Combined MAC address and IP fields. 3. Not specfying L4 port These filter matches can however be used to redirect traffic to the main VSI (tc 0) which does not require the enhanced big buffer cloud filter support. Signed-off-by: Amritha NambiarSigned-off-by: Kiran Patil --- drivers/net/ethernet/intel/i40e/i40e.h | 46 + drivers/net/ethernet/intel/i40e/i40e_common.c| 180 drivers/net/ethernet/intel/i40e/i40e_main.c | 952 ++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 17 4 files changed, 1193 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 5c0cad5..7288265 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -55,6 +55,8 @@ #include #include #include +#include +#include #include "i40e_type.h" #include "i40e_prototype.h" #include "i40e_client.h" @@ -252,10 +254,51 @@ struct i40e_fdir_filter { u32 fd_id; }; +#define I40E_CLOUD_FIELD_OMAC 0x01 +#define I40E_CLOUD_FIELD_IMAC 0x02 +#define I40E_CLOUD_FIELD_IVLAN 0x04 +#define I40E_CLOUD_FIELD_TEN_ID0x08 +#define I40E_CLOUD_FIELD_IIP 0x10 + +#define I40E_CLOUD_FILTER_FLAGS_OMAC I40E_CLOUD_FIELD_OMAC +#define I40E_CLOUD_FILTER_FLAGS_IMAC I40E_CLOUD_FIELD_IMAC +#define I40E_CLOUD_FILTER_FLAGS_IMAC_IVLAN (I40E_CLOUD_FIELD_IMAC | \ +I40E_CLOUD_FIELD_IVLAN) +#define I40E_CLOUD_FILTER_FLAGS_IMAC_TEN_ID(I40E_CLOUD_FIELD_IMAC | \ +I40E_CLOUD_FIELD_TEN_ID) +#define I40E_CLOUD_FILTER_FLAGS_OMAC_TEN_ID_IMAC (I40E_CLOUD_FIELD_OMAC | \ + I40E_CLOUD_FIELD_IMAC | \ + I40E_CLOUD_FIELD_TEN_ID) +#define I40E_CLOUD_FILTER_FLAGS_IMAC_IVLAN_TEN_ID (I40E_CLOUD_FIELD_IMAC | \ + I40E_CLOUD_FIELD_IVLAN | \ + I40E_CLOUD_FIELD_TEN_ID) +#define I40E_CLOUD_FILTER_FLAGS_IIPI40E_CLOUD_FIELD_IIP + struct i40e_cloud_filter { struct hlist_node cloud_node; /* cloud filter input set follows */ unsigned long cookie; + u8 dst_mac[ETH_ALEN]; + u8 src_mac[ETH_ALEN]; + __be16 vlan_id; + __be32 dst_ip[4]; + __be32 src_ip[4]; + u8 dst_ipv6[16]; + u8 src_ipv6[16]; + __be16 dst_port; + __be16 src_port; + /* matter only when IP based filtering is set */ + bool is_ipv6; + /* IPPROTO value */ + u8 ip_proto; + /* L4 port type: src or destination port */ +#define I40E_CLOUD_FILTER_PORT_SRC 0x01 +#define I40E_CLOUD_FILTER_PORT_DEST0x02 + u8 port_type; + u32 tenant_id; + u8 flags; +#define I40E_CLOUD_TNL_TYPE_NONE 0xff + u8 tunnel_type; /* filter control */ u16 seid; }; @@ -574,6 +617,9 @@ struct i40e_pf { u16 phy_led_val; u16 override_q_count; + u16 last_sw_conf_flags; + u16 last_sw_conf_valid_flags; + }; /** diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index d0e8138..bfbe304 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c @@ -5269,5 +5269,185 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw, status = i40e_aq_write_ppp(hw, (void *)sec, sec->data_end,