DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 06/13] net/bnxt: add check for multi host PF per port.
Date: Mon,  8 Jan 2018 12:24:30 -0800	[thread overview]
Message-ID: <20180108202437.56305-7-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20180108202437.56305-1-ajit.khaparde@broadcom.com>

Certain SKUs of NIC can support features like NPAR, Multi Host PFs per
port.  We need to check for such features in order to restrict certain
HWRM commands from being sent to the FW.

For the single PF per port model, allow commands like hwrm_port_phy_cfg
from the PF driver. In NPAR and MH environments with multiple PFs per port,
we should not allow HWRM commands like hwrm_port_phy_cfg to be sent to
the FW.

This patch takes care of that.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 6 ++++--
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 drivers/net/bnxt/bnxt_hwrm.c   | 6 +++++-
 drivers/net/bnxt/bnxt_stats.c  | 4 ++--
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e46759f25..345750be7 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -244,10 +244,12 @@ struct bnxt {
 #define BNXT_FLAG_SHORT_CMD	(1 << 4)
 #define BNXT_FLAG_UPDATE_HASH	(1 << 5)
 #define BNXT_FLAG_PTP_SUPPORTED	(1 << 6)
+#define BNXT_FLAG_MULTI_HOST    (1 << 7)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
-#define BNXT_NPAR_ENABLED(bp)	((bp)->port_partition_type)
-#define BNXT_NPAR_PF(bp)	(BNXT_PF(bp) && BNXT_NPAR_ENABLED(bp))
+#define BNXT_NPAR(bp)		((bp)->port_partition_type)
+#define BNXT_MH(bp)             ((bp)->flags & BNXT_FLAG_MULTI_HOST)
+#define BNXT_SINGLE_PF(bp)      (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp))
 
 	unsigned int		rx_nr_rings;
 	unsigned int		rx_cp_nr_rings;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ce7030d1a..475faac2a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1039,7 +1039,7 @@ static int bnxt_flow_ctrl_set_op(struct rte_eth_dev *dev,
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 
-	if (BNXT_NPAR_PF(bp) || BNXT_VF(bp)) {
+	if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp)) {
 		RTE_LOG(ERR, PMD, "Flow Control Settings cannot be modified\n");
 		return -ENOTSUP;
 	}
@@ -1570,7 +1570,7 @@ bnxt_vlan_pvid_set_op(struct rte_eth_dev *dev, uint16_t pvid, int on)
 	uint16_t vlan = bp->vlan;
 	int rc;
 
-	if (BNXT_NPAR_PF(bp) || BNXT_VF(bp)) {
+	if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp)) {
 		RTE_LOG(ERR, PMD,
 			"PVID cannot be modified for this function\n");
 		return -ENOTSUP;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 68e211395..0c8f6443c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2193,7 +2193,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 	struct bnxt_link_info link_req;
 	uint16_t speed, autoneg;
 
-	if (BNXT_NPAR_PF(bp) || BNXT_VF(bp))
+	if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp))
 		return 0;
 
 	rc = bnxt_valid_link_speed(dev_conf->link_speeds,
@@ -2249,6 +2249,7 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 {
 	struct hwrm_func_qcfg_input req = {0};
 	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	uint16_t flags;
 	int rc = 0;
 
 	HWRM_PREP(req, FUNC_QCFG);
@@ -2260,6 +2261,9 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 
 	/* Hard Coded.. 0xfff VLAN ID mask */
 	bp->vlan = rte_le_to_cpu_16(resp->vlan) & 0xfff;
+	flags = rte_le_to_cpu_16(resp->flags);
+	if (BNXT_PF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST))
+		bp->flags |= BNXT_FLAG_MULTI_HOST;
 
 	switch (resp->port_partition_type) {
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0:
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index fe83d370a..2606e93c1 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -358,12 +358,12 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
-	if (bp->flags & BNXT_FLAG_PORT_STATS && !BNXT_NPAR_PF(bp))
+	if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp))
 		bnxt_hwrm_port_clr_stats(bp);
 
 	if (BNXT_VF(bp))
 		RTE_LOG(ERR, PMD, "Operation not supported on a VF device\n");
-	if (BNXT_NPAR_PF(bp))
+	if (!BNXT_SINGLE_PF(bp))
 		RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n");
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
 		RTE_LOG(ERR, PMD, "Operation not supported\n");
-- 
2.14.3 (Apple Git-98)

  parent reply	other threads:[~2018-01-08 20:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 20:24 [dpdk-dev] [PATCH 00/13] bnxt atchset Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 01/13] net/bnxt: check return values in bnxt_dev_init Ajit Khaparde
2018-01-08 20:53   ` Stephen Hemminger
2018-01-08 20:24 ` [dpdk-dev] [PATCH 02/13] net/bnxt: fix double increment of idx during Tx ring alloc Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 03/13] net/bnxt: parse checksum offload flags Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 04/13] net/bnxt: fix grp_info usage Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 05/13] net/bnxt: return proper error code Ajit Khaparde
2018-01-08 20:24 ` Ajit Khaparde [this message]
2018-01-08 20:24 ` [dpdk-dev] [PATCH 07/13] net/bnxt: check if initialization is done before accessing stats Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 08/13] net/bnxt: fix check for ether_type Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 09/13] net/bnxt: remove unnecessary addition of a temporary filter Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 10/13] net/bnxt: fix duplicate filter pattern creation error Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 11/13] net/bnxt: fix bug with duplicate pattern for 5tuple filter Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 12/13] bnxt/bnxt: free the aggregration ring while freeing all the HWRM rings Ajit Khaparde
2018-01-08 20:24 ` [dpdk-dev] [PATCH 13/13] net/bnxt: check on-chip resources Ajit Khaparde
2018-01-10 20:32 ` [dpdk-dev] [PATCH 00/13] bnxt atchset Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180108202437.56305-7-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).