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 13F68A0350; Mon, 3 Jan 2022 11:02:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E0D541223; Mon, 3 Jan 2022 11:01:48 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id B721441154 for ; Mon, 3 Jan 2022 11:01:38 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 98BDE1A093F; Mon, 3 Jan 2022 11:01:38 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 620DE1A0926; Mon, 3 Jan 2022 11:01:38 +0100 (CET) Received: from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com [92.120.147.114]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id C0845183AD05; Mon, 3 Jan 2022 18:01:37 +0800 (+08) From: nipun.gupta@nxp.com To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, stephen@networkplumber.org, Gagandeep Singh Subject: [PATCH v3 13/15] net/enetc: add support for VFs Date: Mon, 3 Jan 2022 15:31:27 +0530 Message-Id: <20220103100129.23965-14-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220103100129.23965-1-nipun.gupta@nxp.com> References: <20211206121824.3493-1-nipun.gupta@nxp.com> <20220103100129.23965-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP 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 From: Gagandeep Singh Add virtual function support for enetc devices Signed-off-by: Gagandeep Singh --- drivers/net/enetc/enetc_ethdev.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 7cdb8ce463..1b4337bc48 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -19,6 +19,9 @@ enetc_dev_start(struct rte_eth_dev *dev) uint32_t val; PMD_INIT_FUNC_TRACE(); + if (hw->device_id == ENETC_DEV_ID_VF) + return 0; + val = enetc_port_rd(enetc_hw, ENETC_PM0_CMD_CFG); enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG, val | ENETC_PM0_TX_EN | ENETC_PM0_RX_EN); @@ -55,6 +58,9 @@ enetc_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); dev->data->dev_started = 0; + if (hw->device_id == ENETC_DEV_ID_VF) + return 0; + /* Disable port */ val = enetc_port_rd(enetc_hw, ENETC_PMR); enetc_port_wr(enetc_hw, ENETC_PMR, val & (~ENETC_PMR_EN)); @@ -160,11 +166,20 @@ enetc_hardware_init(struct enetc_eth_hw *hw) /* Enabling Station Interface */ enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN); - *mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0)); - high_mac = (uint32_t)*mac; - mac++; - *mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0)); - low_mac = (uint16_t)*mac; + + if (hw->device_id == ENETC_DEV_ID_VF) { + *mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR0); + high_mac = (uint32_t)*mac; + mac++; + *mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR1); + low_mac = (uint16_t)*mac; + } else { + *mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0)); + high_mac = (uint32_t)*mac; + mac++; + *mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0)); + low_mac = (uint16_t)*mac; + } if ((high_mac | low_mac) == 0) { char *first_byte; -- 2.17.1