diff --git a/Dockerfile b/Dockerfile index f1d935f43..4e1a810d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM --platform=${TARGETPLATFORM} debian:12-slim AS builder ARG TARGETARCH -ARG DPDK_VER=23.11.3 +ARG DPDK_VER=24.11.1 ARG DPDK_BUILDTYPE=release ARG DPSERVICE_BUILDTYPE=debug ARG DPSERVICE_FEATURES="" @@ -57,11 +57,12 @@ ENV DPDK_DIR=/workspace/dpdk-stable-${DPDK_VER} # Copy DPDK patches COPY hack/*.patch hack/ RUN cd $DPDK_DIR \ -&& patch -p1 -R < ../hack/dpdk_23_11_3_mtu.patch \ -&& patch -p1 < ../hack/dpdk_23_11_3_fdb_def_rule.patch \ -&& patch -p1 < ../hack/dpdk_23_11_log.patch \ -&& patch -p1 < ../hack/dpdk_23_11_telemetry_key.patch \ -&& patch -p1 < ../hack/dpdk_23_11_ethdev_conversion.patch +&& patch -p1 -R < ../hack/dpdk_24_11_mtu.patch \ +&& patch -p1 < ../hack/dpdk_24_11_fdb_def_rule.patch \ +&& patch -p1 < ../hack/dpdk_24_11_log.patch \ +&& patch -p1 < ../hack/dpdk_24_11_telemetry_key.patch \ +&& patch -p1 < ../hack/dpdk_24_11_no_pattern_template_validation.patch \ +&& patch -p1 < ../hack/dpdk_24_11_ethdev_conversion.patch # Compile DPDK RUN cd $DPDK_DIR && meson setup -Dmax_ethports=132 -Dplatform=generic -Ddisable_drivers=common/dpaax,\ diff --git a/hack/dpdk_23_11_ethdev_conversion.patch b/hack/dpdk_24_11_ethdev_conversion.patch similarity index 100% rename from hack/dpdk_23_11_ethdev_conversion.patch rename to hack/dpdk_24_11_ethdev_conversion.patch diff --git a/hack/dpdk_23_11_3_fdb_def_rule.patch b/hack/dpdk_24_11_fdb_def_rule.patch similarity index 92% rename from hack/dpdk_23_11_3_fdb_def_rule.patch rename to hack/dpdk_24_11_fdb_def_rule.patch index be1f696bf..6552f35c9 100644 --- a/hack/dpdk_23_11_3_fdb_def_rule.patch +++ b/hack/dpdk_24_11_fdb_def_rule.patch @@ -11,7 +11,7 @@ diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 584a51b393..575ff03e8d 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c -@@ -1437,7 +1437,12 @@ mlx5_dev_args_check_handler(const char *key, const char *val, void *opaque) +@@ -1439,7 +1439,12 @@ mlx5_dev_args_check_handler(const char *key, const char *val, void *opaque) } else if (strcmp(MLX5_ALLOW_DUPLICATE_PATTERN, key) == 0) { config->allow_duplicate_pattern = !!tmp; } else if (strcmp(MLX5_FDB_DEFAULT_RULE_EN, key) == 0) { @@ -29,7 +29,7 @@ diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 55c29e31a2..382debdbfb 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h -@@ -363,7 +363,7 @@ struct mlx5_sh_config { +@@ -377,7 +377,7 @@ struct mlx5_sh_config { uint32_t cycle_time; /* query cycle time in milli-second. */ } cnt_svc; /* configure for HW steering's counter's service. */ /* Allow/Prevent the duplicate rules pattern. */ @@ -42,7 +42,7 @@ diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index fe2c512c5c..0289efe3f1 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c -@@ -1514,7 +1514,7 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev) +@@ -1523,7 +1523,7 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev) } mlx5_txq_release(dev, i); } diff --git a/hack/dpdk_23_11_log.patch b/hack/dpdk_24_11_log.patch similarity index 67% rename from hack/dpdk_23_11_log.patch rename to hack/dpdk_24_11_log.patch index 37c8cc8f9..29a215bd8 100644 --- a/hack/dpdk_23_11_log.patch +++ b/hack/dpdk_24_11_log.patch @@ -1,22 +1,7 @@ diff --color -ruN dpdk-23.11/lib/log/log.c dpdk-23.11-patch/lib/log/log.c --- dpdk-23.11/lib/log/log.c 2023-11-28 14:35:41.000000000 +0000 +++ dpdk-23.11-patch/lib/log/log.c 2024-03-04 15:01:39.318300347 +0000 -@@ -31,11 +31,14 @@ - uint32_t type; /**< Bitfield with enabled logs. */ - uint32_t level; /**< Log level. */ - FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */ -+ /** Print function set by rte_log_set_print_func, or vfprintf. */ -+ int (*func)(FILE *stream, const char *format, va_list ap); - size_t dynamic_types_len; - struct rte_log_dynamic_type *dynamic_types; - } rte_logs = { - .type = UINT32_MAX, - .level = RTE_LOG_DEBUG, -+ .func = vfprintf, - }; - - struct rte_eal_opt_loglevel { -@@ -80,6 +83,13 @@ +@@ -85,6 +88,13 @@ return 0; } @@ -24,25 +9,16 @@ diff --color -ruN dpdk-23.11/lib/log/log.c dpdk-23.11-patch/lib/log/log.c +void +rte_log_set_print_func(int (*func)(FILE *stream, const char *format, va_list ap)) +{ -+ rte_logs.func = func; ++ rte_logs.print_func = func; +} + FILE * rte_log_get_stream(void) { -@@ -501,7 +511,7 @@ - RTE_PER_LCORE(log_cur_msg).loglevel = level; - RTE_PER_LCORE(log_cur_msg).logtype = logtype; - -- ret = vfprintf(f, format, ap); -+ ret = rte_logs.func(f, format, ap); - fflush(f); - return ret; - } diff --color -ruN dpdk-23.11/lib/log/rte_log.h dpdk-23.11-patch/lib/log/rte_log.h --- dpdk-23.11/lib/log/rte_log.h 2023-11-28 14:35:41.000000000 +0000 +++ dpdk-23.11-patch/lib/log/rte_log.h 2024-03-04 15:03:08.442486094 +0000 -@@ -88,6 +88,18 @@ +@@ -89,6 +89,18 @@ int rte_openlog_stream(FILE *f); /** diff --git a/hack/dpdk_23_11_3_mtu.patch b/hack/dpdk_24_11_mtu.patch similarity index 100% rename from hack/dpdk_23_11_3_mtu.patch rename to hack/dpdk_24_11_mtu.patch diff --git a/hack/dpdk_24_11_no_pattern_template_validation.patch b/hack/dpdk_24_11_no_pattern_template_validation.patch new file mode 100644 index 000000000..76593b9aa --- /dev/null +++ b/hack/dpdk_24_11_no_pattern_template_validation.patch @@ -0,0 +1,13 @@ +diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c +index 50dbaa27ab..460ec07933 100644 +--- a/drivers/net/mlx5/mlx5_flow_hw.c ++++ b/drivers/net/mlx5/mlx5_flow_hw.c +@@ -8838,6 +8838,8 @@ pattern_template_validate(struct rte_eth_dev *dev, + uint32_t pt_num, + struct rte_flow_error *error) + { ++ return 0; ++ + struct mlx5_flow_template_table_cfg tbl_cfg = { + .attr = { + .nb_flows = 64, diff --git a/hack/dpdk_23_11_telemetry_key.patch b/hack/dpdk_24_11_telemetry_key.patch similarity index 100% rename from hack/dpdk_23_11_telemetry_key.patch rename to hack/dpdk_24_11_telemetry_key.patch diff --git a/include/dp_ipaddr.h b/include/dp_ipaddr.h index 4b929b095..e13b2ff21 100644 --- a/include/dp_ipaddr.h +++ b/include/dp_ipaddr.h @@ -19,12 +19,6 @@ extern "C" { #define DP_IPV6_ADDR_SIZE 16 static_assert(sizeof(rte_be64_t) * 2 == DP_IPV6_ADDR_SIZE, "DP_IPV6_ADDR_SIZE is invalid"); -#define DP_INIT_FROM_IPV6(IPV6) { \ - (IPV6)->bytes[0], (IPV6)->bytes[1], (IPV6)->bytes[2], (IPV6)->bytes[3], \ - (IPV6)->bytes[4], (IPV6)->bytes[5], (IPV6)->bytes[6], (IPV6)->bytes[7], \ - (IPV6)->bytes[8], (IPV6)->bytes[9], (IPV6)->bytes[10], (IPV6)->bytes[11], \ - (IPV6)->bytes[12], (IPV6)->bytes[13], (IPV6)->bytes[14], (IPV6)->bytes[15] } - #define DP_UNDERLAY_FLAG_EXTERNALLY_GENERATED 0x80 #define DP_UNDERLAY_FLAG_SECONDARY_POOL 0x40 @@ -47,8 +41,10 @@ union dp_ipv6 { uint8_t random; rte_be32_t local; } _ul; + const struct rte_ipv6_addr addr; }; static_assert(sizeof(union dp_ipv6) == DP_IPV6_ADDR_SIZE, "union dp_ipv6 has padding"); +static_assert(sizeof(struct rte_ipv6_addr) == DP_IPV6_ADDR_SIZE, "rte_ipv6_addr does not match dp_ipv6"); extern const union dp_ipv6 dp_empty_ipv6; extern const union dp_ipv6 dp_multicast_ipv6; @@ -63,15 +59,26 @@ void dp_copy_ipv6(union dp_ipv6 *dst, const union dp_ipv6 *src) } #define DP_IPV6_FROM_ARRAY(IPV6, ARRAY) do { \ - static_assert(sizeof(ARRAY) == sizeof(union dp_ipv6), "Invalid array size for DP_SET_IPV6"); \ + static_assert(sizeof(ARRAY) == sizeof(union dp_ipv6), "Invalid array size for DP_IPV6_FROM_ARRAY"); \ dp_copy_ipv6((IPV6), (const union dp_ipv6 *)(ARRAY)); \ } while (0) -#define DP_ARRAY_FROM_IPV6(ARRAY, IPV6) do { \ +#define DP_IPV6_TO_ARRAY(IPV6, ARRAY) do { \ static_assert(sizeof(ARRAY) == sizeof(union dp_ipv6), "Invalid array size for DP_IPV6_TO_ARRAY"); \ dp_copy_ipv6((union dp_ipv6 *)(ARRAY), (IPV6)); \ } while (0) +static __rte_always_inline +void dp_ipv6_from_rte(union dp_ipv6 *ipv6, const struct rte_ipv6_addr *rte_ipv6) +{ + dp_copy_ipv6(ipv6, (const union dp_ipv6 *)rte_ipv6); +} +static __rte_always_inline +void dp_ipv6_to_rte(const union dp_ipv6 *ipv6, struct rte_ipv6_addr *rte_ipv6) +{ + dp_copy_ipv6((union dp_ipv6 *)rte_ipv6, ipv6); +} + static __rte_always_inline const union dp_ipv6 *dp_get_src_ipv6(const struct rte_ipv6_hdr *ipv6_hdr) { @@ -89,13 +96,13 @@ static __rte_always_inline void dp_set_src_ipv6(struct rte_ipv6_hdr *ipv6_hdr, const union dp_ipv6 *ipv6) { static_assert(sizeof(ipv6_hdr->src_addr) == sizeof(union dp_ipv6), "Structure dp_ipv6 is not compatible with IPv6 source address"); - dp_copy_ipv6((union dp_ipv6 *)ipv6_hdr->src_addr, ipv6); + dp_copy_ipv6((union dp_ipv6 *)ipv6_hdr->src_addr.a, ipv6); } static __rte_always_inline void dp_set_dst_ipv6(struct rte_ipv6_hdr *ipv6_hdr, const union dp_ipv6 *ipv6) { static_assert(sizeof(ipv6_hdr->dst_addr) == sizeof(union dp_ipv6), "Structure dp_ipv6 is not compatible with IPv6 destination address"); - dp_copy_ipv6((union dp_ipv6 *)ipv6_hdr->dst_addr, ipv6); + dp_copy_ipv6((union dp_ipv6 *)ipv6_hdr->dst_addr.a, ipv6); } static __rte_always_inline diff --git a/include/rte_flow/dp_rte_flow_helpers.h b/include/rte_flow/dp_rte_flow_helpers.h index 7061a2975..f8a906a1e 100644 --- a/include/rte_flow/dp_rte_flow_helpers.h +++ b/include/rte_flow/dp_rte_flow_helpers.h @@ -55,17 +55,17 @@ static const struct rte_flow_item_ipv6 dp_flow_item_ipv6_mask = { .hdr.proto = 0xff, }; static const struct rte_flow_item_ipv6 dp_flow_item_ipv6_src_mask = { - .hdr.src_addr = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", + .hdr.src_addr.a = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", .hdr.proto = 0xff, }; static const struct rte_flow_item_ipv6 dp_flow_item_ipv6_dst_mask = { - .hdr.dst_addr = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", + .hdr.dst_addr.a = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", .hdr.proto = 0xff, }; #ifdef ENABLE_VIRTSVC static const struct rte_flow_item_ipv6 dp_flow_item_ipv6_src_dst_mask = { - .hdr.src_addr = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", - .hdr.dst_addr = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", + .hdr.src_addr.a = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", + .hdr.dst_addr.a = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", .hdr.proto = 0xff, }; #endif @@ -473,7 +473,7 @@ void dp_set_ipv6_set_src_action(struct rte_flow_action *action, struct rte_flow_action_set_ipv6 *ipv6_action, const union dp_ipv6 *ipv6) { - DP_ARRAY_FROM_IPV6(ipv6_action->ipv6_addr, ipv6); + dp_ipv6_to_rte(ipv6, &ipv6_action->ipv6_addr); action->type = RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC; action->conf = ipv6_action; } @@ -483,7 +483,7 @@ void dp_set_ipv6_set_dst_action(struct rte_flow_action *action, struct rte_flow_action_set_ipv6 *ipv6_action, const union dp_ipv6 *ipv6) { - DP_ARRAY_FROM_IPV6(ipv6_action->ipv6_addr, ipv6); + dp_ipv6_to_rte(ipv6, &ipv6_action->ipv6_addr); action->type = RTE_FLOW_ACTION_TYPE_SET_IPV6_DST; action->conf = ipv6_action; } diff --git a/src/dp_flow.c b/src/dp_flow.c index 7205cd5c2..a75b2dc55 100644 --- a/src/dp_flow.c +++ b/src/dp_flow.c @@ -59,7 +59,7 @@ static __rte_always_inline int dp_build_icmp_flow_key(const struct dp_flow *df, { struct dp_icmp_err_ip_info icmp_err_ip_info = {0}; - if (df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REPLY || df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REQUEST) { + if (df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REPLY || df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REQUEST) { key->port_dst = ntohs(df->l4_info.icmp_field.icmp_identifier); key->src.type_src = df->l4_info.icmp_field.icmp_type; return DP_OK; @@ -194,10 +194,10 @@ void dp_invert_flow_key(const struct flow_key *key /* in */, struct flow_key *in inv_key->port_dst = key->src.port_src; } else if (key->proto == IPPROTO_ICMP) { inv_key->port_dst = key->port_dst; - if (key->src.type_src == RTE_IP_ICMP_ECHO_REPLY) - inv_key->src.type_src = RTE_IP_ICMP_ECHO_REQUEST; - else if (key->src.type_src == RTE_IP_ICMP_ECHO_REQUEST) - inv_key->src.type_src = RTE_IP_ICMP_ECHO_REPLY; + if (key->src.type_src == RTE_ICMP_TYPE_ECHO_REPLY) + inv_key->src.type_src = RTE_ICMP_TYPE_ECHO_REQUEST; + else if (key->src.type_src == RTE_ICMP_TYPE_ECHO_REQUEST) + inv_key->src.type_src = RTE_ICMP_TYPE_ECHO_REPLY; else inv_key->src.type_src = 0; } else if (key->proto == IPPROTO_ICMPV6) { diff --git a/src/dp_lpm.c b/src/dp_lpm.c index 3e8d09234..a6ccfc967 100644 --- a/src/dp_lpm.c +++ b/src/dp_lpm.c @@ -231,11 +231,11 @@ int dp_add_route6(const struct dp_port *port, uint32_t vni, uint32_t t_vni, cons if (!root) return DP_GRPC_ERR_NO_VNI; - node = rte_rib6_lookup_exact(root, ipv6->bytes, depth); + node = rte_rib6_lookup_exact(root, &ipv6->addr, depth); if (node) return DP_GRPC_ERR_ROUTE_EXISTS; - node = rte_rib6_insert(root, ipv6->bytes, depth); + node = rte_rib6_insert(root, &ipv6->addr, depth); if (!node) return DP_GRPC_ERR_ROUTE_INSERT; @@ -261,7 +261,7 @@ int dp_del_route6(const struct dp_port *port, uint32_t vni, const union dp_ipv6 if (!root) return DP_GRPC_ERR_NO_VNI; - node = rte_rib6_lookup_exact(root, ipv6->bytes, depth); + node = rte_rib6_lookup_exact(root, &ipv6->addr, depth); if (!node) return DP_GRPC_ERR_ROUTE_NOT_FOUND; @@ -270,7 +270,7 @@ int dp_del_route6(const struct dp_port *port, uint32_t vni, const union dp_ipv6 if (next_hop != port->port_id) return DP_GRPC_ERR_ROUTE_BAD_PORT; - rte_rib6_remove(root, ipv6->bytes, depth); + rte_rib6_remove(root, &ipv6->addr, depth); return DP_GRPC_OK; } @@ -323,7 +323,7 @@ const struct dp_port *dp_get_ip6_out_port(const struct dp_port *in_port, struct rte_rib6 *root; uint64_t next_hop; struct dp_port *dst_port; - uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE]; + struct rte_ipv6_addr ip; if (t_vni == 0) t_vni = in_port->iface.vni; @@ -332,7 +332,7 @@ const struct dp_port *dp_get_ip6_out_port(const struct dp_port *in_port, if (!root) return NULL; - node = rte_rib6_lookup(root, df->dst.dst_addr6.bytes); + node = rte_rib6_lookup(root, &df->dst.dst_addr6.addr); if (!node) return NULL; @@ -346,9 +346,9 @@ const struct dp_port *dp_get_ip6_out_port(const struct dp_port *in_port, if (dst_port->is_pf) rte_memcpy(route, rte_rib6_get_ext(node), sizeof(*route)); - if (DP_FAILED(rte_rib6_get_ip(node, ip))) + if (DP_FAILED(rte_rib6_get_ip(node, &ip))) return NULL; - DP_IPV6_FROM_ARRAY(p_ipv6, ip); + dp_ipv6_from_rte(p_ipv6, &ip); return dst_port; } diff --git a/src/dp_nat.c b/src/dp_nat.c index 74fadc332..31d3c9697 100644 --- a/src/dp_nat.c +++ b/src/dp_nat.c @@ -396,9 +396,9 @@ int dp_nat_chg_ipv6_to_ipv4_hdr(struct dp_flow *df, struct rte_mbuf *m, uint32_t icmp_hdr = (struct rte_icmp_hdr *)(ipv4_hdr + 1); icmp_hdr->icmp_code = 0; if (icmp_hdr->icmp_type == DP_ICMPV6_ECHO_REQUEST) - icmp_hdr->icmp_type = RTE_IP_ICMP_ECHO_REQUEST; + icmp_hdr->icmp_type = RTE_ICMP_TYPE_ECHO_REQUEST; else if (icmp_hdr->icmp_type == DP_ICMPV6_ECHO_REPLY) - icmp_hdr->icmp_type = RTE_IP_ICMP_ECHO_REPLY; + icmp_hdr->icmp_type = RTE_ICMP_TYPE_ECHO_REPLY; else return DP_ERROR; //Drop unsupported ICMP Types for the time being dp_calculate_icmp_checksum(icmp_hdr, rte_be_to_cpu_16(ipv4_hdr->total_length) - ((ipv4_hdr->version_ihl & 0x0F) * 4)); @@ -476,9 +476,9 @@ int dp_nat_chg_ipv4_to_ipv6_hdr(struct dp_flow *df, struct rte_mbuf *m, const un icmp_hdr->icmp_code = 0; icmp_hdr->icmp_cksum = 0; - if (icmp_hdr->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) + if (icmp_hdr->icmp_type == RTE_ICMP_TYPE_ECHO_REQUEST) icmp_hdr->icmp_type = DP_ICMPV6_ECHO_REQUEST; - else if (icmp_hdr->icmp_type == RTE_IP_ICMP_ECHO_REPLY) + else if (icmp_hdr->icmp_type == RTE_ICMP_TYPE_ECHO_REPLY) icmp_hdr->icmp_type = DP_ICMPV6_ECHO_REPLY; else return DP_ERROR; //Drop unsupported ICMP Types for the time being diff --git a/src/dp_periodic_msg.c b/src/dp_periodic_msg.c index ccfbce79a..48f6bd36f 100644 --- a/src/dp_periodic_msg.c +++ b/src/dp_periodic_msg.c @@ -157,7 +157,7 @@ void trigger_nd_unsol_adv(void) icmp6_hdr->icmp6_override = 1; icmp6_hdr->icmp6_router = 1; - DP_ARRAY_FROM_IPV6(ns_msg->target, gw_ip); + DP_IPV6_TO_ARRAY(gw_ip, ns_msg->target); pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv6_hdr) + sizeof(struct icmp6hdr) + sizeof(struct in6_addr); pkt->data_len = pkt_size; diff --git a/src/monitoring/dp_graphtrace_shared.c b/src/monitoring/dp_graphtrace_shared.c index 267ab3a7f..b6e1f08c0 100644 --- a/src/monitoring/dp_graphtrace_shared.c +++ b/src/monitoring/dp_graphtrace_shared.c @@ -77,7 +77,7 @@ static int dp_graphtrace_sprint_ipv6(void **p_pkt_data, size_t *p_pos, char *buf PRINT_LAYER(p_pos, buf, bufsize, DP_IPV6_PRINT_FMT " -> " DP_IPV6_PRINT_FMT, - DP_IPV6_PRINT_BYTES(ipv6_hdr->src_addr), DP_IPV6_PRINT_BYTES(ipv6_hdr->dst_addr)); + DP_IPV6_PRINT_BYTES(ipv6_hdr->src_addr.a), DP_IPV6_PRINT_BYTES(ipv6_hdr->dst_addr.a)); *p_pkt_data = ipv6_hdr + 1; return ipv6_hdr->proto; diff --git a/src/nodes/dhcpv6_node.c b/src/nodes/dhcpv6_node.c index df5d25391..cde203d0a 100644 --- a/src/nodes/dhcpv6_node.c +++ b/src/nodes/dhcpv6_node.c @@ -148,9 +148,10 @@ static __rte_always_inline int parse_options(struct rte_mbuf *m, reply_options->opt_iana = opt_iana_template; reply_options->opt_iana.ia_na.iaid = ((const struct dhcpv6_ia_na *)&opt->data)->iaid; // cannot use optimized function here due to the destination being packed (can cause alignment problems) - static_assert(sizeof(reply_options->opt_iana.ia_na.options[0].addr.ipv6) == sizeof(dp_get_in_port(m)->iface.cfg.dhcp_ipv6), + static_assert(sizeof(reply_options->opt_iana.ia_na.options[0].addr.ipv6) == sizeof(dp_get_in_port(m)->iface.cfg.dhcp_ipv6.bytes), "Incompatible IPv6 array for IA_NA options"); - rte_memcpy(reply_options->opt_iana.ia_na.options[0].addr.ipv6, dp_get_in_port(m)->iface.cfg.dhcp_ipv6.bytes, DP_IPV6_ADDR_SIZE); + rte_memcpy(reply_options->opt_iana.ia_na.options[0].addr.ipv6, + dp_get_in_port(m)->iface.cfg.dhcp_ipv6.bytes, sizeof(dp_get_in_port(m)->iface.cfg.dhcp_ipv6.bytes)); reply_options->opt_iana_len = sizeof(opt_iana_template); break; case DHCPV6_OPT_RAPID_COMMIT: diff --git a/src/nodes/dnat_node.c b/src/nodes/dnat_node.c index 26c1383b3..0ce81d92f 100644 --- a/src/nodes/dnat_node.c +++ b/src/nodes/dnat_node.c @@ -48,7 +48,7 @@ static __rte_always_inline rte_edge_t get_next_index(__rte_unused struct rte_nod // if it is a network nat pkt if (dnat_data->dnat_ip == 0) { // it is icmp request targeting scalable nat - if (df->l4_type == IPPROTO_ICMP && df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REQUEST) { + if (df->l4_type == IPPROTO_ICMP && df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REQUEST) { cntrack->nf_info.nat_type = DP_FLOW_NAT_AS_TARGET; return DNAT_NEXT_PACKET_RELAY; } @@ -97,7 +97,7 @@ static __rte_always_inline rte_edge_t get_next_index(__rte_unused struct rte_nod if (DP_FLOW_HAS_FLAG_DEFAULT(cntrack->flow_flags) && cntrack->nf_info.nat_type == DP_FLOW_NAT_AS_TARGET && (df->l4_type == IPPROTO_ICMP || df->l4_type == IPPROTO_ICMPV6) - && (df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REQUEST || df->l4_info.icmp_field.icmp_type == DP_ICMPV6_ECHO_REQUEST)) + && (df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REQUEST || df->l4_info.icmp_field.icmp_type == DP_ICMPV6_ECHO_REQUEST)) return DNAT_NEXT_PACKET_RELAY; if (DP_FLOW_HAS_FLAG_DST_NAT(cntrack->flow_flags) && df->flow_dir == DP_FLOW_DIR_ORG) { @@ -119,7 +119,7 @@ static __rte_always_inline rte_edge_t get_next_index(__rte_unused struct rte_nod ipv4_hdr->dst_addr = htonl(cntrack->flow_key[DP_FLOW_DIR_ORG].l3_src.ipv4); if (cntrack->nf_info.nat_type == DP_FLOW_NAT_TYPE_NETWORK_LOCAL) { if (df->l4_type == IPPROTO_ICMP) { - if (df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REPLY) { + if (df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REPLY) { dp_change_icmp_identifier(m, cntrack->flow_key[DP_FLOW_DIR_ORG].port_dst); } else if (df->l4_info.icmp_field.icmp_type == DP_IP_ICMP_TYPE_ERROR) { memset(&icmp_err_ip_info, 0, sizeof(icmp_err_ip_info)); @@ -147,7 +147,7 @@ static __rte_always_inline rte_edge_t get_next_index(__rte_unused struct rte_nod // the new dst_addr will be stored in dp_nat_chg_ipv4_to_ipv6_hdr() if (cntrack->nf_info.nat_type == DP_FLOW_NAT_TYPE_NETWORK_LOCAL) { if (df->l4_type == IPPROTO_ICMP) { - if (df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REPLY) + if (df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REPLY) dp_change_icmp_identifier(m, cntrack->flow_key[DP_FLOW_DIR_ORG].port_dst); } else { dp_change_l4_hdr_port(m, DP_L4_PORT_DIR_DST, cntrack->flow_key[DP_FLOW_DIR_ORG].src.port_src); diff --git a/src/nodes/ipv6_nd_node.c b/src/nodes/ipv6_nd_node.c index 7214b4a38..63f0d62b0 100644 --- a/src/nodes/ipv6_nd_node.c +++ b/src/nodes/ipv6_nd_node.c @@ -73,8 +73,8 @@ static __rte_always_inline rte_edge_t get_next_index(__rte_unused struct rte_nod if (icmp_type == NDISC_NEIGHBOUR_SOLICITATION) { nd_msg = (struct nd_msg *)(req_ipv6_hdr + 1); - static_assert(sizeof(nd_msg->target) == sizeof(gw_ip->bytes), "Incompatible IPv6 format in ND message structure"); - if (memcmp(nd_msg->target, gw_ip->bytes, sizeof(nd_msg->target))) + static_assert(sizeof(nd_msg->target) == sizeof(*gw_ip), "Incompatible IPv6 format in ND message structure"); + if (!dp_ipv6_match((const union dp_ipv6 *)nd_msg->target, gw_ip)) return IPV6_ND_NEXT_DROP; rte_ether_addr_copy(&req_eth_hdr->dst_addr, &port->neigh_mac); dp_copy_ipv6(&port->iface.cfg.own_ipv6, dp_get_dst_ipv6(req_ipv6_hdr)); diff --git a/src/nodes/lb_node.c b/src/nodes/lb_node.c index b0636912a..e0f875002 100644 --- a/src/nodes/lb_node.c +++ b/src/nodes/lb_node.c @@ -53,7 +53,7 @@ static __rte_always_inline rte_edge_t get_next_index(__rte_unused struct rte_nod ) { if (df->l4_type == IPPROTO_ICMP || df->l4_type == IPPROTO_ICMPV6) { /* Directly answer echo replies of loadbalanced IP, do not forward */ - if (df->l4_info.icmp_field.icmp_type == RTE_IP_ICMP_ECHO_REQUEST + if (df->l4_info.icmp_field.icmp_type == RTE_ICMP_TYPE_ECHO_REQUEST || df->l4_info.icmp_field.icmp_type == DP_ICMPV6_ECHO_REQUEST ) { df->nat_type = DP_CHG_UL_DST_IP; diff --git a/src/nodes/packet_relay_node.c b/src/nodes/packet_relay_node.c index 50c80104e..99bc180f4 100644 --- a/src/nodes/packet_relay_node.c +++ b/src/nodes/packet_relay_node.c @@ -23,15 +23,15 @@ static __rte_always_inline rte_edge_t lb_nnat_icmp_reply(struct dp_flow *df, str uint32_t temp_ip; uint32_t cksum; - if (icmp_hdr->icmp_type != RTE_IP_ICMP_ECHO_REQUEST) + if (icmp_hdr->icmp_type != RTE_ICMP_TYPE_ECHO_REQUEST) return PACKET_RELAY_NEXT_DROP; // rewrite the packet and send it back - icmp_hdr->icmp_type = RTE_IP_ICMP_ECHO_REPLY; + icmp_hdr->icmp_type = RTE_ICMP_TYPE_ECHO_REPLY; cksum = ~icmp_hdr->icmp_cksum & 0xffff; - cksum += ~RTE_BE16(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff; - cksum += RTE_BE16(RTE_IP_ICMP_ECHO_REPLY << 8); + cksum += ~RTE_BE16(RTE_ICMP_TYPE_ECHO_REQUEST << 8) & 0xffff; + cksum += RTE_BE16(RTE_ICMP_TYPE_ECHO_REPLY << 8); cksum = (cksum & 0xffff) + (cksum >> 16); cksum = (cksum & 0xffff) + (cksum >> 16); icmp_hdr->icmp_cksum = (uint16_t)~cksum; diff --git a/src/nodes/snat_node.c b/src/nodes/snat_node.c index 94018e5b3..f08b3d9ef 100644 --- a/src/nodes/snat_node.c +++ b/src/nodes/snat_node.c @@ -110,9 +110,9 @@ static __rte_always_inline int dp_process_ipv6_nat64(struct rte_mbuf *m, struct cntrack->offload_state.reply = DP_FLOW_OFFLOADED; df->offload_state = DP_FLOW_NON_OFFLOAD; if (cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src == DP_ICMPV6_ECHO_REQUEST) - cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src = RTE_IP_ICMP_ECHO_REQUEST; + cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src = RTE_ICMP_TYPE_ECHO_REQUEST; else if (cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src == DP_ICMPV6_ECHO_REPLY) - cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src = RTE_IP_ICMP_ECHO_REPLY; + cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src = RTE_ICMP_TYPE_ECHO_REPLY; else cntrack->flow_key[DP_FLOW_DIR_REPLY].src.type_src = 0; } else { diff --git a/src/rte_flow/dp_rte_async_flow_isolation.c b/src/rte_flow/dp_rte_async_flow_isolation.c index 82b54d0ad..73b1ebfd3 100644 --- a/src/rte_flow/dp_rte_async_flow_isolation.c +++ b/src/rte_flow/dp_rte_async_flow_isolation.c @@ -163,8 +163,8 @@ struct rte_flow *dp_create_virtsvc_async_isolation_rule(uint16_t port_id, uint8_ }; const struct rte_flow_item_ipv6 ipv6_spec = { .hdr.proto = proto_id, - .hdr.src_addr = DP_INIT_FROM_IPV6(svc_ipv6), - .hdr.dst_addr = DP_INIT_FROM_IPV6(ul_addr), + .hdr.src_addr = svc_ipv6->addr, + .hdr.dst_addr = ul_addr->addr, }; const struct rte_flow_item_tcp tcp_spec = { .hdr.src_port = svc_port,