From: Adrien Mazarguil Date: Thu, 12 Oct 2017 12:19:33 +0000 (+0200) Subject: net/mlx4: add flow support for multicast traffic X-Git-Tag: spdx-start~1353 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3e49f870c5bb1d660d73aab26d6269187ddb3bf0;p=dpdk.git net/mlx4: add flow support for multicast traffic Give users the ability to create flow rules that match all multicast traffic. Like promiscuous flow rules, they come with restrictions such as not allowing additional matching criteria. Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- diff --git a/doc/guides/nics/features/mlx4.ini b/doc/guides/nics/features/mlx4.ini index bfe0eb1228..9e3ba34442 100644 --- a/doc/guides/nics/features/mlx4.ini +++ b/doc/guides/nics/features/mlx4.ini @@ -13,6 +13,7 @@ Queue start/stop = Y MTU update = Y Jumbo frame = Y Unicast MAC filter = Y +Multicast MAC filter = Y SR-IOV = Y VLAN filter = Y Basic stats = Y diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 377b48be75..15526afaec 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -107,7 +107,9 @@ struct mlx4_drop { * * Additional mlx4-specific constraints on supported fields: * - * - No support for partial masks. + * - No support for partial masks, except in the specific case of matching + * all multicast traffic (@p spec->dst and @p mask->dst equal to + * 01:00:00:00:00:00). * - Not providing @p item->spec or providing an empty @p mask->dst is * *only* supported if the rule doesn't specify additional matching * criteria (i.e. rule is promiscuous-like). @@ -152,6 +154,13 @@ mlx4_flow_merge_eth(struct rte_flow *flow, goto error; } else if (!sum_dst) { flow->promisc = 1; + } else if (sum_dst == 1 && mask->dst.addr_bytes[0] == 1) { + if (!(spec->dst.addr_bytes[0] & 1)) { + msg = "mlx4 does not support the explicit" + " exclusion of all multicast traffic"; + goto error; + } + flow->allmulti = 1; } else if (sum_dst != (UINT8_C(0xff) * ETHER_ADDR_LEN)) { msg = "mlx4 does not support matching partial" " Ethernet fields"; @@ -164,6 +173,10 @@ mlx4_flow_merge_eth(struct rte_flow *flow, flow->ibv_attr->type = IBV_FLOW_ATTR_ALL_DEFAULT; return 0; } + if (flow->allmulti) { + flow->ibv_attr->type = IBV_FLOW_ATTR_MC_DEFAULT; + return 0; + } ++flow->ibv_attr->num_of_specs; eth = (void *)((uintptr_t)flow->ibv_attr + flow->ibv_attr_size); *eth = (struct ibv_flow_spec_eth) { @@ -615,7 +628,7 @@ fill: flow->internal = 1; continue; } - if (flow->promisc) { + if (flow->promisc || flow->allmulti) { msg = "mlx4 does not support additional matching" " criteria combined with indiscriminate" " matching on Ethernet headers"; diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h index fcdf461edb..134e14d93a 100644 --- a/drivers/net/mlx4/mlx4_flow.h +++ b/drivers/net/mlx4/mlx4_flow.h @@ -68,6 +68,7 @@ struct rte_flow { uint32_t internal:1; /**< Internal flow rule outside isolated mode. */ uint32_t mac:1; /**< Rule associated with a configured MAC address. */ uint32_t promisc:1; /**< This rule matches everything. */ + uint32_t allmulti:1; /**< This rule matches all multicast traffic. */ uint32_t drop:1; /**< This rule drops packets. */ uint32_t queue:1; /**< Target is a receive queue. */ uint16_t queue_id; /**< Target queue. */