net/mlx4: fix broadcast Rx

This patch fixes the issue of mlx4 not receiving broadcast packets
when configured to work promiscuous or allmulticast modes.

Fixes: eacaac7bae ("net/mlx4: restore promisc and allmulti support")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit is contained in:
Moti Haimovsky 2018-01-28 11:43:37 +02:00 committed by Ferruh Yigit
parent a43fba2c1e
commit 643958cf91

View File

@ -1223,9 +1223,12 @@ mlx4_flow_internal_next_vlan(struct priv *priv, uint16_t vlan)
*
* Various flow rules are created depending on the mode the device is in:
*
* 1. Promiscuous: port MAC + catch-all (VLAN filtering is ignored).
* 2. All multicast: port MAC/VLAN + catch-all multicast.
* 3. Otherwise: port MAC/VLAN + broadcast MAC/VLAN.
* 1. Promiscuous:
* port MAC + broadcast + catch-all (VLAN filtering is ignored).
* 2. All multicast:
* port MAC/VLAN + broadcast + catch-all multicast.
* 3. Otherwise:
* port MAC/VLAN + broadcast MAC/VLAN.
*
* About MAC flow rules:
*
@ -1305,9 +1308,6 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error)
!priv->dev->data->promiscuous ?
&vlan_spec.tci :
NULL;
int broadcast =
!priv->dev->data->promiscuous &&
!priv->dev->data->all_multicast;
uint16_t vlan = 0;
struct rte_flow *flow;
unsigned int i;
@ -1341,7 +1341,7 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error)
rule_vlan = NULL;
}
}
for (i = 0; i != RTE_DIM(priv->mac) + broadcast; ++i) {
for (i = 0; i != RTE_DIM(priv->mac) + 1; ++i) {
const struct ether_addr *mac;
/* Broadcasts are handled by an extra iteration. */
@ -1405,7 +1405,7 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error)
goto next_vlan;
}
/* Take care of promiscuous and all multicast flow rules. */
if (!broadcast) {
if (priv->dev->data->promiscuous || priv->dev->data->all_multicast) {
for (flow = LIST_FIRST(&priv->flows);
flow && flow->internal;
flow = LIST_NEXT(flow, next)) {