Re: [PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
On Sun, Oct 29, 2017 at 11:22 AM, kbuild test robotwrote: > All warnings (new ones prefixed by >>): > >drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c: In function > 'bnxt_tc_resolve_tunnel_hdrs': >drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:882:10: error: implicit > declaration of function 'vlan_dev_priv' > [-Werror=implicit-function-declaration] > struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); > ^ > This has already been fixed by this commit: 952c5719aac6587f1e0add97dca79f9e73887f9b bnxt_en: Fix randconfig build errors.
Re: [PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
Hi Sathya, I love your patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Michael-Chan/bnxt_en-Updates-for-net-next/20171029-105709 config: x86_64-randconfig-it0-10300113 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_resolve_tunnel_hdrs': drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:882:10: error: implicit declaration of function 'vlan_dev_priv' [-Werror=implicit-function-declaration] struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); ^ drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:882:32: warning: initialization makes pointer from integer without a cast struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); ^ drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:884:11: error: dereferencing pointer to incomplete type if (vlan->real_dev != real_dst_dev) { ^ In file included from include/linux/swab.h:4:0, from include/uapi/linux/byteorder/little_endian.h:12, from include/linux/byteorder/little_endian.h:4, from arch/x86/include/uapi/asm/byteorder.h:4, from include/asm-generic/bitops/le.h:5, from arch/x86/include/asm/bitops.h:517, from include/linux/bitops.h:37, from include/linux/kernel.h:10, from include/linux/list.h:8, from include/linux/timer.h:4, from include/linux/netdevice.h:28, from drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:10: drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:892:39: error: dereferencing pointer to incomplete type l2_info->inner_vlan_tci = htons(vlan->vlan_id); ^ include/uapi/linux/swab.h:100:54: note: in definition of macro '__swab16' #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) ^ include/linux/byteorder/generic.h:134:21: note: in expansion of macro '__cpu_to_be16' #define ___htons(x) __cpu_to_be16(x) ^ include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___htons' #define htons(x) ___htons(x) ^ >> drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:892:29: note: in expansion of >> macro 'htons' l2_info->inner_vlan_tci = htons(vlan->vlan_id); ^ drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c:893:34: error: dereferencing pointer to incomplete type l2_info->inner_vlan_tpid = vlan->vlan_proto; ^ cc1: some warnings being treated as errors vim +/htons +892 drivers/net//ethernet/broadcom/bnxt/bnxt_tc.c 855 856 static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp, 857 struct ip_tunnel_key *tun_key, 858 struct bnxt_tc_l2_key *l2_info, 859 struct net_device *real_dst_dev) 860 { 861 struct flowi4 flow = { {0} }; 862 struct net_device *dst_dev; 863 struct neighbour *nbr; 864 struct rtable *rt; 865 int rc; 866 867 flow.flowi4_proto = IPPROTO_UDP; 868 flow.fl4_dport = tun_key->tp_dst; 869 flow.daddr = tun_key->u.ipv4.dst; 870 871 rt = ip_route_output_key(dev_net(real_dst_dev), ); 872 if (IS_ERR(rt)) { 873 netdev_info(bp->dev, "no route to %pI4b", ); 874 return -EOPNOTSUPP; 875 } 876 877 /* The route must either point to the real_dst_dev or a dst_dev that 878 * uses the real_dst_dev. 879 */ 880 dst_dev = rt->dst.dev; 881 if (is_vlan_dev(dst_dev)) { 882 struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); 883 884 if (vlan->real_dev != real_dst_dev) { 885 netdev_info(bp->dev, 886 "dst_dev(%s) doesn't use PF-if(%s)", 887 netdev_name(dst_dev), 888 netdev_name(real_dst_dev)); 889 rc = -EOPNOTSUPP; 890 goto put_rt; 891 } > 892 l2_info->inner_vlan_tci = htons(vlan->vlan_id); 893 l2_info->inner_vlan_tpid = vlan->vlan_proto; 894 l2_info->num_vlans = 1; 895 } else if (dst_dev != real_dst_dev) {
Re: [PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
Hi Sathya, Thank you for the patch! Yet we hit a small issue. [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Michael-Chan/bnxt_en-Updates-for-net-next/20171029-105709 config: i386-randconfig-x0-10291556 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_resolve_tunnel_hdrs': drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:882:32: error: implicit declaration of function 'vlan_dev_priv' [-Werror=implicit-function-declaration] struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); ^ drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:882:32: warning: initialization makes pointer from integer without a cast [-Wint-conversion] In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/linux/list.h:4, from include/linux/timer.h:4, from include/linux/netdevice.h:28, from drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:10: drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:884:11: error: dereferencing pointer to incomplete type 'struct vlan_dev_priv' if (vlan->real_dev != real_dst_dev) { ^ include/linux/compiler.h:156:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:884:3: note: in expansion of >> macro 'if' if (vlan->real_dev != real_dst_dev) { ^~ cc1: some warnings being treated as errors vim +/if +884 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c 855 856 static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp, 857 struct ip_tunnel_key *tun_key, 858 struct bnxt_tc_l2_key *l2_info, 859 struct net_device *real_dst_dev) 860 { 861 struct flowi4 flow = { {0} }; 862 struct net_device *dst_dev; 863 struct neighbour *nbr; 864 struct rtable *rt; 865 int rc; 866 867 flow.flowi4_proto = IPPROTO_UDP; 868 flow.fl4_dport = tun_key->tp_dst; 869 flow.daddr = tun_key->u.ipv4.dst; 870 871 rt = ip_route_output_key(dev_net(real_dst_dev), ); 872 if (IS_ERR(rt)) { 873 netdev_info(bp->dev, "no route to %pI4b", ); 874 return -EOPNOTSUPP; 875 } 876 877 /* The route must either point to the real_dst_dev or a dst_dev that 878 * uses the real_dst_dev. 879 */ 880 dst_dev = rt->dst.dev; 881 if (is_vlan_dev(dst_dev)) { 882 struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); 883 > 884 if (vlan->real_dev != real_dst_dev) { 885 netdev_info(bp->dev, 886 "dst_dev(%s) doesn't use PF-if(%s)", 887 netdev_name(dst_dev), 888 netdev_name(real_dst_dev)); 889 rc = -EOPNOTSUPP; 890 goto put_rt; 891 } 892 l2_info->inner_vlan_tci = htons(vlan->vlan_id); 893 l2_info->inner_vlan_tpid = vlan->vlan_proto; 894 l2_info->num_vlans = 1; 895 } else if (dst_dev != real_dst_dev) { 896 netdev_info(bp->dev, 897 "dst_dev(%s) for %pI4b is not PF-if(%s)", 898 netdev_name(dst_dev), , 899 netdev_name(real_dst_dev)); 900 rc = -EOPNOTSUPP; 901 goto put_rt; 902 } 903 904 nbr = dst_neigh_lookup(>dst, ); 905 if (!nbr) { 906 netdev_info(bp->dev, "can't lookup neighbor for %pI4b", 907 ); 908 rc = -EOPNOTSUPP; 909 goto put_rt; 910 } 911 912 tun_key->u.ipv4.src = flow.saddr; 913 tun_key->ttl = ip4_dst_hoplimit(>dst); 914 neigh_ha_snapshot(l2_info->dmac, nbr, dst_dev); 915 ether_addr_copy(l2_info->smac, dst_dev->dev_addr); 916 neigh_release(nbr); 917 ip_rt_put(rt); 918 919 return 0; 920
Re: [PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
On Fri, 27 Oct 2017 20:28:16 -0700, Michael Chan wrote: > On Fri, Oct 27, 2017 at 8:18 PM, Jakub Kicinskiwrote: > > On Thu, 26 Oct 2017 11:51:29 -0400, Michael Chan wrote: > >> From: Sathya Perla > >> > >> This patch adds IPv4 vxlan encap/decap action support to TC-flower > >> offload. > >> > >> For vxlan encap, the driver maintains a tunnel encap hash-table. > >> When a new flow with a tunnel encap action arrives, this table > >> is looked up; if an encap entry exists, it uses the already > >> programmed encap_record_handle as the tunnel_handle in the > >> hwrm_cfa_flow_alloc cmd. Else, a new encap node is added and the > >> L2 header fields are queried via a route lookup. > >> hwrm_cfa_encap_record_alloc cmd is used to create a new encap > >> record and the encap_record_handle is used as the tunnel_handle > >> while adding the flow. > >> > >> For vxlan decap, the driver maintains a tunnel decap hash-table. > >> When a new flow with a tunnel decap action arrives, this table > >> is looked up; if a decap entry exists, it uses the already > >> programmed decap_filter_handle as the tunnel_handle in the > >> hwrm_cfa_flow_alloc cmd. Else, a new decap node is added and > >> a decap_filter_handle is alloc'd via the hwrm_cfa_decap_filter_alloc > >> cmd. This handle is used as the tunnel_handle while adding the flow. > >> > >> The code to issue the HWRM FW cmds is introduced in a follow-up patch. > >> > >> Signed-off-by: Sathya Perla > >> Signed-off-by: Michael Chan > > > > Hi! I hit this randconfig build testing: > > > > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function > > ‘bnxt_tc_resolve_tunnel_hdrs’: > > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:928:32: error: implicit > > declaration of function ‘vlan_dev_priv’ > > [-Werror=implicit-function-declaration] > >struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); > > ^ > > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:928:32: warning: > > initialization makes pointer from integer without a cast [-Wint-conversion] > > In file included from ../include/uapi/linux/stddef.h:1:0, > > from ../include/linux/stddef.h:4, > > from ../include/uapi/linux/posix_types.h:4, > > from ../include/uapi/linux/types.h:13, > > from ../include/linux/types.h:5, > > from ../include/linux/list.h:4, > > from ../include/linux/timer.h:4, > > from ../include/linux/netdevice.h:28, > > from ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:10: > > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:930:11: error: > > dereferencing pointer to incomplete type ‘struct vlan_dev_priv’ > >if (vlan->real_dev != real_dst_dev) { > >^ > > ../include/linux/compiler.h:156:30: note: in definition of macro > > ‘__trace_if’ > > if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ > > ^~~~ > > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:930:3: note: in expansion > > of macro ‘if’ > >if (vlan->real_dev != real_dst_dev) { > >^~ > > cc1: some warnings being treated as errors > > Thanks for reporting this. I think we need to use vlan_dev_real_dev() > API which will handle the case where CONFIG_VLAN_8021Q is not defined. > > I will send a patch to fix this shortly. Thanks again. I found another one :) drivers/net/ethernet/broadcom/bnxt/bnxt_tc.o: In function `bnxt_tc_resolve_tunnel_hdrs.isra.34': bnxt_tc.c:(.text+0x5cd): undefined reference to `ip_route_output_flow' This is when CONFIG_INET is not set.
Re: [PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
On Fri, Oct 27, 2017 at 8:18 PM, Jakub Kicinskiwrote: > On Thu, 26 Oct 2017 11:51:29 -0400, Michael Chan wrote: >> From: Sathya Perla >> >> This patch adds IPv4 vxlan encap/decap action support to TC-flower >> offload. >> >> For vxlan encap, the driver maintains a tunnel encap hash-table. >> When a new flow with a tunnel encap action arrives, this table >> is looked up; if an encap entry exists, it uses the already >> programmed encap_record_handle as the tunnel_handle in the >> hwrm_cfa_flow_alloc cmd. Else, a new encap node is added and the >> L2 header fields are queried via a route lookup. >> hwrm_cfa_encap_record_alloc cmd is used to create a new encap >> record and the encap_record_handle is used as the tunnel_handle >> while adding the flow. >> >> For vxlan decap, the driver maintains a tunnel decap hash-table. >> When a new flow with a tunnel decap action arrives, this table >> is looked up; if a decap entry exists, it uses the already >> programmed decap_filter_handle as the tunnel_handle in the >> hwrm_cfa_flow_alloc cmd. Else, a new decap node is added and >> a decap_filter_handle is alloc'd via the hwrm_cfa_decap_filter_alloc >> cmd. This handle is used as the tunnel_handle while adding the flow. >> >> The code to issue the HWRM FW cmds is introduced in a follow-up patch. >> >> Signed-off-by: Sathya Perla >> Signed-off-by: Michael Chan > > Hi! I hit this randconfig build testing: > > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function > ‘bnxt_tc_resolve_tunnel_hdrs’: > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:928:32: error: implicit > declaration of function ‘vlan_dev_priv’ > [-Werror=implicit-function-declaration] >struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); > ^ > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:928:32: warning: > initialization makes pointer from integer without a cast [-Wint-conversion] > In file included from ../include/uapi/linux/stddef.h:1:0, > from ../include/linux/stddef.h:4, > from ../include/uapi/linux/posix_types.h:4, > from ../include/uapi/linux/types.h:13, > from ../include/linux/types.h:5, > from ../include/linux/list.h:4, > from ../include/linux/timer.h:4, > from ../include/linux/netdevice.h:28, > from ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:10: > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:930:11: error: dereferencing > pointer to incomplete type ‘struct vlan_dev_priv’ >if (vlan->real_dev != real_dst_dev) { >^ > ../include/linux/compiler.h:156:30: note: in definition of macro ‘__trace_if’ > if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ > ^~~~ > ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:930:3: note: in expansion of > macro ‘if’ >if (vlan->real_dev != real_dst_dev) { >^~ > cc1: some warnings being treated as errors Thanks for reporting this. I think we need to use vlan_dev_real_dev() API which will handle the case where CONFIG_VLAN_8021Q is not defined. I will send a patch to fix this shortly. Thanks again.
Re: [PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
On Thu, 26 Oct 2017 11:51:29 -0400, Michael Chan wrote: > From: Sathya Perla> > This patch adds IPv4 vxlan encap/decap action support to TC-flower > offload. > > For vxlan encap, the driver maintains a tunnel encap hash-table. > When a new flow with a tunnel encap action arrives, this table > is looked up; if an encap entry exists, it uses the already > programmed encap_record_handle as the tunnel_handle in the > hwrm_cfa_flow_alloc cmd. Else, a new encap node is added and the > L2 header fields are queried via a route lookup. > hwrm_cfa_encap_record_alloc cmd is used to create a new encap > record and the encap_record_handle is used as the tunnel_handle > while adding the flow. > > For vxlan decap, the driver maintains a tunnel decap hash-table. > When a new flow with a tunnel decap action arrives, this table > is looked up; if a decap entry exists, it uses the already > programmed decap_filter_handle as the tunnel_handle in the > hwrm_cfa_flow_alloc cmd. Else, a new decap node is added and > a decap_filter_handle is alloc'd via the hwrm_cfa_decap_filter_alloc > cmd. This handle is used as the tunnel_handle while adding the flow. > > The code to issue the HWRM FW cmds is introduced in a follow-up patch. > > Signed-off-by: Sathya Perla > Signed-off-by: Michael Chan Hi! I hit this randconfig build testing: ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function ‘bnxt_tc_resolve_tunnel_hdrs’: ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:928:32: error: implicit declaration of function ‘vlan_dev_priv’ [-Werror=implicit-function-declaration] struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev); ^ ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:928:32: warning: initialization makes pointer from integer without a cast [-Wint-conversion] In file included from ../include/uapi/linux/stddef.h:1:0, from ../include/linux/stddef.h:4, from ../include/uapi/linux/posix_types.h:4, from ../include/uapi/linux/types.h:13, from ../include/linux/types.h:5, from ../include/linux/list.h:4, from ../include/linux/timer.h:4, from ../include/linux/netdevice.h:28, from ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:10: ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:930:11: error: dereferencing pointer to incomplete type ‘struct vlan_dev_priv’ if (vlan->real_dev != real_dst_dev) { ^ ../include/linux/compiler.h:156:30: note: in definition of macro ‘__trace_if’ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ ../drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:930:3: note: in expansion of macro ‘if’ if (vlan->real_dev != real_dst_dev) { ^~ cc1: some warnings being treated as errors .config.bz2 Description: application/bzip
[PATCH net-next 11/14] bnxt_en: add support for Flower based vxlan encap/decap offload
From: Sathya PerlaThis patch adds IPv4 vxlan encap/decap action support to TC-flower offload. For vxlan encap, the driver maintains a tunnel encap hash-table. When a new flow with a tunnel encap action arrives, this table is looked up; if an encap entry exists, it uses the already programmed encap_record_handle as the tunnel_handle in the hwrm_cfa_flow_alloc cmd. Else, a new encap node is added and the L2 header fields are queried via a route lookup. hwrm_cfa_encap_record_alloc cmd is used to create a new encap record and the encap_record_handle is used as the tunnel_handle while adding the flow. For vxlan decap, the driver maintains a tunnel decap hash-table. When a new flow with a tunnel decap action arrives, this table is looked up; if a decap entry exists, it uses the already programmed decap_filter_handle as the tunnel_handle in the hwrm_cfa_flow_alloc cmd. Else, a new decap node is added and a decap_filter_handle is alloc'd via the hwrm_cfa_decap_filter_alloc cmd. This handle is used as the tunnel_handle while adding the flow. The code to issue the HWRM FW cmds is introduced in a follow-up patch. Signed-off-by: Sathya Perla Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 9 + drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 566 +- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | 66 ++- 4 files changed, 631 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 2188f16..d88d864 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -965,6 +965,15 @@ struct bnxt_tc_info { /* hash table to store L2 keys of TC flows */ struct rhashtable l2_table; struct rhashtable_paramsl2_ht_params; + /* hash table to store L2 keys for TC tunnel decap */ + struct rhashtable decap_l2_table; + struct rhashtable_paramsdecap_l2_ht_params; + /* hash table to store tunnel decap entries */ + struct rhashtable decap_table; + struct rhashtable_paramsdecap_ht_params; + /* hash table to store tunnel encap entries */ + struct rhashtable encap_table; + struct rhashtable_paramsencap_ht_params; /* lock to atomically add/del an l2 node when a flow is * added or deleted. diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index f3f6aa8..402fa32 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -29,7 +29,7 @@ int bnxt_dl_register(struct bnxt *bp) if (!pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV)) return 0; - if (bp->hwrm_spec_code < 0x10800) { + if (bp->hwrm_spec_code < 0x10803) { netdev_warn(bp->dev, "Firmware does not support SR-IOV E-Switch SWITCHDEV mode.\n"); return -ENOTSUPP; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index a9cb653..f14edc9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "bnxt_hsi.h" #include "bnxt.h" @@ -89,6 +90,23 @@ static void bnxt_tc_parse_vlan(struct bnxt *bp, } } +static int bnxt_tc_parse_tunnel_set(struct bnxt *bp, + struct bnxt_tc_actions *actions, + const struct tc_action *tc_act) +{ + struct ip_tunnel_info *tun_info = tcf_tunnel_info(tc_act); + struct ip_tunnel_key *tun_key = _info->key; + + if (ip_tunnel_info_af(tun_info) != AF_INET) { + netdev_info(bp->dev, "only IPv4 tunnel-encap is supported"); + return -EOPNOTSUPP; + } + + actions->tun_encap_key = *tun_key; + actions->flags |= BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP; + return 0; +} + static int bnxt_tc_parse_actions(struct bnxt *bp, struct bnxt_tc_actions *actions, struct tcf_exts *tc_exts) @@ -123,9 +141,35 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, bnxt_tc_parse_vlan(bp, actions, tc_act); continue; } + + /* Tunnel encap */ + if (is_tcf_tunnel_set(tc_act)) { + rc = bnxt_tc_parse_tunnel_set(bp, actions, tc_act); + if (rc) + return rc; + continue; + } + + /* Tunnel decap */ +