From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5FBAEA0565; Tue, 17 Mar 2020 16:42:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A9F41C118; Tue, 17 Mar 2020 16:39:28 +0100 (CET) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by dpdk.org (Postfix) with ESMTP id 560D61BF98 for ; Tue, 17 Mar 2020 16:39:27 +0100 (CET) Received: by mail-wr1-f53.google.com with SMTP id t2so16238722wrx.12 for ; Tue, 17 Mar 2020 08:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R2neahAjWKy5C1se8vQWjaDmdZ3HNgAlSx9oJzD4mrw=; b=VphAbiky5KnrvjPPPpeWqMGEo1ihkZDzdzQ3+C2B7JDBAw7k0D20Igyteq4j1+y6rX 7s26YbK8MZMQmuNRH1byGtCPo1HkzyetcOrJheRXqMIDphuYDq0VjsXNy7EoiBaXIPYA 2Pndq4kYH1wXbApXXtCYGzvh3DXixuokdRKOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R2neahAjWKy5C1se8vQWjaDmdZ3HNgAlSx9oJzD4mrw=; b=YYHtDjrGXsuBUvlDMHX5sO0DhQMEevS60uUByg9gpeTnvteLTPEsclOjl+UwHJYF2F 0jetQXmII/t1E80SRu56ajiXNNCiq+fzJ21+f4wg3v31d3RYHWRR+GaDi/wnVM7kgmNQ mNWnDwLnG3urSuS1c/V5awD9Ldnvs06DFwZB0Y1lay+gWN7Ag1DFIQ0luLsHA8lNX2zD EiWkvmu/meL0XxowtwM+DfXD6u9q+Nxxl1FRRpdx8js5kqhfKOfCkR1wnQ8wh7TbdgwK pqNc5xNAXlKxHOdsrK8PHHNhbwXyuRsmx3abSAkAkc64DfPr9Disqdk8hPsXyEPVs51T p07g== X-Gm-Message-State: ANhLgQ3oPNklq26sJDRp0Qopr385+WCNIRh01VgGIhSutfL0RMurQw/d SeNC5gnWhzX+eNu2CgrOAuWDwTdTbfF3IH/TLpLhb3eKD0ShRkxkquCjzLGgVPQfYyFH9oUESkb pTbbOAxZdtjEM/4QITSTRJilOD/OWw4gZMHPqDpWVtgmZMt+C2p/yWZeHqfjbcsHgRFV3 X-Google-Smtp-Source: ADFU+vt+WCVzZ+NP+Z/JTz8xobiPPU5aYWminBwvA2R6LHbk2Qbw+11RkjHRIzSQ46Umt2DxVAQfgw== X-Received: by 2002:a5d:522c:: with SMTP id i12mr6479645wra.176.1584459566684; Tue, 17 Mar 2020 08:39:26 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id q4sm5052142wro.56.2020.03.17.08.39.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2020 08:39:26 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Venkat Duvvuru Date: Tue, 17 Mar 2020 21:08:11 +0530 Message-Id: <1584459511-5353-14-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584459511-5353-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1584459511-5353-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 13/33] net/bnxt: fetch SVIF information from the firmware X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" SVIF (source virtual interface) is used to represent a physical port, physical function, or a virtual function. SVIF is compared during L2 context and exact match lookups in TX direction. SVIF is masked for port information during L2 context and exact match lookup in RX direction. Hence, driver needs this SVIF information to program L2 context and Exact match tables. Signed-off-by: Venkat Duvvuru Reviewed-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt.h | 7 +++++++ drivers/net/bnxt/bnxt_ethdev.c | 14 ++++++++++++++ drivers/net/bnxt/bnxt_hwrm.c | 34 ++++++++++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 1 + 4 files changed, 56 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 0142acb..dd3cde7 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -684,6 +684,10 @@ struct bnxt { /* TCAM and EM should be 16-bit only. Other modes not supported. */ #define BNXT_FLOW_ID_MASK 0x0000ffff struct bnxt_mark_info *mark_table; + +#define BNXT_SVIF_INVALID 0xFFFF + uint16_t func_svif; + uint16_t port_svif; #ifdef RTE_LIBRTE_BNXT_TRUFLOW struct tf tfp; #endif @@ -727,4 +731,7 @@ extern int bnxt_logtype_driver; #define PMD_DRV_LOG(level, fmt, args...) \ PMD_DRV_LOG_RAW(level, fmt, ## args) + +uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif); + #endif diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 93d0062..f3cc745 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -4696,6 +4696,18 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp) ALLOW_FUNC(HWRM_VNIC_TPA_CFG); } +uint16_t +bnxt_get_svif(uint16_t port_id, bool func_svif) +{ + struct rte_eth_dev *eth_dev; + struct bnxt *bp; + + eth_dev = &rte_eth_devices[port_id]; + bp = eth_dev->data->dev_private; + + return func_svif ? bp->func_svif : bp->port_svif; +} + static int bnxt_init_fw(struct bnxt *bp) { uint16_t mtu; @@ -4731,6 +4743,8 @@ static int bnxt_init_fw(struct bnxt *bp) if (rc) return rc; + bnxt_hwrm_port_mac_qcfg(bp); + rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp); if (rc) return rc; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 5f0c13e..dd47908 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3014,6 +3014,8 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; uint16_t flags; int rc = 0; + bp->func_svif = BNXT_SVIF_INVALID; + uint16_t svif_info; HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB); req.fid = rte_cpu_to_le_16(0xffff); @@ -3024,6 +3026,12 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) /* Hard Coded.. 0xfff VLAN ID mask */ bp->vlan = rte_le_to_cpu_16(resp->vlan) & 0xfff; + + svif_info = rte_le_to_cpu_16(resp->svif_info); + if (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID) + bp->func_svif = svif_info & + HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK; + 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; @@ -3060,6 +3068,32 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) return rc; } +int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp) +{ + struct hwrm_port_mac_qcfg_input req = {0}; + struct hwrm_port_mac_qcfg_output *resp = bp->hwrm_cmd_resp_addr; + uint16_t port_svif_info; + int rc; + + bp->port_svif = BNXT_SVIF_INVALID; + + HWRM_PREP(&req, HWRM_PORT_MAC_QCFG, BNXT_USE_CHIMP_MB); + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + + HWRM_CHECK_RESULT(); + + port_svif_info = rte_le_to_cpu_16(resp->port_svif_info); + if (port_svif_info & + HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_VALID) + bp->port_svif = port_svif_info & + HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_MASK; + + HWRM_UNLOCK(); + + return 0; +} + static void copy_func_cfg_to_qcaps(struct hwrm_func_cfg_input *fcfg, struct hwrm_func_qcaps_output *qcaps) { diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index df7aa74..0079d8a 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -193,6 +193,7 @@ int bnxt_hwrm_port_qstats(struct bnxt *bp); int bnxt_hwrm_port_clr_stats(struct bnxt *bp); int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on); int bnxt_hwrm_port_led_qcaps(struct bnxt *bp); +int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp); int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf, uint32_t flags); void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp); -- 2.7.4