*
* 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).
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";
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) {
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";
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. */