From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45BF7A0C52; Mon, 25 Oct 2021 13:04:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF3EA40E3C; Mon, 25 Oct 2021 13:04:23 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 15B6F407FF for ; Mon, 25 Oct 2021 13:04:23 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.149]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 7336E7F66F; Mon, 25 Oct 2021 14:04:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 7336E7F66F DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1635159862; bh=YtE4599NJw5gaLqYVOEDM4tjRFAiojMkBveDN7L7fjk=; h=From:To:Cc:Subject:Date; b=YdEWyPmjjMHBF/TzeNRz2j+d3FQbJlyBco19R6u4oZ/SHOv9+XPsneNGfN/IiEc7d PRnUnmTC0BFDQDu0CtyaEolOmyrO2K5gAYM2r1G7nXlCdyeWdq1KWLXMVLbyPLZRYV ucc3Obl+UqphgLJJadJ2oL2BBpFjtUUEb1Lf9ALk= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Andy Moreton , Igor Romanov Date: Mon, 25 Oct 2021 14:04:09 +0300 Message-Id: <20211025110415.20683-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" VF representors do not own dedicated m-ports and thus cannot be referred to as traffic endpoints in flow items or actions. Fixes: a62ec90522a6 ("net/sfc: add port representors infrastructure") Fixes: f55b61cec94a ("net/sfc: support port representor flow item") Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc_switch.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c index a28e861de5..265a17f4c4 100644 --- a/drivers/net/sfc/sfc_switch.c +++ b/drivers/net/sfc/sfc_switch.c @@ -512,7 +512,7 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id, static int sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id, uint16_t ethdev_port_id, - efx_mport_sel_t *mport_sel) + struct sfc_mae_switch_port **switch_port) { struct sfc_mae_switch_domain *domain; struct sfc_mae_switch_port *port; @@ -528,7 +528,7 @@ sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id, TAILQ_FOREACH(port, &domain->ports, switch_domain_ports) { if (port->ethdev_port_id == ethdev_port_id) { - *mport_sel = port->ethdev_mport; + *switch_port = port; return 0; } } @@ -541,11 +541,27 @@ sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id, uint16_t ethdev_port_id, efx_mport_sel_t *mport_sel) { + struct sfc_mae_switch_port *port; int rc; rte_spinlock_lock(&sfc_mae_switch.lock); rc = sfc_mae_find_switch_port_by_ethdev(switch_domain_id, - ethdev_port_id, mport_sel); + ethdev_port_id, &port); + if (rc != 0) + goto unlock; + + if (port->type != SFC_MAE_SWITCH_PORT_INDEPENDENT) { + /* + * The ethdev is a "VF representor". It does not own + * a dedicated m-port suitable for use in flow rules. + */ + rc = ENOTSUP; + goto unlock; + } + + *mport_sel = port->ethdev_mport; + +unlock: rte_spinlock_unlock(&sfc_mae_switch.lock); return rc; -- 2.20.1