wifi: mac80211: add support for letting drivers register tc offload support
PATCH 1/1 wifi: mac80211: add support for letting drivers register tc offload support
On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is needed.
--- include/net/mac80211.h | 9 +++++++++ net/mac80211/driver-ops.h | 17 +++++++++++++++++ net/mac80211/ieee80211_i.h | 3 ++- net/mac80211/iface.c | 17 +++++++++++++++++ net/mac80211/trace.h | 25 +++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 1 deletion(-)
include/net/mac80211.h +9 -0
@@ -4227,6 +4227,10 @@ struct ieee80211_prep_tx_info {* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. This is * not restored at HW reset by mac80211 so drivers need to take care of * that. +* @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware +* flow offloading for flows originating from the vif. +* Note that the driver must not assume that the vif driver_data is valid +* at this point, since the callback can be called during netdev teardown. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,
@@ -4593,6 +4597,11 @@ struct ieee80211_ops {int (*set_hw_timestamp)(struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct cfg80211_set_hw_timestamp *hwts); +int (*net_setup_tc)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct net_device *dev, +enum tc_setup_type type, +void *type_data); };/**
net/mac80211/driver-ops.h +17 -0
@@ -1502,6 +1502,23 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,return ret; } +static inline int drv_net_setup_tc (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +struct net_device *dev, +enum tc_setup_type type,void *type_data) +{ +int ret = -EOPNOTSUPP ; + + sdata =get_bss_sdata (sdata); +trace_drv_net_setup_tc (local, sdata, type); +if (local->ops->net_setup_tc) + ret = local->ops->net_setup_tc (&local->hw, &sdata->vif, dev, + type, type_data); +trace_drv_return_int (local, ret); + +return ret; +} + int drv_change_vif_links(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, u16 old_links, u16 new_links,
net/mac80211/ieee80211_i.h +2 -1
@@ -1939,7 +1939,8 @@ void ieee80211_color_collision_detection_work(struct work_struct *work);/* interface handling */ #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ NETIF_F_HW_CSUM | NETIF_F_SG | \ - NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE) + NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \ + NETIF_F_HW_TC)#define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM)#define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \ MAC80211_SUPPORTED_FEATURES_RX)
net/mac80211/iface.c +17 -0
@@ -813,6 +813,21 @@ ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)dev_fetch_sw_netstats (stats, dev->tstats); } +static int ieee80211_netdev_setup_tc (struct net_device *dev, +enum tc_setup_type type,void *type_data) +{ +struct ieee80211_sub_if_data *sdata; +struct ieee80211_local *local; + + sdata =IEEE80211_DEV_TO_SUB_IF (dev); + local = sdata->local; + +if (!local->ops->net_setup_tc) +return -EOPNOTSUPP ; + +return drv_net_setup_tc (local, sdata, dev, type, type_data); +} +static const struct net_device_ops ieee80211_dataif_ops = { .ndo_open = ieee80211_open, .ndo_stop = ieee80211_stop,
@@ -821,6 +836,7 @@ static const struct net_device_ops ieee80211_dataif_ops = { .ndo_set_rx_mode = ieee80211_set_multicast_list, .ndo_set_mac_address = ieee80211_change_mac, .ndo_get_stats64 = ieee80211_get_stats64, + .ndo_setup_tc = ieee80211_netdev_setup_tc, }; static u16 ieee80211_monitor_select_queue(struct net_device *dev,
@@ -929,6 +945,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { .ndo_set_mac_address = ieee80211_change_mac, .ndo_get_stats64 = ieee80211_get_stats64, .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, + .ndo_setup_tc = ieee80211_netdev_setup_tc, };static bool ieee80211_iftype_supports_hdr_offload (enum nl80211_iftype iftype)
net/mac80211/trace.h +25 -0
@@ -2478,6 +2478,31 @@ DEFINE_EVENT(sta_event, drv_net_fill_forward_path,TP_ARGS (local, sdata, sta) ); +TRACE_EVENT (drv_net_setup_tc, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + u8 type), + +TP_ARGS (local, sdata, type), + +TP_STRUCT__entry ( + LOCAL_ENTRY + VIF_ENTRY +__field (u8, type) + ), + +TP_fast_assign ( + LOCAL_ASSIGN; + VIF_ASSIGN; + __entry->type = type; + ), + +TP_printk ( + LOCAL_PR_FMT VIF_PR_FMT " type:%d\n", +LOCAL_PR_ARG ,VIF_PR_ARG , __entry->type, __entry->new_links + ) +); + TRACE_EVENT(drv_change_vif_links, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata,
Signature · 1 line
2.39.0
kernel test robot
build botI love your patch! Yet something to improve:
Hi Felix,
I love your patch! Yet something to improve:
[auto build test ERROR on wireless-next/main]
[also build test ERROR on next-20230320]
[cannot apply to wireless/main linus/master v6.3-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Felix-Fietkau/wifi-mac80211-add-support-for-letting-drivers-register-tc-offload-support/20230320-213243 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230320133103.40724-1-nbd%40nbd.name patch subject: [PATCH] wifi: mac80211: add support for letting drivers register tc offload support config: i386-randconfig-a005 (https://download.01.org/0day-ci/archive/20230321/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/462e7ebc43a4631d478861a9027e7940462c2e4b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Felix-Fietkau/wifi-mac80211-add-support-for-letting-drivers-register-tc-offload-support/20230320-213243 git checkout 462e7ebc43a4631d478861a9027e7940462c2e4b # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=i386 olddefconfig make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/mac80211/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from include/trace/define_trace.h:102,
from net/mac80211/trace.h:3060,
from net/mac80211/trace.c:11:
net/mac80211/./trace.h: In function 'trace_raw_output_drv_net_setup_tc':
>> net/mac80211/./trace.h:2502:65: error: 'struct trace_event_raw_drv_net_setup_tc' has no member named 'new_links'
2502 | LOCAL_PR_ARG, VIF_PR_ARG, __entry->type, __entry->new_links
| ^~
include/trace/trace_events.h:203:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
203 | trace_event_printf(iter, print); \
| ^~~~~
include/trace/trace_events.h:45:30: note: in expansion of macro 'PARAMS'
45 | PARAMS(print)); \
| ^~~~~~
net/mac80211/./trace.h:2481:1: note: in expansion of macro 'TRACE_EVENT'
2481 | TRACE_EVENT(drv_net_setup_tc,
| ^~~~~~~~~~~
net/mac80211/./trace.h:2500:9: note: in expansion of macro 'TP_printk'
2500 | TP_printk(
| ^~~~~~~~~vim +2502 net/mac80211/./trace.h
2480
2481 TRACE_EVENT(drv_net_setup_tc,
2482 TP_PROTO(struct ieee80211_local *local,
2483 struct ieee80211_sub_if_data *sdata,
2484 u8 type),
2485
2486 TP_ARGS(local, sdata, type),
2487
2488 TP_STRUCT__entry(
2489 LOCAL_ENTRY
2490 VIF_ENTRY
2491 __field(u8, type)
2492 ),
2493
2494 TP_fast_assign(
2495 LOCAL_ASSIGN;
2496 VIF_ASSIGN;
2497 __entry->type = type;
2498 ),
2499
2500 TP_printk(
2501 LOCAL_PR_FMT VIF_PR_FMT " type:%d\n",
> 2502 LOCAL_PR_ARG, VIF_PR_ARG, __entry->type, __entry->new_links
2503 )
2504 );
2505
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botI love your patch! Yet something to improve:
Hi Felix,
I love your patch! Yet something to improve:
[auto build test ERROR on wireless-next/main]
[also build test ERROR on next-20230320]
[cannot apply to wireless/main linus/master v6.3-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Felix-Fietkau/wifi-mac80211-add-support-for-letting-drivers-register-tc-offload-support/20230320-213243 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230320133103.40724-1-nbd%40nbd.name patch subject: [PATCH] wifi: mac80211: add support for letting drivers register tc offload support config: x86_64-buildonly-randconfig-r005-20230320 (https://download.01.org/0day-ci/archive/20230321/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/462e7ebc43a4631d478861a9027e7940462c2e4b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Felix-Fietkau/wifi-mac80211-add-support-for-letting-drivers-register-tc-offload-support/20230320-213243 git checkout 462e7ebc43a4631d478861a9027e7940462c2e4b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/mac80211/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from net/mac80211/trace.c:11:
In file included from net/mac80211/./trace.h:3060:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:237:
>> net/mac80211/./trace.h:2502:53: error: no member named 'new_links' in 'struct trace_event_raw_drv_net_setup_tc'
LOCAL_PR_ARG, VIF_PR_ARG, __entry->type, __entry->new_links
~~~~~~~ ^
include/trace/stages/stage3_trace_output.h:9:43: note: expanded from macro 'TP_printk'
#define TP_printk(fmt, args...) fmt "\n", args
^~~~
include/trace/trace_events.h:45:16: note: expanded from macro 'TRACE_EVENT'
PARAMS(print)); \
^~~~~
include/linux/tracepoint.h:107:25: note: expanded from macro 'PARAMS'
#define PARAMS(args...) args
^~~~
include/trace/trace_events.h:203:27: note: expanded from macro 'DECLARE_EVENT_CLASS'
trace_event_printf(iter, print); \
^~~~~1 error generated.
vim +2502 net/mac80211/./trace.h
2480
2481 TRACE_EVENT(drv_net_setup_tc,
2482 TP_PROTO(struct ieee80211_local *local,
2483 struct ieee80211_sub_if_data *sdata,
2484 u8 type),
2485
2486 TP_ARGS(local, sdata, type),
2487
2488 TP_STRUCT__entry(
2489 LOCAL_ENTRY
2490 VIF_ENTRY
2491 __field(u8, type)
2492 ),
2493
2494 TP_fast_assign(
2495 LOCAL_ASSIGN;
2496 VIF_ASSIGN;
2497 __entry->type = type;
2498 ),
2499
2500 TP_printk(
2501 LOCAL_PR_FMT VIF_PR_FMT " type:%d\n",
> 2502 LOCAL_PR_ARG, VIF_PR_ARG, __entry->type, __entry->new_links
2503 )
2504 );
2505
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botI love your patch! Yet something to improve:
Hi Felix,
I love your patch! Yet something to improve:
[auto build test ERROR on wireless-next/main]
[also build test ERROR on next-20230320]
[cannot apply to wireless/main linus/master v6.3-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Felix-Fietkau/wifi-mac80211-add-support-for-letting-drivers-register-tc-offload-support/20230320-213243 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230320133103.40724-1-nbd%40nbd.name patch subject: [PATCH] wifi: mac80211: add support for letting drivers register tc offload support config: hexagon-randconfig-r022-20230319 (https://download.01.org/0day-ci/archive/20230321/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/462e7ebc43a4631d478861a9027e7940462c2e4b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Felix-Fietkau/wifi-mac80211-add-support-for-letting-drivers-register-tc-offload-support/20230320-213243 git checkout 462e7ebc43a4631d478861a9027e7940462c2e4b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from net/mac80211/trace.c:7:
In file included from include/net/cfg80211.h:13:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from net/mac80211/trace.c:7:
In file included from include/net/cfg80211.h:13:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from net/mac80211/trace.c:7:
In file included from include/net/cfg80211.h:13:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
In file included from net/mac80211/trace.c:11:
In file included from net/mac80211/trace.h:3060:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:237:
>> net/mac80211/trace.h:2502:53: error: no member named 'new_links' in 'struct trace_event_raw_drv_net_setup_tc'
LOCAL_PR_ARG, VIF_PR_ARG, __entry->type, __entry->new_links
~~~~~~~ ^
include/trace/stages/stage3_trace_output.h:9:43: note: expanded from macro 'TP_printk'
#define TP_printk(fmt, args...) fmt "\n", args
^~~~
include/trace/trace_events.h:45:16: note: expanded from macro 'TRACE_EVENT'
PARAMS(print)); \
^~~~~
include/linux/tracepoint.h:107:25: note: expanded from macro 'PARAMS'
#define PARAMS(args...) args
^~~~
include/trace/trace_events.h:203:27: note: expanded from macro 'DECLARE_EVENT_CLASS'
trace_event_printf(iter, print); \
^~~~~6 warnings and 1 error generated.
vim +2502 net/mac80211/trace.h
2480
2481 TRACE_EVENT(drv_net_setup_tc,
2482 TP_PROTO(struct ieee80211_local *local,
2483 struct ieee80211_sub_if_data *sdata,
2484 u8 type),
2485
2486 TP_ARGS(local, sdata, type),
2487
2488 TP_STRUCT__entry(
2489 LOCAL_ENTRY
2490 VIF_ENTRY
2491 __field(u8, type)
2492 ),
2493
2494 TP_fast_assign(
2495 LOCAL_ASSIGN;
2496 VIF_ASSIGN;
2497 __entry->type = type;
2498 ),
2499
2500 TP_printk(
2501 LOCAL_PR_FMT VIF_PR_FMT " type:%d\n",
> 2502 LOCAL_PR_ARG, VIF_PR_ARG, __entry->type, __entry->new_links
2503 )
2504 );
2505
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests