diff options
author | Xavier Simonart <simonartxavier@gmail.com> | 2022-02-20 00:50:56 +0000 |
---|---|---|
committer | Patrice Buriez <patrice.buriez@chenapan.org> | 2022-12-26 09:40:40 +0000 |
commit | b950110b2a8a23ac498deef1bebca643f80c38b1 (patch) | |
tree | 0df52515cbc3ff8f4af6b4b1bba9e98761bb8bc4 /VNFs/DPPD-PROX | |
parent | fb2d81d0e3d0d766f59511df7cf7a5d151674c3b (diff) |
Add initial support for DPDK 21.11
Note that this patch simplistically removes some PROX features, because
they are not directly supported anymore by DPDK, since rte_eth_devices
is now private:
- reading and writing NIC register through PROX command line
- querying ixgbe HW statistics instead of getting them from DPDK
Also adjusted to following DPDK changes:
* struct rte_ether_hdr fields renamed:
- d_addr -> dst_addr
- s_addr -> src_addr
* struct rte_eth_rxmode field renamed:
- max_rx_pkt_len -> mtu
* --master-lcore -> --main-lcore
Signed-off-by: Xavier Simonart <simonartxavier@gmail.com>
Signed-off-by: Patrice Buriez <patrice.buriez@chenapan.org>
Change-Id: I08445b3dd0f7fe471d9bc7cfb557bd3aeb2f50be
Diffstat (limited to 'VNFs/DPPD-PROX')
-rw-r--r-- | VNFs/DPPD-PROX/commands.c | 8 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/defaults.c | 4 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/meson.build | 18 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/prox_args.c | 18 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/prox_compat.h | 11 |
5 files changed, 48 insertions, 11 deletions
diff --git a/VNFs/DPPD-PROX/commands.c b/VNFs/DPPD-PROX/commands.c index c5ffed84..1c4d7020 100644 --- a/VNFs/DPPD-PROX/commands.c +++ b/VNFs/DPPD-PROX/commands.c @@ -935,6 +935,7 @@ void cmd_portinfo(int port_id, char *dst, size_t max_len) void cmd_read_reg(uint8_t port_id, unsigned int id) { +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) unsigned int val, rc; if (!port_is_active(port_id)) { return ; @@ -946,6 +947,9 @@ void cmd_read_reg(uint8_t port_id, unsigned int id) else { plog_info("Register 0x%08X : %08X \n", id, val); } +#else + plog_err("cmd_read_reg(%d, %d) not supported on this dpdk version\n", port_id, id); +#endif } void cmd_reset_port(uint8_t portid) @@ -989,12 +993,16 @@ void cmd_multicast(uint8_t port_id, unsigned int val, prox_rte_ether_addr *mac) void cmd_write_reg(uint8_t port_id, unsigned int id, unsigned int val) { +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) if (!port_is_active(port_id)) { return ; } plog_info("writing 0x%08X %08X\n", id, val); write_reg(port_id, id, val); +#else + plog_err("cmd_write_reg(%d, %d, %d) not supported on this dpdk version\n", port_id, id, val); +#endif } void cmd_set_vlan_offload(uint8_t port_id, unsigned int val) diff --git a/VNFs/DPPD-PROX/defaults.c b/VNFs/DPPD-PROX/defaults.c index b93b7275..77582c7e 100644 --- a/VNFs/DPPD-PROX/defaults.c +++ b/VNFs/DPPD-PROX/defaults.c @@ -50,7 +50,11 @@ static const struct rte_eth_conf default_port_conf = { .rxmode = { .mq_mode = 0, +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) .max_rx_pkt_len = PROX_MTU + PROX_RTE_ETHER_HDR_LEN + PROX_RTE_ETHER_CRC_LEN +#else + .mtu = PROX_MTU +#endif }, .rx_adv_conf = { .rss_conf = { diff --git a/VNFs/DPPD-PROX/meson.build b/VNFs/DPPD-PROX/meson.build index 564e5b56..4a37ad50 100644 --- a/VNFs/DPPD-PROX/meson.build +++ b/VNFs/DPPD-PROX/meson.build @@ -26,6 +26,10 @@ project('dppd-prox', 'C', cc = meson.get_compiler('c') # Configure options for prox +# Grab the DPDK version here "manually" as it is not available in the dpdk_dep +# object +dpdk_version = run_command('pkg-config', '--modversion', 'libdpdk').stdout() + if get_option('bng_qinq').enabled() add_project_arguments('-DUSE_QINQ', language: 'c') endif @@ -39,7 +43,11 @@ if get_option('prox_stats').enabled() endif if get_option('hw_direct_stats').enabled() +if dpdk_version.version_compare('<21.11.0') add_project_arguments('-DPROX_HW_DIRECT_STATS', language: 'c') +else + warning('hw_direct_stats not supported on this dpdk version') +endif endif if get_option('dbg') @@ -132,10 +140,6 @@ deps = [dpdk_dep, dl_dep, lua_dep] -# Grab the DPDK version here "manually" as it is not available in the dpdk_dep -# object -dpdk_version = run_command('pkg-config', '--modversion', 'libdpdk').stdout() - # Explicitly add these to the dependency list deps += [cc.find_library('rte_bus_pci', required: true)] deps += [cc.find_library('rte_bus_vdev', required: true)] @@ -150,7 +154,7 @@ sources = files( 'task_init.c', 'handle_aggregator.c', 'handle_nop.c', 'handle_irq.c', 'handle_arp.c', 'handle_impair.c', 'handle_lat.c', 'handle_qos.c', 'handle_qinq_decap4.c', 'handle_routing.c', 'handle_untag.c', - 'handle_mplstag.c', 'handle_qinq_decap6.c', 'rw_reg.c', + 'handle_mplstag.c', 'handle_qinq_decap6.c', 'handle_lb_qinq.c', 'handle_lb_pos.c', 'handle_lb_net.c', 'handle_qinq_encap4.c', 'handle_qinq_encap6.c', 'handle_classify.c', 'handle_l2fwd.c', 'handle_swap.c', 'handle_police.c', 'handle_acl.c', @@ -175,6 +179,10 @@ sources = files( 'stats_cons_cli.c', 'stats_parser.c', 'hash_set.c', 'prox_lua.c', 'prox_malloc.c', 'prox_ipv6.c', 'prox_compat.c', 'handle_nsh.c') +if dpdk_version.version_compare('<21.11.0') +sources += files('rw_reg.c') +endif + # Include a couple of source files depending on DPDK support if cc.find_library('rte_pmd_aesni', required: false).found() sources += files('handle_esp.c') diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c index 0ef1f8b1..09e903b5 100644 --- a/VNFs/DPPD-PROX/prox_args.c +++ b/VNFs/DPPD-PROX/prox_args.c @@ -655,10 +655,14 @@ static int get_port_cfg(unsigned sindex, char *str, void *data) // A frame of 1526 bytes (1500 bytes mtu, 14 bytes hdr, 4 bytes crc and 8 bytes vlan) // should not be considered as a jumbo frame. However rte_ethdev.c considers that // the max_rx_pkt_len for a non jumbo frame is 1518 +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) cfg->port_conf.rxmode.max_rx_pkt_len = cfg->mtu + PROX_RTE_ETHER_HDR_LEN + PROX_RTE_ETHER_CRC_LEN; - if (cfg->port_conf.rxmode.max_rx_pkt_len > PROX_RTE_ETHER_MAX_LEN) { + if (cfg->port_conf.rxmode.max_rx_pkt_len > PROX_RTE_ETHER_MAX_LEN) +#else + cfg->port_conf.rxmode.mtu = cfg->mtu; + if (cfg->port_conf.rxmode.mtu > PROX_RTE_ETHER_MAX_LEN - PROX_RTE_ETHER_HDR_LEN - PROX_RTE_ETHER_CRC_LEN) +#endif cfg->requested_rx_offload |= DEV_RX_OFFLOAD_JUMBO_FRAME; - } } } @@ -2296,10 +2300,14 @@ int prox_setup_rte(const char *prog_name) sprintf(rte_arg[++argc], "-c%s", tmp); rte_argv[argc] = rte_arg[argc]; #if RTE_VERSION >= RTE_VERSION_NUM(1,8,0,0) + uint32_t master_core = prox_cfg.master; if (prox_cfg.flags & DSF_USE_DUMMY_CPU_TOPO) - sprintf(rte_arg[++argc], "--master-lcore=%u", 0); - else - sprintf(rte_arg[++argc], "--master-lcore=%u", prox_cfg.master); + master_core = 0; +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) + sprintf(rte_arg[++argc], "--master-lcore=%u", master_core); +#else + sprintf(rte_arg[++argc], "--main-lcore=%u", master_core); +#endif rte_argv[argc] = rte_arg[argc]; #else /* For old DPDK versions, the master core had to be the first diff --git a/VNFs/DPPD-PROX/prox_compat.h b/VNFs/DPPD-PROX/prox_compat.h index 404ce9ed..4f5fa321 100644 --- a/VNFs/DPPD-PROX/prox_compat.h +++ b/VNFs/DPPD-PROX/prox_compat.h @@ -210,7 +210,7 @@ typedef struct icmp_hdr prox_rte_icmp_hdr; #define PROX_RTE_IS_IPV4_MCAST IS_IPV4_MCAST #define prox_rte_is_same_ether_addr is_same_ether_addr #define prox_rte_is_zero_ether_addr is_zero_ether_addr -#else +#else // >= 19.08 #define PROX_RTE_ETHER_CRC_LEN RTE_ETHER_CRC_LEN #define PROX_RTE_ETHER_MIN_LEN RTE_ETHER_MIN_LEN @@ -229,7 +229,16 @@ typedef struct icmp_hdr prox_rte_icmp_hdr; typedef struct rte_ipv6_hdr prox_rte_ipv6_hdr; typedef struct rte_ipv4_hdr prox_rte_ipv4_hdr; typedef struct rte_ether_addr prox_rte_ether_addr; +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) typedef struct rte_ether_hdr prox_rte_ether_hdr; +#else +typedef struct prox_rte_ether_hdr +{ + struct rte_ether_addr d_addr; /**< Destination address. */ + struct rte_ether_addr s_addr; /**< Source address. */ + rte_be16_t ether_type; /**< Frame type. */ +} __rte_aligned(2) prox_rte_ether_hdr; +#endif typedef struct rte_vlan_hdr prox_rte_vlan_hdr; typedef struct rte_vxlan_gpe_hdr prox_rte_vxlan_gpe_hdr; typedef struct rte_udp_hdr prox_rte_udp_hdr; |