Thread (39 messages) 39 messages, 5 authors, 2015-11-01
STALE3862d

[PATCH 08/17] mlx5: use alternate method to configure promiscuous mode

From: Adrien Mazarguil <hidden>
Date: 2015-10-05 17:55:30
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Olga Shern <redacted>

Promiscuous mode was historically enabled by adding a specific flow with
type IBV_FLOW_ATTR_ALL_DEFAULT to each hash RX queue, but this method is
deprecated. It is now simply enabled by omitting destination MAC addresses
from basic flow specifications.

Signed-off-by: Olga Shern <redacted>
Signed-off-by: Adrien Mazarguil <redacted>
Signed-off-by: Nelio Laranjeiro <redacted>
---
 drivers/net/mlx5/mlx5_rxmode.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 7fe7f0e..aab38ee 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -74,20 +74,21 @@ static int
 hash_rxq_promiscuous_enable(struct hash_rxq *hash_rxq)
 {
 	struct ibv_flow *flow;
-	struct ibv_flow_attr attr = {
-		.type = IBV_FLOW_ATTR_ALL_DEFAULT,
-		.num_of_specs = 0,
-		.port = hash_rxq->priv->port,
-		.flags = 0
-	};
+	struct priv *priv = hash_rxq->priv;
+	FLOW_ATTR_SPEC_ETH(data, priv_populate_flow_attr(priv, NULL, 0,
+							 hash_rxq->type));
+	struct ibv_flow_attr *attr = &data->attr;
 
 	if (hash_rxq->priv->vf)
 		return 0;
 	DEBUG("%p: enabling promiscuous mode", (void *)hash_rxq);
 	if (hash_rxq->promisc_flow != NULL)
 		return EBUSY;
+	/* Promiscuous flows only differ from normal flows by not filtering
+	 * on specific MAC addresses. */
+	priv_populate_flow_attr(priv, attr, sizeof(data), hash_rxq->type);
 	errno = 0;
-	flow = ibv_create_flow(hash_rxq->qp, &attr);
+	flow = ibv_create_flow(hash_rxq->qp, attr);
 	if (flow == NULL) {
 		/* It's not clear whether errno is always set in this case. */
 		ERROR("%p: flow configuration failed, errno=%d: %s",
-- 
2.1.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help