net/tap RSS BPF rewrite
Subsystems (2)
Re: [PATCH v15 07/11] net/tap: use libbpf to load new BPF program
In reply to Stephen HemmingerHi, I've added the Ubuntu 24.04 environment to the Community Lab but without werror enabled as the rte_pcapng.c warning would cause them to fail. Once the rte_pcapng.c warning is fixed, I will re-enable werror. I will send an email to the ci mailing list with the logs of the warning so that people are aware of it.
Thanks,
Cody
Quoted 1,000 lines · Stephen Hemminger
There were multiple issues in the RSS queue support in the TAP driver. This required extensive rework of the BPF support.
Change the BPF loading to use bpftool to
create a skeleton header file, and load with libbpf. The BPF is always compiled from source so less chance that source and instructions diverge. Also resolves issue where libbpf and source get out of sync. The program
is only loaded once, so if multiple rules are created only one BPF program is loaded in kernel.The new BPF program only needs a single action.
No need for action and re-classification step.It also fixes the missing bits from the original.
- supports setting RSS key per flow
- level of hash can be L3 or L3/L4.Bugzilla ID: 1329
Signed-off-by Stephen Hemminger <[email protected]>--- doc/guides/rel_notes/release_24_07.rst | 3 + drivers/net/tap/bpf/meson.build | 81 +++-- drivers/net/tap/meson.build | 39 ++- drivers/net/tap/rte_eth_tap.c | 14 +- drivers/net/tap/rte_eth_tap.h | 6 +- drivers/net/tap/tap_flow.c | 416 ++++++------------------- drivers/net/tap/tap_flow.h | 17 +- drivers/net/tap/tap_rss.h | 10 +- drivers/net/tap/tap_tcmsgs.h | 4 +- 9 files changed, 186 insertions(+), 404 deletions(-)doc/guides/rel_notes/release_24_07.rst +3
-0@@ -59,6 +59,9 @@ New Features * Updated to support up to 8 queues when used by secondary process. + * Fixed support of RSS flow action to work with current Linux + kernels and BPF tooling. Will only be enabled if clang, libbpf 1.0 + and bpftool are available. Removed Items -------------drivers/net/tap/bpf/meson.build +14
-5@@ -1,17 +1,26 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2024 Stephen Hemminger <[email protected]> -enable_tap_rss = false - -libbpf = dependency('libbpf', required: false, method: 'pkg-config') +# Loading BPF requires libbpf +# and the bpf_map__XXX API's were introduced in 0.8.0 +libbpf = dependency('libbpf', version: '>= 1.0', + required: false, method: 'pkg-config') if not libbpf.found() message('net/tap: no RSS support missing libbpf') subdir_done() endif +# Making skeleton needs bpftool # Debian install this in /usr/sbin which is not in $PATH -bpftool = find_program('bpftool', '/usr/sbin/bpftool', required: false, version: '>= 5.6.0') -if not bpftool.found() +bpftool_supports_skel = false +bpftool = find_program('bpftool', '/usr/sbin/bpftool', required: false) +if bpftool.found() + # Some Ubuntu versions have non-functional bpftool + bpftool_supports_skel = run_command(bpftool, 'gen', 'help', + check:false).returncode() == 0 +endif + +if not bpftool_supports_skel message('net/tap: no RSS support missing bpftool') subdir_done()endif
drivers/net/tap/bpf/meson.build +33
-29@@ -39,43 +48,47 @@ machine_name = run_command('uname', '-m').stdout().strip() march_include_dir = '/usr/include/' + machine_name + '-linux-gnu' clang_flags = [ - '-O2', - '-Wall', - '-Wextra', - '-target', - 'bpf', - '-g', - '-c', + # these are flags used to build the BPF code + '-O2', + '-Wall', + '-Wextra', + max_queues, + '-target', + 'bpf', + '-g', + '-c', ] +# Command used to compile BPF pgrograme bpf_o_cmd = [ - clang, - clang_flags, - '-idirafter', - libbpf_include_dir, - '-idirafter', - march_include_dir, - '@INPUT@', - '-o', - '@OUTPUT@' + clang, + clang_flags, + '-idirafter', + libbpf_include_dir, + '-idirafter', + march_include_dir, + '@INPUT@', + '-o', + '@OUTPUT@', ] +# Command used to generate header file from BPF object skel_h_cmd = [ - bpftool, - 'gen', - 'skeleton', - '@INPUT@' + bpftool, + 'gen', + 'skeleton', + '@INPUT@', ] tap_rss_o = custom_target( - 'tap_rss.bpf.o', - input: 'tap_rss.c', - output: 'tap_rss.o', - command: bpf_o_cmd) + 'tap_rss.bpf.o', + input: 'tap_rss.c', + output: 'tap_rss.o', + command: bpf_o_cmd) tap_rss_skel_h = custom_target( - 'tap_rss.skel.h', - input: tap_rss_o, - output: 'tap_rss.skel.h', - command: skel_h_cmd, - capture: true) + 'tap_rss.skel.h', + input: tap_rss_o, + output: 'tap_rss.skel.h', + command: skel_h_cmd, + capture: true)drivers/net/tap/meson.build +18
-21@@ -5,36 +5,33 @@ if not is_linux build = false reason = 'only supported on Linux' endif + sources = files( 'rte_eth_tap.c', 'tap_intr.c', 'tap_netlink.c', ) +deps = ['bus_vdev', 'gso', 'hash'] + +max_queues = '-DTAP_MAX_QUEUES=16' +cflags += max_queues + +require_iova_in_mbuf = false + if cc.has_header_symbol('linux/pkt_cls.h', 'TCA_FLOWER_ACT') cflags += '-DHAVE_TCA_FLOWER' sources += files( - 'tap_bpf_api.c', - 'tap_flow.c', - 'tap_tcmsgs.c', + 'tap_flow.c', + 'tap_tcmsgs.c', ) -endif - -deps = ['bus_vdev', 'gso', 'hash'] -cflags += '-DTAP_MAX_QUEUES=16' - -# input array for meson symbol search: -# [ "MACRO to define if found", "header for the search", -# "enum/define", "symbol to search" ] -# -args = [ - [ 'HAVE_TC_ACT_BPF', 'linux/tc_act/tc_bpf.h', 'TCA_ACT_BPF_UNSPEC' ], -] -config = configuration_data() -foreach arg:args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2])) -endforeach -configure_file(output : 'tap_autoconf.h', configuration : config) + enable_tap_rss = false -require_iova_in_mbuf = false + subdir('bpf') + if enable_tap_rss + cflags += '-DHAVE_BPF_RSS' + ext_deps += libbpf + sources += tap_rss_skel_h + endif +endifdrivers/net/tap/rte_eth_tap.c +2
-0@@ -1140,6 +1140,7 @@ tap_dev_close(struct rte_eth_dev *dev)tap_flow_implicit_flush (internals,NULL );tap_nl_final (internals->nlsk_fd); internals->nlsk_fd =-1 ; + tap_flow_bpf_destroy(internals); }#endif @@ -1949,6 +1950,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev,const char *tap_name, strlcpy(pmd->name, tap_name, sizeof(pmd->name)); pmd->type = type; pmd->ka_fd =-1 ; +#ifdef HAVE_TCA_FLOWER pmd->nlsk_fd =-1 ;#endif
drivers/net/tap/rte_eth_tap.c +0
-7@@ -2031,13 +2033,6 @@ eth_dev_tap_create(struct rte_vdev_device *vdev,const char *tap_name,/* Make network device persist after application exit */ pmd->persist = persist; - pmd->if_index =if_nametoindex (pmd->name); -if (!pmd->if_index) { -TAP_LOG (ERR ,"%s: failed to get if_index." , pmd->name); - goto disable_rte_flow; - } - -#ifdef HAVE_TCA_FLOWER /* * Set up everything related to
rte_flow:drivers/net/tap/rte_eth_tap.c +5
-0@@ -2053,6 +2048,11 @@ eth_dev_tap_create(struct rte_vdev_device *vdev,const char *tap_name, pmd->name); goto disable_rte_flow; } + pmd->if_index =if_nametoindex (pmd->name); +if (!pmd->if_index) { +TAP_LOG (ERR ,"%s: failed to get if_index." , pmd->name); + goto disable_rte_flow; + }if (qdisc_create_multiq (pmd->nlsk_fd, pmd->if_index) <0 ) { TAP_LOG(ERR, "%s: failed to create multiq qdisc.",pmd->name);drivers/net/tap/rte_eth_tap.h +0
-0@@ -81,10 +81,8 @@ struct pmd_internals {#ifdef HAVE_TCA_FLOWER int nlsk_fd;/* Netlink socket fd */ int flow_isolate;/* 1 if flow isolation is enabled */
drivers/net/tap/rte_eth_tap.h +2
-4-int rss_enabled;/* 1 if RSS is enabled, else 0 */ -/* implicit rules set when RSS is enabled */ -int map_fd;/* BPF RSS map fd */ -int bpf_fd[RTE_PMD_TAP_MAX_QUEUES ];/* List of bpf fds per queue */ + +struct tap_rss *rss;/* BPF program */ LIST_HEAD(tap_flows, rte_flow) flows; /* rte_flow rules *//* implicit rte_flow rules set when a remote device is active */ drivers/net/tap/tap_flow.c +8
-14@@ -15,25 +15,19 @@#include <rte_random.h> #include <rte_malloc.h> #include <rte_eth_tap.h> +#include <rte_uuid.h> #include <tap_flow.h> -#include <tap_autoconf.h> #include <tap_tcmsgs.h> #include <tap_rss.h> -/* RSS key management */ -enum bpf_rss_key_e { -KEY_CMD_GET =1 , -KEY_CMD_RELEASE , -KEY_CMD_INIT , -KEY_CMD_DEINIT , -}; - -enum key_status_e { -KEY_STAT_UNSPEC , -KEY_STAT_USED , -KEY_STAT_AVAILABLE , -}; +#ifdef HAVE_BPF_RSS +/* Workaround for warning in bpftool generated skeleton code */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" +#include "tap_rss.skel.h" +#pragma GCC diagnostic pop +#endif #define ISOLATE_HANDLE 1#define REMOTE_PROMISCUOUS_HANDLE 2@@ -41,8 +35,6 @@ enum key_status_e {struct rte_flow {LIST_ENTRY (rte_flow) next;/* Pointer to the next rte_flow structure */
structrte_flow*remote_flow; /* associated remote flow */drivers/net/tap/tap_flow.c +7
-6-int bpf_fd[SEC_MAX ];/* list of bfs fds per ELF section */ -uint32_t key_idx;/* RSS rule key index into BPF map */ struct nlmsg msg; };@@ -69,12 +61,16 @@ struct action_data {struct skbedit {struct tc_skbedit skbedit;uint16_t queue; +uint32_t mark; } skbedit; +#ifdef HAVE_BPF_RSS struct bpf {struct tc_act_bpf bpf; +uint32_t map_key;int bpf_fd;const char *annotation; } bpf; +#endif }; };@@ -112,13 +108,12 @@ tap_flow_isolate(struct rte_eth_dev *dev,int set, struct rte_flow_error *error); -static int bpf_rss_key (enum bpf_rss_key_e cmd,__u32 *key_idx); -static int rss_enable (struct pmd_internals *pmd, -const struct rte_flow_attr *attr, -struct rte_flow_error *error); +#ifdef HAVE_BPF_RSS +static int rss_enable (struct pmd_internals *pmd,struct rte_flow_error *error);static int rss_add_actions (struct rte_flow *flow,struct pmd_internals *pmd,const struct rte_flow_action_rss *rss,struct rte_flow_error *error); +#endif static const struct
rte_flow_opstap_flow_ops= {
.validate =tap_flow_validate,drivers/net/tap/tap_flow.c +6
-4@@ -853,11 +848,13 @@ add_action(struct rte_flow *flow, size_t *act_index, struct action_data *adata) &adata->mirred); }else if (strcmp ("skbedit" , adata->id) ==0 ) {tap_nlattr_add (&msg->nh,TCA_SKBEDIT_PARMS , -sizeof (adata->skbedit.skbedit), - &adata->skbedit.skbedit); -tap_nlattr_add16 (&msg->nh,TCA_SKBEDIT_QUEUE_MAPPING , - adata->skbedit.queue); +sizeof (adata->skbedit.skbedit), &adata->skbedit.skbedit); +if (adata->skbedit.mark) +tap_nlattr_add32 (&msg->nh,TCA_SKBEDIT_MARK , adata->skbedit.mark); +else +tap_nlattr_add16 (&msg->nh,TCA_SKBEDIT_QUEUE_MAPPING , adata->skbedit.queue); }else if (strcmp ("bpf" , adata->id) ==0 ) { +#ifdef HAVE_BPF_RSS tap_nlattr_add32(&msg->nh, TCA_ACT_BPF_FD,adata->bpf.bpf_fd); tap_nlattr_add(&msg->nh, TCA_ACT_BPF_NAME, strlen(adata->bpf.annotation) + 1,drivers/net/tap/tap_flow.c +5
-0@@ -865,7 +862,12 @@ add_action(struct rte_flow *flow, size_t *act_index, struct action_data *adata) tap_nlattr_add(&msg->nh, TCA_ACT_BPF_PARMS,sizeof (adata->bpf.bpf), &adata->bpf.bpf); +#else +TAP_LOG (ERR ,"Internal error: bpf requested but not supported"); +return -1 ; +#endif }else { +TAP_LOG (ERR ,"Internal error: unknown action: %s" , adata->id);return -1; } tap_nlattr_nested_finish(msg); /* nested TCA_ACT_OPTIONS */drivers/net/tap/tap_flow.c +1
-2@@ -1104,8 +1106,7 @@ priv_flow_process(struct pmd_internals *pmd, }, }; - err =add_actions (flow,1 , &adata, -TCA_FLOWER_ACT ); + err =add_actions (flow,1 , &adata,TCA_FLOWER_ACT ); } }else if (actions->type ==RTE_FLOW_ACTION_TYPE_QUEUE ) {const struct
rte_flow_action_queue*queue =drivers/net/tap/tap_flow.c +4
-2@@ -1135,6 +1136,7 @@ priv_flow_process(struct pmd_internals *pmd, err =add_actions (flow,1 , &adata,TCA_FLOWER_ACT ); } +#ifdef HAVE_BPF_RSS }else if (actions->type ==RTE_FLOW_ACTION_TYPE_RSS ) {const struct rte_flow_action_rss *rss = (const struct rte_flow_action_rss *)@@ -1143,13 +1145,14 @@ priv_flow_process(struct pmd_internals *pmd,if (action++) goto exit_action_not_supported; -if (!pmd->rss_enabled) { - err =rss_enable (pmd, attr, error); +if (pmd->rss ==NULL ) { + err =rss_enable (pmd, error);if (err) goto exit_return_error; }if (flow) err =rss_add_actions (flow, pmd, rss, error); +#endif }else { goto exit_action_not_supported;}drivers/net/tap/tap_flow.c +7
-16@@ -1246,26 +1249,17 @@ tap_flow_set_handle(struct rte_flow *flow)* */ static void -tap_flow_free (struct pmd_internals *pmd,struct rte_flow *flow) +tap_flow_free(struct pmd_internals *pmd __rte_unused, struct rte_flow *flow) { -int i; -if (!flow)return ; -if (pmd->rss_enabled) { -/* Close flow BPF file descriptors */ -for (i =0 ; i <SEC_MAX ; i++) -if (flow->bpf_fd[i] !=0 ) { -close (flow->bpf_fd[i]); - flow->bpf_fd[i] =0 ; - } - -/* Release the map key for this RSS rule */ -bpf_rss_key (KEY_CMD_RELEASE , &flow->key_idx); - flow->key_idx =0 ; - } - +#ifdef HAVE_BPF_RSS +struct tap_rss *rss = pmd->rss; +if (rss) +bpf_map__delete_elem (rss->maps.rss_map, + &flow->msg.t.tcm_handle,sizeof (uint32_t ),0 ); +#endif /* Free flow allocated memory */ rte_free(flow);}
drivers/net/tap/tap_flow.c +11
-7@@ -1733,14 +1727,18 @@ tap_flow_implicit_flush(struct pmd_internals *pmd, struct rte_flow_error *error)return 0 ; } -#define MAX_RSS_KEYS 256 -#define KEY_IDX_OFFSET (3 * MAX_RSS_KEYS) -#define SEC_NAME_CLS_Q "cls_q" - -static const char *sec_name[SEC_MAX ] = { - [SEC_L3_L4 ] ="l3_l4" , -}; +/** +* Cleanup when device is closed +*/ +void tap_flow_bpf_destroy(struct pmd_internals *pmd __rte_unused) +{ +#ifdef HAVE_BPF_RSS +tap_rss__destroy (pmd->rss); + pmd->rss =NULL ; +#endif +} +#ifdef HAVE_BPF_RSS /** * Enable RSS on tap: create TC rules for queuing. *
drivers/net/tap/tap_flow.c +1
-31@@ -1755,225 +1753,32 @@ static const char *sec_name[SEC_MAX] = {* * @return 0 on success, negative value on failure. */ -static int rss_enable (struct pmd_internals *pmd, -const struct rte_flow_attr *attr, -struct rte_flow_error *error) +static int rss_enable (struct pmd_internals *pmd,struct rte_flow_error *error) { -struct rte_flow *rss_flow =NULL ; -struct nlmsg *msg =NULL ; -/* 4096 is the maximum number of instructions for a BPF program */ -char annotation[64 ]; -int i; -int err =0 ; - -/* unlimit locked memory */ -struct rlimit memlock_limit = { - .rlim_cur =RLIM_INFINITY , - .rlim_max =RLIM_INFINITY , - }; -setrlimit (RLIMIT_MEMLOCK , &memlock_limit); - -/* Get a new map key for a new RSS rule */ - err =bpf_rss_key (KEY_CMD_INIT ,NULL ); -if (err <0 ) { -rte_flow_error_set ( - error,EINVAL ,RTE_FLOW_ERROR_TYPE_HANDLE ,NULL , -"Failed to initialize BPF RSS keys" ); - -return -1 ; - } - -/* -* Create BPF RSS MAP -*/ - pmd->map_fd = tap_flow_bpf_rss_map_create(sizeof(__u32), /* keysize */
drivers/net/tap/tap_flow.c +0
-16-sizeof (struct rss_key ), - MAX_RSS_KEYS); -if (pmd->map_fd <0 ) { -TAP_LOG (ERR , -"Failed to create BPF map (%d): %s" , - errno,strerror (errno)); -rte_flow_error_set ( - error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_HANDLE ,NULL , -"Kernel too old or not configured " -"to support BPF maps" ); - -return -ENOTSUP ; - } - -/* -* Add a rule per queue to match reclassified packets and direct them to
drivers/net/tap/tap_flow.c +0
-7-* the correct queue. -*/ -for (i =0 ; i < pmd->dev->data->nb_rx_queues; i++) { - pmd->bpf_fd[i] =tap_flow_bpf_cls_q (i); -if (pmd->bpf_fd[i] <0 ) { - TAP_LOG(ERR, - "Failed to load BPF section %s for queue%d",
drivers/net/tap/tap_flow.c +0
-11- SEC_NAME_CLS_Q, i); -rte_flow_error_set ( - error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_HANDLE , -NULL , -"Kernel too old or not configured " -"to support BPF programs loading" ); - -return -ENOTSUP ; - } - - rss_flow = rte_zmalloc(__func__, sizeof(struct rte_flow),0);
drivers/net/tap/tap_flow.c +0
-7-if (!rss_flow) { -TAP_LOG (ERR , -"Cannot allocate memory for rte_flow" ); -return -1 ; - } - msg = &rss_flow->msg; - tc_init_msg(msg, pmd->if_index, RTM_NEWTFILTER,
NLM_F_REQUEST|drivers/net/tap/tap_flow.c +1
-28- NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE); - msg->t.tcm_info =TC_H_MAKE (0 ,htons (ETH_P_ALL )); -tap_flow_set_handle (rss_flow); -uint16_t group = attr->group <<GROUP_SHIFT ; -uint16_t prio = group | (i +PRIORITY_OFFSET ); - msg->t.tcm_info =TC_H_MAKE (prio <<16 , msg->t.tcm_info); - msg->t.tcm_parent =TC_H_MAKE (MULTIQ_MAJOR_HANDLE ,0 ); - -tap_nlattr_add (&msg->nh,TCA_KIND ,sizeof ("bpf" ),"bpf" ); -if (tap_nlattr_nested_start (msg,TCA_OPTIONS ) <0 ) -return -1 ; -tap_nlattr_add32 (&msg->nh,TCA_BPF_FD , pmd->bpf_fd[i]); -snprintf (annotation,sizeof (annotation),"[%s%d]" , -SEC_NAME_CLS_Q , i); -tap_nlattr_add (&msg->nh,TCA_BPF_NAME ,strlen (annotation) + 1, - annotation); -/* Actions */ - { -struct action_data adata = { - .id ="skbedit" , - .skbedit = { - .skbedit = { - .action =TC_ACT_PIPE , - }, - .queue = i, - }, - }; - if (add_actions(rss_flow, 1, &adata, TCA_BPF_ACT)< 0)
drivers/net/tap/tap_flow.c +1
-10-return -1 ; - } -tap_nlattr_nested_finish (msg);/* nested TCA_OPTIONS */ +int err; -/* Netlink message is now ready to be sent */ -if (tap_nl_send (pmd->nlsk_fd, &msg->nh) <0 ) -return -1 ; - err =tap_nl_recv_ack (pmd->nlsk_fd); -if (err <0 ) { - TAP_LOG(ERR, - "Kernel refused TC filter rule creation(%d): %s",
drivers/net/tap/tap_flow.c +4
-3- errno, strerror(errno)); -return err; - } +/* Load the BPF program (defined in tap_bpf.h from skeleton) */ + pmd->rss =tap_rss__open_and_load (); +if (pmd->rss ==NULL ) { + TAP_LOG(ERR, "Failed to load BPF object: %s",strerror(errno));
+ rte_flow_error_set(error, errno,RTE_FLOW_ERROR_TYPE_HANDLE, NULL,drivers/net/tap/tap_flow.c +2
-12+ "BPF object could not be loaded"); +return -errno; } - pmd->rss_enabled =1 ; -return err; -} - -/** -* Manage bpf RSS keys repository with operations: init, get, release -* -* @param[in] cmd -* Command on RSS keys: init, get, release -* -* @param[in, out] key_idx -* Pointer to RSS Key index (out for get command, in for release command)
- *
- * @return -1 if couldn't get, release or init the RSS keys, 0 otherwise.
- */drivers/net/tap/tap_flow.c +0
-51-static int bpf_rss_key (enum bpf_rss_key_e cmd,__u32 *key_idx) -{ -__u32 i; -int err =0 ; -static __u32 num_used_keys; -static __u32 rss_keys[MAX_RSS_KEYS ] = {KEY_STAT_UNSPEC }; -static __u32 rss_keys_initialized; -__u32 key; - -switch (cmd) { -case KEY_CMD_GET : -if (!rss_keys_initialized) { - err =-1 ; -break ; - } - -if (num_used_keys ==RTE_DIM (rss_keys)) { - err =-1 ; -break ; - } - - *key_idx = num_used_keys %RTE_DIM (rss_keys); -while (rss_keys[*key_idx] ==KEY_STAT_USED ) - *key_idx = (*key_idx +1 ) %RTE_DIM (rss_keys); - - rss_keys[*key_idx] =KEY_STAT_USED ; - -/* -* Add an offset to key_idx in order to handle a case of -* RSS and non RSS flows mixture. -* If a non RSS flow is destroyed it has an eBPF map -* index 0 (initialized on flow creation) and might -* unintentionally remove RSS entry 0 from eBPF map. -* To avoid this issue, add an offset to the real index -* during a KEY_CMD_GET operation and subtract this offset -* during a KEY_CMD_RELEASE operation in order to restore -* the real index. -*/ - *key_idx +=KEY_IDX_OFFSET ; - num_used_keys++; -break ; - -case KEY_CMD_RELEASE : -if (!rss_keys_initialized) -break ; - -/* -* Subtract offset to restore real key index -* If a non RSS flow is falsely trying to release map -* entry 0 - the offset subtraction will calculate the real -* map index as an out-of-range value and the release operation
drivers/net/tap/tap_flow.c +5
-30-* will be silently ignored. -*/ - key = *key_idx -KEY_IDX_OFFSET ; -if (key >=RTE_DIM (rss_keys)) -break ; - -if (rss_keys[key] ==KEY_STAT_USED ) { - rss_keys[key] =KEY_STAT_AVAILABLE ; - num_used_keys--; - } -break ; - -case KEY_CMD_INIT : -for (i =0 ; i <RTE_DIM (rss_keys); i++) - rss_keys[i] =KEY_STAT_AVAILABLE ; - - rss_keys_initialized =1 ; - num_used_keys =0 ; -break ; - -case KEY_CMD_DEINIT : -for (i =0 ; i <RTE_DIM (rss_keys); i++) - rss_keys[i] =KEY_STAT_UNSPEC ; - - rss_keys_initialized =0 ; - num_used_keys =0 ; -break ; - -default : -break ; +/* Attach the maps defined in BPF program */ + err =tap_rss__attach (pmd->rss); +if (err <0 ) { +TAP_LOG (ERR ,"Failed to attach BPF object: %d" , err); + rte_flow_error_set(error, -err,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,drivers/net/tap/tap_flow.c +6
-2+ "BPF object could not be attached"); +tap_flow_bpf_destroy (pmd); +return err; } -return err; +return 0 ; } -/* Default RSS hash key also used by mlx devices */ static const uint8_t rss_hash_default_key[] = {0x2c ,0xc6 ,0x81 ,0xd1 ,@@ -2006,9 +1811,11 @@ static int rss_add_actions(struct rte_flow *flow,struct pmd_internals *pmd, const struct rte_flow_action_rss *rss, struct rte_flow_error *error) { + const struct bpf_program *rss_prog = pmd->rss->progs.rss_flow_action;struct rss_key rss_entry = { };const uint8_t *key_in;uint32_t hash_type =0 ; +uint32_t handle = flow->msg.t.tcm_handle;unsigned int i;int err;drivers/net/tap/tap_flow.c +28
-57@@ -2067,34 +1874,24 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd, else if (rss->types & (RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_IPV6_EX)) hash_type |= RTE_BIT32(HASH_FIELD_IPV6_L3); - /* Get a new map key for a new RSS rule */ - err = bpf_rss_key(KEY_CMD_GET, &flow->key_idx); -if (err <0 ) { -rte_flow_error_set ( - error,EINVAL ,RTE_FLOW_ERROR_TYPE_HANDLE ,NULL , -"Failed to get BPF RSS key" ); - -return -1 ; - } + rss_entry.hash_fields = hash_type; +rte_convert_rss_key ((const uint32_t *)key_in, (uint32_t *)rss_entry.key, +TAP_RSS_HASH_KEY_SIZE );/* Update RSS map entry with queues */ rss_entry.nb_queues = rss->queue_num;for (i =0 ; i < rss->queue_num; i++) rss_entry.queues[i] = rss->queue[i]; - rss_entry.hash_fields = hash_type; -rte_convert_rss_key ((const uint32_t *)key_in, (uint32_t *)rss_entry.key, -TAP_RSS_HASH_KEY_SIZE ); - - -/* Add this RSS entry to map */ - err =tap_flow_bpf_update_rss_elem (pmd->map_fd, - &flow->key_idx, &rss_entry); +/* Add this way for BPF to find entry in map */ + err =bpf_map__update_elem (pmd->rss->maps.rss_map, + &handle,sizeof (handle), + &rss_entry,sizeof (rss_entry),0 );if (err) {TAP_LOG (ERR , -"Failed to update BPF map entry #%u (%d): %s" , - flow->key_idx, errno,strerror (errno)); +"Failed to update BPF map entry %#x (%d): %s" , + handle, errno,strerror (errno));rte_flow_error_set ( error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_HANDLE ,NULL , "Kernel too old or not configured "@@ -2103,47 +1900,28 @@ static int rss_add_actions(struct rte_flow *flow,struct pmd_internals *pmd, return -ENOTSUP; } - -/* -* Load bpf rules to calculate hash for this key_idx -*/ - - flow->bpf_fd[SEC_L3_L4 ] = -tap_flow_bpf_calc_l3_l4_hash (flow->key_idx, pmd->map_fd); -if (flow->bpf_fd[SEC_L3_L4 ] <0 ) { -TAP_LOG (ERR , -"Failed to load BPF section %s (%d): %s" , - sec_name[SEC_L3_L4 ], errno, strerror(errno)); -rte_flow_error_set ( - error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_HANDLE ,NULL , -"Kernel too old or not configured " -"to support BPF program loading" ); - -return -ENOTSUP ; - } - -/* Actions */ - { -struct action_data adata[] = { - { - .id ="bpf" , - .bpf = { - .bpf_fd = flow->bpf_fd[SEC_L3_L4 ], - .annotation = sec_name[SEC_L3_L4 ], - .bpf = { - .action =TC_ACT_PIPE , - }, - }, +/* Add actions to mark packet then run the RSS BPF program */ +struct action_data adata[] = { + { + .id ="skbedit" , + .skbedit = { + .skbedit.action =TC_ACT_PIPE , + .mark = handle, }, - }; - -if (add_actions (flow,RTE_DIM (adata), adata, -TCA_FLOWER_ACT ) <0 ) -return -1 ; - } + }, + { + .id ="bpf" , + .bpf = { + .bpf.action =TC_ACT_PIPE , + .annotation ="tap_rss" , + .bpf_fd =bpf_program__fd (rss_prog), + }, + }, + }; -return 0 ; +return add_actions (flow,RTE_DIM (adata), adata,TCA_FLOWER_ACT ); } +#endif /**
* Getrte_flowoperations.drivers/net/tap/tap_flow.h +5
-1@@ -9,7 +9,11 @@#include <rte_flow.h> #include <rte_flow_driver.h> #include <rte_eth_tap.h> -#include <tap_autoconf.h> + +/** +* Mask of unsupported RSS types +*/ +#define TAP_RSS_HF_MASK (~(RTE_ETH_RSS_IP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_TCP))/** * In TC, priority 0 means we require the kernel to allocate one for us.
drivers/net/tap/tap_flow.h +1
-10@@ -41,11 +45,6 @@ enum implicit_rule_index { TAP_REMOTE_MAX_IDX, }; -enum bpf_fd_idx { -SEC_L3_L4 , -SEC_MAX , -}; -int tap_dev_flow_ops_get (struct rte_eth_dev *dev,const struct rte_flow_ops **ops);int tap_flow_flush (struct rte_eth_dev *dev,struct rte_flow_error *error);@@ -57,10 +56,6 @@ int tap_flow_implicit_destroy(struct pmd_internals *pmd,int tap_flow_implicit_flush (struct pmd_internals *pmd,struct rte_flow_error *error); -int tap_flow_bpf_cls_q (__u32 queue_idx); -int tap_flow_bpf_calc_l3_l4_hash (__u32 key_idx,int map_fd); -int tap_flow_bpf_rss_map_create (unsigned int key_size,unsigned int value_size, -unsigned int max_entries); -int tap_flow_bpf_update_rss_elem (int fd,void *key,void *value); +void tap_flow_bpf_destroy(struct pmd_internals *pmd);#endif /* _TAP_FLOW_H_ */
drivers/net/tap/tap_rss.h +4
-6@@ -5,16 +5,14 @@#ifndef _TAP_RSS_H_#define _TAP_RSS_H_ -#ifndef TAP_MAX_QUEUES -#define TAP_MAX_QUEUES 16 +/* Size of the map from BPF classid to queue table */ +#ifndef TAP_RSS_MAX +#define TAP_RSS_MAX 32#endif -/* Fixed RSS hash key size in bytes. */ +/* Standard Toeplitz hash key size */ #define TAP_RSS_HASH_KEY_SIZE 40 -/* Supported RSS */ -#define TAP_RSS_HF_MASK (~(RTE_ETH_RSS_IP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_TCP)) -/* hashed fields for RSS */ enum hash_field {HASH_FIELD_IPV4_L3, /* IPv4 src/dst addr */drivers/net/tap/tap_tcmsgs.h +2
-3@@ -6,7 +6,6 @@#ifndef _TAP_TCMSGS_H_#define _TAP_TCMSGS_H_ -#include <tap_autoconf.h> #include <linux/if_ether.h> #include <linux/rtnetlink.h> #include <linux/pkt_sched.h> @@ -14,9 +13,10 @@#include <linux/tc_act/tc_mirred.h> #include <linux/tc_act/tc_gact.h> #include <linux/tc_act/tc_skbedit.h> -#ifdef HAVE_TC_ACT_BPF +#ifdef HAVE_BPF_RSS #include <linux/tc_act/tc_bpf.h> #endif +#include <inttypes.h> #include <rte_ether.h> --2.43.0
PATCH v15 8/11 net/tap: remove no longer used files
In reply to Stephen HemmingerThe BPF api was replaced by use of libbpf. And the BPF instruction header is replaced by the new tap_rss.skel.h which is generated via bpftool.
--- drivers/net/tap/tap_bpf_api.c | 196 ---- drivers/net/tap/tap_bpf_insns.h | 1741 ------------------------------- 2 files changed, 1937 deletions(-) delete mode 100644 drivers/net/tap/tap_bpf_api.c delete mode 100644 drivers/net/tap/tap_bpf_insns.h
drivers/net/tap/tap_bpf_api.c deleted +0 -196
@@ -1,196 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2017 Mellanox Technologies, Ltd -*/ - -#include <unistd.h> -#include <syscall.h> -#include <linux/bpf.h> - -#include <tap_flow.h> -#include <tap_autoconf.h> - -#include <tap_bpf_insns.h> - - -static int bpf_load (enum bpf_prog_type type,const struct bpf_insn *insns, -size_t insns_cnt,const char *license); - -/** -* Load BPF program (section cls_q) into the kernel and return a bpf fd -* -* @param queue_idx -* Queue index matching packet cb -* -* @return -* -1 if the BPF program couldn't be loaded. An fd (int) otherwise. -*/ -int tap_flow_bpf_cls_q (__u32 queue_idx) -{ - cls_q_insns[1 ].imm = queue_idx; - -return bpf_load (BPF_PROG_TYPE_SCHED_CLS , - (struct bpf_insn *)cls_q_insns, -RTE_DIM (cls_q_insns), -"Dual BSD/GPL" ); -} - -/** -* Load BPF program (section l3_l4) into the kernel and return a bpf fd. -* -* @param[in] key_idx -* RSS MAP key index -* -* @param[in] map_fd -* BPF RSS map file descriptor -* -* @return -* -1 if the BPF program couldn't be loaded. An fd (int) otherwise. -*/ -int tap_flow_bpf_calc_l3_l4_hash (__u32 key_idx,int map_fd) -{ - l3_l4_hash_insns[4 ].imm = key_idx; - l3_l4_hash_insns[9 ].imm = map_fd; - -return bpf_load (BPF_PROG_TYPE_SCHED_ACT , - (struct bpf_insn *)l3_l4_hash_insns, -RTE_DIM (l3_l4_hash_insns), -"Dual BSD/GPL" ); -} - -/** -* Helper function to convert a pointer to unsigned 64 bits -* -* @param[in] ptr -* pointer to address -* -* @return -* 64 bit unsigned long type of pointer address -*/ -static inline __u64 ptr_to_u64 (const void *ptr) -{ -return (__u64 )(unsigned long )ptr; -} - -/** -* Call BPF system call -* -* @param[in] cmd -* BPF command for program loading, map creation, map entry update, etc -* -* @param[in] attr -* System call attributes relevant to system call command -* -* @param[in] size -* size of attr parameter -* -* @return -* -1 if BPF system call failed, 0 otherwise -*/ -static inline int sys_bpf (enum bpf_cmd cmd,union bpf_attr *attr, -unsigned int size) -{ -#ifdef __NR_bpf -return syscall (__NR_bpf, cmd, attr, size); -#else -TAP_LOG (ERR ,"No bpf syscall, kernel headers too old?\n" ); - errno =ENOSYS ; -return -1 ; -#endif -} - -/** -* Load BPF instructions to kernel -* -* @param[in] type -* BPF program type: classifier or action -* -* @param[in] insns -* Array of BPF instructions (equivalent to BPF instructions) -* -* @param[in] insns_cnt -* Number of BPF instructions (size of array) -* -* @param[in] license -* License string that must be acknowledged by the kernel -* -* @return -* -1 if the BPF program couldn't be loaded, fd (file descriptor) otherwise -*/ -static int bpf_load (enum bpf_prog_type type, -const struct bpf_insn *insns, -size_t insns_cnt, -const char *license) -{ -union bpf_attr attr = {}; - -bzero (&attr,sizeof (attr)); - attr.prog_type = type; - attr.insn_cnt = (__u32 )insns_cnt; - attr.insns =ptr_to_u64 (insns); - attr.license =ptr_to_u64 (license); - attr.log_buf =ptr_to_u64 (NULL ); - attr.log_level =0 ; - attr.kern_version =0 ; - -return sys_bpf (BPF_PROG_LOAD , &attr,sizeof (attr)); -} - -/** -* Create BPF map for RSS rules -* -* @param[in] key_size -* map RSS key size -* -* @param[in] value_size -* Map RSS value size -* -* @param[in] max_entries -* Map max number of RSS entries (limit on max RSS rules) -* -* @return -* -1 if BPF map couldn't be created, map fd otherwise -*/ -int tap_flow_bpf_rss_map_create (unsigned int key_size, -unsigned int value_size, -unsigned int max_entries) -{ -union bpf_attr attr = {}; - -bzero (&attr,sizeof (attr)); - attr.map_type =BPF_MAP_TYPE_HASH ; - attr.key_size = key_size; - attr.value_size = value_size; - attr.max_entries = max_entries; - -return sys_bpf (BPF_MAP_CREATE , &attr,sizeof (attr)); -} - -/** -* Update RSS entry in BPF map -* -* @param[in] fd -* RSS map fd -* -* @param[in] key -* Pointer to RSS key whose entry is updated -* -* @param[in] value -* Pointer to RSS new updated value -* -* @return -* -1 if RSS entry failed to be updated, 0 otherwise -*/ -int tap_flow_bpf_update_rss_elem (int fd,void *key,void *value) -{ -union bpf_attr attr = {}; - -bzero (&attr,sizeof (attr)); - - attr.map_type =BPF_MAP_TYPE_HASH ; - attr.map_fd = fd; - attr.key =ptr_to_u64 (key); - attr.value =ptr_to_u64 (value); - attr.flags =BPF_ANY ; - -return sys_bpf (BPF_MAP_UPDATE_ELEM , &attr,sizeof (attr)); -}
drivers/net/tap/tap_bpf_insns.h deleted +0 -1741
1,741 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v15 9/11 net/tap: simplify internals
In reply to Stephen HemmingerThe names of Linux network devices are IFNAMSIZ(16) not the same as DPDK which has up to 64 characters. Don't need to hold onto the whole ifreq to save the remote interface flags.
Make sure packet and byte counters are read once, so that global and per-queue values add up. No need for separate rx_nombuf counter since there is an alloc_failed value in ethdev.
Keep only the statistics that are used. I.e no ipackets on tx queues etc.
--- drivers/net/tap/rte_eth_tap.c | 138 ++++++++++++++++++---------------- drivers/net/tap/rte_eth_tap.h | 22 +++--- 2 files changed, 83 insertions(+), 77 deletions(-)
drivers/net/tap/rte_eth_tap.c +74 -64
@@ -46,6 +46,11 @@#include <tap_netlink.h> #include <tap_tcmsgs.h> +/* Used to snapshot statistics */ +#ifndef READ_ONCE +#define READ_ONCE (var) (*((volatile typeof(var) *)(&(var)))) +#endif +/* Linux based path to the TUN device */ #define TUN_TAP_DEV_PATH "/dev/net/tun"#define DEFAULT_TAP_NAME "dtap"
@@ -212,7 +217,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)* and need to find the resulting device. */ TAP_LOG (DEBUG ,"Device name is '%s'" , ifr.ifr_name); -strlcpy (pmd->name, ifr.ifr_name,RTE_ETH_NAME_MAX_LEN ); +strlcpy (pmd->name, ifr.ifr_name,IFNAMSIZ );if (is_keepalive) {/*
@@ -454,7 +459,7 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)/* Packet couldn't fit in the provided mbuf */ if (unlikely (rxq->pi.flags &TUN_PKT_STRIP )) { - rxq->stats.ierrors++; + rxq->stats.errors++;continue ; }
@@ -466,7 +471,8 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)struct rte_mbuf *buf =rte_pktmbuf_alloc (rxq->mp);if (unlikely (!buf)) { - rxq->stats.rx_nombuf++; + rte_eth_devices[rxq->in_port].data->rx_mbuf_alloc_failed++; +/* No new buf has been allocated: do nothing */ if (!new_tail || !seg) goto end;
@@ -511,8 +517,8 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) num_rx_bytes += mbuf->pkt_len; } end: - rxq->stats.ipackets += num_rx; - rxq->stats.ibytes += num_rx_bytes; + rxq->stats.packets += num_rx; + rxq->stats.bytes += num_rx_bytes;if (trigger && num_rx < nb_pkts) rxq->trigger_seen = trigger;
@@ -692,7 +698,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) tso_segsz = mbuf_in->tso_segsz + hdrs_len;if (unlikely (tso_segsz == hdrs_len) || tso_segsz > *txq->mtu) { - txq->stats.errs++; + txq->stats.errors++;break ; } gso_ctx->gso_size = tso_segsz;
@@ -730,7 +736,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ret =tap_write_mbufs (txq, num_mbufs, mbuf, &num_packets, &num_tx_bytes);if (ret ==-1 ) { - txq->stats.errs++; + txq->stats.errors++;/* free tso mbufs */ if (num_tso_mbufs >0 )rte_pktmbuf_free_bulk (mbuf, num_tso_mbufs);
@@ -748,9 +754,8 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } } - txq->stats.opackets += num_packets; - txq->stats.errs += nb_pkts - num_tx; - txq->stats.obytes += num_tx_bytes; + txq->stats.packets += num_packets; + txq->stats.bytes += num_tx_bytes;return num_tx; }
@@ -1047,43 +1052,44 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)static int tap_stats_get (struct rte_eth_dev *dev,struct rte_eth_stats *tap_stats) { -unsigned int i, imax; -unsigned long rx_total =0 , tx_total =0 , tx_err_total =0 ; -unsigned long rx_bytes_total =0 , tx_bytes_total =0 ; -unsigned long rx_nombuf =0 , ierrors =0 ; +unsigned int i;const struct pmd_internals *pmd = dev->data->dev_private; +uint64_t bytes, packets;/* rx queue statistics */ - imax = (dev->data->nb_rx_queues <RTE_ETHDEV_QUEUE_STAT_CNTRS ) ? - dev->data->nb_rx_queues :RTE_ETHDEV_QUEUE_STAT_CNTRS ; -for (i =0 ; i < imax; i++) { - tap_stats->q_ipackets[i] = pmd->rxq[i].stats.ipackets; - tap_stats->q_ibytes[i] = pmd->rxq[i].stats.ibytes; - rx_total += tap_stats->q_ipackets[i]; - rx_bytes_total += tap_stats->q_ibytes[i]; - rx_nombuf += pmd->rxq[i].stats.rx_nombuf; - ierrors += pmd->rxq[i].stats.ierrors; +for (i =0 ; i < dev->data->nb_rx_queues; i++) { +const struct rx_queue *rxq = &pmd->rxq[i]; + + packets =READ_ONCE (rxq->stats.packets); + bytes =READ_ONCE (rxq->stats.bytes); + + tap_stats->ipackets += packets; + tap_stats->ibytes += bytes; + tap_stats->ierrors += rxq->stats.errors; + +if (i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) { + tap_stats->q_ipackets[i] = packets; + tap_stats->q_ibytes[i] = bytes; + } }/* tx queue statistics */ - imax = (dev->data->nb_tx_queues <RTE_ETHDEV_QUEUE_STAT_CNTRS ) ? - dev->data->nb_tx_queues :RTE_ETHDEV_QUEUE_STAT_CNTRS ; - -for (i =0 ; i < imax; i++) { - tap_stats->q_opackets[i] = pmd->txq[i].stats.opackets; - tap_stats->q_obytes[i] = pmd->txq[i].stats.obytes; - tx_total += tap_stats->q_opackets[i]; - tx_err_total += pmd->txq[i].stats.errs; - tx_bytes_total += tap_stats->q_obytes[i]; - } - - tap_stats->ipackets = rx_total; - tap_stats->ibytes = rx_bytes_total; - tap_stats->ierrors = ierrors; - tap_stats->rx_nombuf = rx_nombuf; - tap_stats->opackets = tx_total; - tap_stats->oerrors = tx_err_total; - tap_stats->obytes = tx_bytes_total; +for (i =0 ; i < dev->data->nb_tx_queues; i++) { +const struct tx_queue *txq = &pmd->txq[i]; + + packets =READ_ONCE (txq->stats.packets); + bytes =READ_ONCE (txq->stats.bytes); + + tap_stats->opackets += packets; + tap_stats->obytes += bytes; + tap_stats->oerrors += txq->stats.errors; + +if (i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) { + tap_stats->q_opackets[i] = packets; + tap_stats->q_obytes[i] = bytes; + } + } +return 0 ; }
@@ -1094,14 +1100,8 @@ tap_stats_reset(struct rte_eth_dev *dev)struct pmd_internals *pmd = dev->data->dev_private;for (i =0 ; i <RTE_PMD_TAP_MAX_QUEUES ; i++) { - pmd->rxq[i].stats.ipackets =0 ; - pmd->rxq[i].stats.ibytes =0 ; - pmd->rxq[i].stats.ierrors =0 ; - pmd->rxq[i].stats.rx_nombuf =0 ; - - pmd->txq[i].stats.opackets =0 ; - pmd->txq[i].stats.errs =0 ; - pmd->txq[i].stats.obytes =0 ; +memset (&pmd->rxq[i].stats,0 ,sizeof (struct pkt_stats )); +memset (&pmd->txq[i].stats,0 ,sizeof (struct pkt_stats )); }return 0 ;
@@ -1156,9 +1156,13 @@ tap_dev_close(struct rte_eth_dev *dev) }if (internals->remote_if_index) { +struct ifreq remote_ifr; + +strlcpy (remote_ifr.ifr_name, internals->remote_iface,IFNAMSIZ ); + remote_ifr.ifr_flags = internals->remote_flags; +/* Restore initial remote state */ -int ret =ioctl (internals->ioctl_sock,SIOCSIFFLAGS , - &internals->remote_initial_flags); +int ret =ioctl (internals->ioctl_sock,SIOCSIFFLAGS , &remote_ifr);if (ret)TAP_LOG (ERR ,"restore remote state failed: %d" , ret);
@@ -2067,16 +2071,22 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,LIST_INIT (&pmd->flows);if (strlen (remote_iface)) { +struct ifreq remote_ifr; + pmd->remote_if_index =if_nametoindex (remote_iface);if (!pmd->remote_if_index) {TAP_LOG (ERR ,"%s: failed to get %s if_index." , pmd->name, remote_iface); goto error_remote; } -strlcpy (pmd->remote_iface, remote_iface,RTE_ETH_NAME_MAX_LEN ); +strlcpy (pmd->remote_iface, remote_iface,IFNAMSIZ ); + +memset (&remote_ifr,0 ,sizeof (ifr)); +strlcpy (remote_ifr.ifr_name, remote_iface,IFNAMSIZ );/* Save state of remote device */ -tap_ioctl (pmd,SIOCGIFFLAGS , &pmd->remote_initial_flags,0 ,REMOTE_ONLY ); +tap_ioctl (pmd,SIOCGIFFLAGS , &remote_ifr,0 ,REMOTE_ONLY ); + pmd->remote_flags = remote_ifr.ifr_flags;/* Replicate remote MAC address */ if (tap_ioctl (pmd,SIOCGIFHWADDR , &ifr,0 ,REMOTE_ONLY ) <0 ) {
@@ -2190,10 +2200,10 @@ set_interface_name(const char *key __rte_unused, value);return -1 ; } -strlcpy (name, value,RTE_ETH_NAME_MAX_LEN ); +strlcpy (name, value,IFNAMSIZ ); }else {/* use tap%d which causes kernel to choose next available */ -strlcpy (name,DEFAULT_TAP_NAME "%d" ,RTE_ETH_NAME_MAX_LEN ); +strlcpy (name,DEFAULT_TAP_NAME "%d" ,IFNAMSIZ ); }return 0 ; }
@@ -2211,7 +2221,7 @@ set_remote_iface(const char *key __rte_unused, value);return -1 ; } -strlcpy (name, value,RTE_ETH_NAME_MAX_LEN ); +strlcpy (name, value,IFNAMSIZ ); }return 0 ;
@@ -2262,13 +2272,13 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev)const char *name, *params;int ret;struct rte_kvargs *kvlist =NULL ; -char tun_name[RTE_ETH_NAME_MAX_LEN ]; -char remote_iface[RTE_ETH_NAME_MAX_LEN ]; +char tun_name[IFNAMSIZ ]; +char remote_iface[IFNAMSIZ ];struct rte_eth_dev *eth_dev; name =rte_vdev_device_name (dev); params =rte_vdev_device_args (dev); -memset (remote_iface,0 ,RTE_ETH_NAME_MAX_LEN ); +memset (remote_iface,0 ,IFNAMSIZ );if (rte_eal_process_type () ==RTE_PROC_SECONDARY &&strlen (params) ==0 ) {
@@ -2284,7 +2294,7 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) }/* use tun%d which causes kernel to choose next available */ -strlcpy (tun_name,DEFAULT_TUN_NAME "%d" ,RTE_ETH_NAME_MAX_LEN ); +strlcpy (tun_name,DEFAULT_TUN_NAME "%d" ,IFNAMSIZ );if (params && (params[0 ] !='\0' )) {TAP_LOG (DEBUG ,"parameters (%s)" , params);
@@ -2424,8 +2434,8 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)int ret;struct rte_kvargs *kvlist =NULL ;int speed; -char tap_name[RTE_ETH_NAME_MAX_LEN ]; -char remote_iface[RTE_ETH_NAME_MAX_LEN ]; +char tap_name[IFNAMSIZ ]; +char remote_iface[IFNAMSIZ ];struct rte_ether_addr user_mac = { .addr_bytes = {0 } };struct rte_eth_dev *eth_dev;int tap_devices_count_increased =0 ;
@@ -2479,8 +2489,8 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) speed =RTE_ETH_SPEED_NUM_10G ;/* use tap%d which causes kernel to choose next available */ -strlcpy (tap_name,DEFAULT_TAP_NAME "%d" ,RTE_ETH_NAME_MAX_LEN ); -memset (remote_iface,0 ,RTE_ETH_NAME_MAX_LEN ); +strlcpy (tap_name,DEFAULT_TAP_NAME "%d" ,IFNAMSIZ ); +memset (remote_iface,0 ,IFNAMSIZ );if (params && (params[0 ] !='\0' )) {TAP_LOG (DEBUG ,"parameters (%s)" , params);
drivers/net/tap/rte_eth_tap.h +9 -13
@@ -34,13 +34,9 @@ enum rte_tuntap_type { };struct pkt_stats { -uint64_t opackets;/* Number of output packets */ -uint64_t ipackets;/* Number of input packets */ -uint64_t obytes;/* Number of bytes on output */ -uint64_t ibytes;/* Number of bytes on input */ -uint64_t errs;/* Number of TX error packets */ -uint64_t ierrors;/* Number of RX error packets */ -uint64_t rx_nombuf;/* Nb of RX mbuf alloc failures */ +uint64_t packets;/* Number of packets */ +uint64_t bytes;/* Number of bytes */ +uint64_t errors;/* Number of errors */ };struct rx_queue {
@@ -68,15 +64,16 @@ struct tx_queue {struct pmd_internals {struct rte_eth_dev *dev;/* Ethernet device. */ -char remote_iface[RTE_ETH_NAME_MAX_LEN ];/* Remote netdevice name */ -char name[RTE_ETH_NAME_MAX_LEN ];/* Internal Tap device name */ +char remote_iface[IFNAMSIZ ];/* Remote netdevice name */ +char name[IFNAMSIZ ];/* Internal Tap device name */ int type;/* Type field - TUN|TAP */ int persist;/* 1 if keep link up, else 0 */ struct rte_ether_addr eth_addr;/* Mac address of the device port */ -struct ifreq remote_initial_flags;/* Remote netdevice flags on init */ +uint16_t remote_flags;/* Remote netdevice flags on init */ int remote_if_index;/* remote netdevice IF_INDEX */ int if_index;/* IF_INDEX for the port */ int ioctl_sock;/* socket for ioctl calls */ +int ka_fd;/* keep-alive file descriptor */ #ifdef HAVE_TCA_FLOWER int nlsk_fd;/* Netlink socket fd */
@@ -88,12 +85,11 @@ struct pmd_internals {/* implicit rte_flow rules set when a remote device is active */ LIST_HEAD(tap_implicit_flows, rte_flow) implicit_flows;#endif +struct rte_intr_handle *intr_handle;/* LSC interrupt handle. */ +struct rte_mempool *gso_ctx_mp;/* Mempool for GSO packets */ struct rx_queue rxq[RTE_PMD_TAP_MAX_QUEUES ];/* List of RX queues */ struct tx_queue txq[RTE_PMD_TAP_MAX_QUEUES ];/* List of TX queues */ -struct rte_intr_handle *intr_handle;/* LSC interrupt handle. */ -int ka_fd;/* keep-alive file descriptor */ -struct rte_mempool *gso_ctx_mp;/* Mempool for GSO packets */ };struct pmd_process_private {
Signature · 1 line
2.43.0
Re: [PATCH v15 09/11] net/tap: simplify internals
Quoted 4 lines · On Tue, 21 May 2024 13:12:54 -0700 Stephen Hemminger…
The names of Linux network devices are IFNAMSIZ(16) not the same as DPDK which has up to 64 characters. Don't need to hold onto the whole ifreq to save the remote interface flags.
Quoted 8 lines
Make sure packet and byte counters are read once, so that global and per-queue values add up. No need for separate
rx_nombufcounter since there is analloc_failedvalue in ethdev.Keep only the statistics that are used. I.e no ipackets on tx queues etc.
Signed-off-by Stephen Hemminger <[email protected]>
Drop this patch when merging, will split and pick up in later updates
PATCH v15 10/11 net/tap: remove extraneous newlines
In reply to Stephen HemmingerSome log messages contained extra newlines.
--- drivers/net/tap/rte_eth_tap.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/tap/rte_eth_tap.c +8 -9
@@ -235,9 +235,8 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) flags =fcntl (fd,F_GETFL );if (flags ==-1 ) { -TAP_LOG (WARNING , -"Unable to get %s current flags\n" , - ifr.ifr_name); +TAP_LOG (WARNING ,"Unable to get %s current flags: %s" , + ifr.ifr_name,strerror (errno)); goto error; }
@@ -279,7 +278,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)if (sigaction (signo, &sa,NULL ) ==-1 ) {TAP_LOG (WARNING , -"Unable to set rt-signal %d handler\n" , signo); +"Unable to set rt-signal %d handler" , signo); goto error; }
@@ -290,11 +289,11 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent) }if (signo ==SIGRTMAX ) { -TAP_LOG (WARNING ,"All rt-signals are in use\n" ); +TAP_LOG (WARNING ,"All rt-signals are in use" );/* Disable trigger globally in case of error */ tap_trigger =0 ; -TAP_LOG (NOTICE ,"No Rx trigger signal available\n" ); +TAP_LOG (NOTICE ,"No Rx trigger signal available" ); }else {/* Enable signal on file descriptor */ if (fcntl (fd,F_SETSIG , signo) <0 ) {
@@ -920,7 +919,7 @@ tap_mp_req_start_rxtx(const struct rte_mp_msg *request, __rte_unused const void } process_private = dev->process_private; -TAP_LOG (DEBUG ,"tap_attach q:%d\n" , request_param->q_count); +TAP_LOG (DEBUG ,"tap_attach q:%d" , request_param->q_count);for (int q =0 ; q < request_param->q_count; q++) process_private->fds[q] = request->fds[q];
@@ -1463,7 +1462,7 @@ tap_gso_ctx_setup(struct rte_gso_ctx *gso_ctx, struct rte_eth_dev *dev)if (ret <0 || ret >= (int )sizeof (pool_name)) {TAP_LOG (ERR ,"%s: failed to create mbuf pool name for device %s," -"device name too long or output error, ret: %d\n" , +"device name too long or output error, ret: %d" , pmd->name, dev->device->name, ret);return -ENAMETOOLONG ; }
@@ -1473,7 +1472,7 @@ tap_gso_ctx_setup(struct rte_gso_ctx *gso_ctx, struct rte_eth_dev *dev) SOCKET_ID_ANY);if (!pmd->gso_ctx_mp) {TAP_LOG (ERR , -"%s: failed to create mbuf pool for device %s\n" , +"%s: failed to create mbuf pool for device %s" , pmd->name, dev->device->name);return -1 ; }
Signature · 1 line
2.43.0
PATCH v15 11/11 net/tap: update documentation
In reply to Stephen HemmingerThe driver support of flows has changed and the wording in the guide was awkward.
Drop references to DPDK pktgen in this documentation since it is not required, confusing and abandoned.
--- doc/guides/nics/tap.rst | 274 +++++++++++----------------------------- 1 file changed, 77 insertions(+), 197 deletions(-)
doc/guides/nics/tap.rst +77 -197
@@ -1,47 +1,51 @@ .. SPDX-License-Identifier: BSD-3-Clause Copyright(c) 2016 Intel Corporation. -Tun|Tap Poll Mode Driver -======================== +TAP Poll Mode Driver +==================== -The ``rte_eth_tap.c`` PMD creates a device using TAP interfaces on the -local host. The PMD allows for DPDK and the host to communicate using a raw -device interface on the host and in the DPDK application. +The TAP Poll Mode Driver (PMD) is a virtual device for injecting packets to be processed +by the Linux kernel. This PMD is useful when writing DPDK application +for offloading network functionality (such as tunneling) from the kernel. -The device created is a TAP device, which sends/receives packet in a raw -format with a L2 header. The usage for a TAP PMD is for connectivity to the -local host using a TAP interface. When the TAP PMD is initialized it will -create a number of tap devices in the host accessed via ``ifconfig -a`` or -``ip`` command. The commands can be used to assign and query the virtual like -device. +From the kernel point of view, the TAP device looks like a regular network interface. +The network device can be managed by standard tools such as ``ip`` and ``ethtool`` commands. +It is also possible to use existing packet tools such as ``wireshark`` or ``tcpdump``. -These TAP interfaces can be used with Wireshark or tcpdump or Pktgen-DPDK -along with being able to be used as a network connection to the DPDK -application. The method enable one or more interfaces is to use the -``--vdev=net_tap0`` option on the DPDK application command line. Each -``--vdev=net_tap1`` option given will create an interface named dtap0, dtap1, -and so on. +From the DPDK application, the TAP device looks like a DPDK ethdev. +Packets are sent and received in L2 (Ethernet) format. The standare DPDK +API's to query for information, statistics and send and receive packets +work as expected. -The interface name can be changed by adding the ``iface=foo0``, for example:: +Requirements +~~~~~~~~~~~~ + +The TAP PMD requires kernel support for multiple queues in TAP device as +well as the multi-queue ``multiq`` and incoming ``ingress`` queue disciplines. +These are standard kernel features in most Linux distributions. + +Arguments +--------- + +TAP devices are created with the command line +``--vdev=net_tap0`` option. This option maybe specified more the once by repeating +with a different ``net_tapX`` device. + +By default, the Linux interfaces are named ``dtap0``, ``dtap1``, etc. +The interface name can be specified by adding the ``iface=foo0``, for example:: --vdev=net_tap0,iface=foo0 --vdev=net_tap1,iface=foo1, ... -Normally the PMD will generate a random MAC address, but when testing or with -a static configuration the developer may need a fixed MAC address style. -Using the option ``mac=fixed`` you can create a fixed known MAC address:: +Normally the PMD will generate a random MAC address. +If a static address is desired instead, the ``mac=fixed`` can be used. --vdev=net_tap0,mac=fixed -The MAC address will have a fixed value with the last octet incrementing by one -for each interface string containing ``mac=fixed``. The MAC address is formatted -as 02:'d':'t':'a':'p':[00-FF]. Convert the characters to hex and you get the -actual MAC address: ``02:64:74:61:70:[00-FF]``. - - --vdev=net_tap0,mac="02:64:74:61:70:11" +With the fixed option, the MAC address will have the first octets: +as 02:'d':'t':'a':'p':[00-FF] and the last octets are the interface number. -The MAC address will have a user value passed as string. The MAC address is in -format with delimiter ``:``. The string is byte converted to hex and you get -the actual MAC address: ``02:64:74:61:70:11``. +To specify a specific MAC address use the conventional representation. +The string is byte converted to hex, the result is MAC address: ``02:64:74:61:70:11``. It is possible to specify a remote netdevice to capture packets from by adding ``remote=foo1``, for example::
@@ -59,40 +63,20 @@ netdevice that has no support in the DPDK. It is possible to add explicit rte_flow rules on the tap PMD to capture specific traffic (see next section for examples). -After the DPDK application is started you can send and receive packets on the -interface using the standard rx_burst/tx_burst APIs in DPDK. From the host -point of view you can use any host tool like tcpdump, Wireshark, ping, Pktgen -and others to communicate with the DPDK application. The DPDK application may -not understand network protocols like IPv4/6, UDP or TCP unless the -application has been written to understand these protocols. - -If you need the interface as a real network interface meaning running and has -a valid IP address then you can do this with the following commands:: - - sudo ip link set dtap0 up; sudo ip addr add 192.168.0.250/24 dev dtap0 - sudo ip link set dtap1 up; sudo ip addr add 192.168.1.250/24 dev dtap1 - -Please change the IP addresses as you see fit. - -If routing is enabled on the host you can also communicate with the DPDK App -over the internet via a standard socket layer application as long as you -account for the protocol handling in the application. - -If you have a Network Stack in your DPDK application or something like it you -can utilize that stack to handle the network protocols. Plus you would be able -to address the interface using an IP address assigned to the internal -interface. - Normally, when the DPDK application exits, the TAP device is marked down and is removed. -But this behaviour can be overridden by the use of the persist flag, example:: +But this behavior can be overridden by the use of the persist flag, example:: --vdev=net_tap0,iface=tap0,persist ... -The TUN PMD allows user to create a TUN device on host. The PMD allows user -to transmit and receive packets via DPDK API calls with L3 header and payload. -The devices in host can be accessed via ``ifconfig`` or ``ip`` command. TUN -interfaces are passed to DPDK ``rte_eal_init`` arguments as ``--vdev=net_tunX``, +TUN devices +----------- + +The TAP device can be used an L3 tunnel only device (TUN). +This type of device does not include the Ethernet (L2) header; all packets +are sent and received as IP packets. + +TUN devices are created with the command line arguments ``--vdev=net_tunX``, where X stands for unique id, example:: --vdev=net_tun0 --vdev=net_tun1,iface=foo1, ...
@@ -103,27 +87,33 @@ options. Default interface name is ``dtunX``, where X stands for unique id. Flow API support ---------------- -The tap PMD supports major flow API pattern items and actions, when running on -linux kernels above 4.2 ("Flower" classifier required). -The kernel support can be checked with this command:: +The TAP PMD supports major flow API pattern items and actions. + +Requirements +~~~~~~~~~~~~ - zcat /proc/config.gz | ( grep 'CLS_FLOWER=' || echo 'not supported' ) | - tee -a /dev/stderr | grep -q '=m' && - lsmod | ( grep cls_flower || echo 'try modprobe cls_flower' ) +Flow support in TAP driver requires the Linux kernel support of flow based +traffic control filter ``flower``. This was added in Linux 4.3 kernel. -Supported items: +The implementation of RSS action uses an eBPF module that requires additional +libraries and tools. Building the RSS support requires the ``clang`` +compiler to compile the C code to BPF target; ``bpftool`` to convert the +compiled BPF object to a header file; and ``libbpf`` to load the eBPF +action into the kernel. -- eth: src and dst (with variable masks), and eth_type (0xffff mask). -- vlan: vid, pcp, but not eid. (requires kernel 4.9) -- ipv4/6: src and dst (with variable masks), and ip_proto (0xffff mask). -- udp/tcp: src and dst port (0xffff) mask. +Supported match items: + + - eth: src and dst (with variable masks), and eth_type (0xffff mask). + - vlan: vid, pcp, but not eid. (requires kernel 4.9) + - ipv4/6: src and dst (with variable masks), and ip_proto (0xffff mask). + - udp/tcp: src and dst port (0xffff) mask. Supported actions: - DROP - QUEUE - PASSTHRU -- RSS (requires kernel 4.9) +- RSS It is generally not possible to provide a "last" item. However, if the "last" item, once masked, is identical to the masked spec, then it is supported.
@@ -133,7 +123,7 @@ full mask (exact match). As rules are translated to TC, it is possible to show them with something like:: - tc -s filter show dev tap1 parent 1: + tc -s filter show dev dtap1 parent 1: Examples of testpmd flow rules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -174,135 +164,25 @@ The IPC synchronization of Rx/Tx queues is currently limited: - Maximum 8 queues shared - Synchronized on probing, but not on later port update -Example -------- - -The following is a simple example of using the TAP PMD with the Pktgen -packet generator. It requires that the ``socat`` utility is installed on the -test system. - -Build DPDK, then pull down Pktgen and build pktgen using the DPDK SDK/Target -used to build the dpdk you pulled down. - -Run pktgen from the pktgen directory in a terminal with a commandline like the -following:: - - sudo ./app/app/x86_64-native-linux-gcc/app/pktgen -l 1-5 -n 4 \ - --proc-type auto --log-level debug --socket-mem 512,512 --file-prefix pg \ - --vdev=net_tap0 --vdev=net_tap1 -b 05:00.0 -b 05:00.1 \ - -b 04:00.0 -b 04:00.1 -b 04:00.2 -b 04:00.3 \ - -b 81:00.0 -b 81:00.1 -b 81:00.2 -b 81:00.3 \ - -b 82:00.0 -b 83:00.0 -- -T -P -m [2:3].0 -m [4:5].1 \ - -f themes/black-yellow.theme - -.. Note: - - Change the ``-b`` options to exclude all of your physical ports. The - following command line is all one line. - - Also, ``-f themes/black-yellow.theme`` is optional if the default colors - work on your system configuration. See the Pktgen docs for more - information. - -Verify with ``ifconfig -a`` command in a different xterm window, should have a -``dtap0`` and ``dtap1`` interfaces created. - -Next set the links for the two interfaces to up via the commands below:: - - sudo ip link set dtap0 up; sudo ip addr add 192.168.0.250/24 dev dtap0 - sudo ip link set dtap1 up; sudo ip addr add 192.168.1.250/24 dev dtap1 - -Then use socat to create a loopback for the two interfaces:: - - sudo socat interface:dtap0 interface:dtap1 - -Then on the Pktgen command line interface you can start sending packets using -the commands ``start 0`` and ``start 1`` or you can start both at the same -time with ``start all``. The command ``str`` is an alias for ``start all`` and -``stp`` is an alias for ``stop all``. - -While running you should see the 64 byte counters increasing to verify the -traffic is being looped back. You can use ``set all size XXX`` to change the -size of the packets after you stop the traffic. Use pktgen ``help`` -command to see a list of all commands. You can also use the ``-f`` option to -load commands at startup in command line or Lua script in pktgen. RSS specifics ------------- -Packet distribution in TAP is done by the kernel which has a default -distribution. This feature is adding RSS distribution based on eBPF code. -The default eBPF code calculates RSS hash based on Toeplitz algorithm for -a fixed RSS key. It is calculated on fixed packet offsets. For IPv4 and IPv6 it -is calculated over src/dst addresses (8 or 32 bytes for IPv4 or IPv6 -respectively) and src/dst TCP/UDP ports (4 bytes). - -The RSS algorithm is written in file ``tap_bpf_program.c`` which -does not take part in TAP PMD compilation. Instead this file is compiled -in advance to eBPF object file. The eBPF object file is then parsed and -translated into eBPF byte code in the format of C arrays of eBPF -instructions. The C array of eBPF instructions is part of TAP PMD tree and -is taking part in TAP PMD compilation. At run time the C arrays are uploaded to -the kernel via BPF system calls and the RSS hash is calculated by the -kernel. - -It is possible to support different RSS hash algorithms by updating file -``tap_bpf_program.c`` In order to add a new RSS hash algorithm follow these -steps: - -#. Write the new RSS implementation in file ``tap_bpf_program.c`` - - BPF programs which are uploaded to the kernel correspond to - C functions under different ELF sections. - -#. Install ``LLVM`` library and ``clang`` compiler versions 3.7 and above - -#. Use make to compile `tap_bpf_program.c`` via ``LLVM`` into an object file - and extract the resulting instructions into ``tap_bpf_insn.h``:: - - cd bpf; make - -#. Recompile the TAP PMD. - -The C arrays are uploaded to the kernel using BPF system calls. - -``tc`` (traffic control) is a well known user space utility program used to -configure the Linux kernel packet scheduler. It is usually packaged as -part of the ``iproute2`` package. -Since commit 11c39b5e9 ("tc: add eBPF support to f_bpf") ``tc`` can be used -to uploads eBPF code to the kernel and can be patched in order to print the -C arrays of eBPF instructions just before calling the BPF system call. -Please refer to ``iproute2`` package file ``lib/bpf.c`` function -``bpf_prog_load()``. - -An example utility for eBPF instruction generation in the format of C arrays will -be added in next releases - -TAP reports on supported RSS functions as part of dev_infos_get callback: -``RTE_ETH_RSS_IP``, ``RTE_ETH_RSS_UDP`` and ``RTE_ETH_RSS_TCP``. -**Known limitation:** TAP supports all of the above hash functions together -and not in partial combinations. - -Systems supporting flow API ---------------------------- - -- "tc flower" classifier requires linux kernel above 4.2 -- eBPF/RSS requires linux kernel above 4.9 - -+--------------------+-----------------------+ -| RH7.3 | No flow rule support | -+--------------------+-----------------------+ -| RH7.4 | No RSS action support | -+--------------------+-----------------------+ -| RH7.5 | No RSS action support | -+--------------------+-----------------------+ -| SLES 15, | No limitation | -| kernel 4.12 | | -+--------------------+-----------------------+ -| Azure Ubuntu 16.04,| No limitation | -| kernel 4.13 | | -+--------------------+-----------------------+ +The default packet distribution in TAP without flow rules is done by the +kernel which has a default flow based distribution. +When flow rules are used to distribute packets across a set of queues +an eBPF program is used to calculate the RSS based on Toeplitz algorithm for +with the given key. + +The hash is calculated for IPv4 and IPv6, over src/dst addresses +(8 or 32 bytes for IPv4 or IPv6 respectively) and +optionally the src/dst TCP/UDP ports (4 bytes). + Limitations ----------- -* Rx/Tx must have the same number of queues. +- Since TAP device uses a file descriptors to talk to the kernel. + The same number of queues must be specified for receive and transmit. + +- The RSS algorithm only support L3 or L4 functions. It does not support + finer grain selections (for example: only IPV6 packets with extension headers).
Signature · 1 line
2.43.0
Re: [PATCH v15 00/11] net/tap: make RSS work again
In reply to Stephen HemmingerQuoted 14 lines · Stephen Hemminger
The support of doing RSS for
rte_flow_actionwas a cool idea but it has been broken for several releases of DPDK as the underlying kernel and BPF infrastructure changed.This series cleans up the BPF program, implements several features that were never completed in the original code and changes to use the current BPF tool chain.
The result should be easier to read and maintain. I do not intend to support backporting this to stable releases due to lack of demand and dealing with older distros.
v15 - fix formatting in new release note
Quoted 13 lines
Stephen Hemminger (11):
net/tap: fix fd check inflow_isolate
net/tap: do not duplicate fd's
net/tap: remove unused fields
net/tap: validate and setup parameters for BPF RSS net/tap: do not build flow support if header is out of date net/tap: rewrite the RSS BPF program
net/tap: use libbpf to load new BPF program net/tap: remove no longer used files
net/tap: simplify internals
net/tap: remove extraneous newlines
net/tap: update documentation
Except from "09/11 - net/tap: simplify internals", for rest of the series:
I will drop 9/11 from the series, to be able to proceed with the set, it can continue separately.
Except from 9/11,
Series applied to dpdk-next-net/main, thanks.
Thanks for bringing tap eBPF support back to life!