From: Yanling Song <songyl@ramaxel.com>
To: <dev@dpdk.org>
Cc: <songyl@ramaxel.com>, <yanling.song@linux.dev>,
<yanggan@ramaxel.com>, <xuyun@ramaxel.com>,
<ferruh.yigit@intel.com>
Subject: [PATCH v3 14/25] net/spnic: add port/vport enable
Date: Fri, 24 Dec 2021 16:32:32 +0800 [thread overview]
Message-ID: <39315a3d77adba26094fd1ede6d1e2bc37c75ec2.1640332922.git.songyl@ramaxel.com> (raw)
In-Reply-To: <cover.1640332922.git.songyl@ramaxel.com>
This patch adds interface to enable port/vport so that the hardware
would receive packets to host.
Signed-off-by: Yanling Song <songyl@ramaxel.com>
---
drivers/net/spnic/spnic_ethdev.c | 46 ++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/drivers/net/spnic/spnic_ethdev.c b/drivers/net/spnic/spnic_ethdev.c
index 74d09bafac..0459959ca5 100644
--- a/drivers/net/spnic/spnic_ethdev.c
+++ b/drivers/net/spnic/spnic_ethdev.c
@@ -855,8 +855,10 @@ static void spnic_deinit_sw_rxtxqs(struct spnic_nic_dev *nic_dev)
static int spnic_dev_start(struct rte_eth_dev *eth_dev)
{
struct spnic_nic_dev *nic_dev;
+ struct spnic_rxq *rxq = NULL;
u64 nic_features;
int err;
+ u16 i;
nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
@@ -916,6 +918,22 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev)
spnic_start_all_sqs(eth_dev);
+ /* Open virtual port and ready to start packet receiving */
+ err = spnic_set_vport_enable(nic_dev->hwdev, true);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Enable vport failed, dev_name: %s",
+ eth_dev->data->name);
+ goto en_vport_fail;
+ }
+
+ /* Open physical port and start packet receiving */
+ err = spnic_set_port_enable(nic_dev->hwdev, true);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Enable physical port failed, dev_name: %s",
+ eth_dev->data->name);
+ goto en_port_fail;
+ }
+
/* Update eth_dev link status */
if (eth_dev->data->dev_conf.intr_conf.lsc != 0)
(void)spnic_link_update(eth_dev, 0);
@@ -924,6 +942,20 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev)
return 0;
+en_port_fail:
+ (void)spnic_set_vport_enable(nic_dev->hwdev, false);
+
+en_vport_fail:
+ /* Flush tx && rx chip resources in case of setting vport fake fail */
+ (void)spnic_flush_qps_res(nic_dev->hwdev);
+ rte_delay_ms(100);
+ for (i = 0; i < nic_dev->num_rqs; i++) {
+ rxq = nic_dev->rxqs[i];
+ spnic_remove_rq_from_rx_queue_list(nic_dev, rxq->q_id);
+ spnic_free_rxq_mbufs(rxq);
+ eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+ eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+ }
start_rqs_fail:
spnic_remove_rxtx_configure(eth_dev);
@@ -951,6 +983,7 @@ static int spnic_dev_stop(struct rte_eth_dev *dev)
{
struct spnic_nic_dev *nic_dev;
struct rte_eth_link link;
+ int err;
nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
if (!rte_bit_relaxed_test_and_clear32(SPNIC_DEV_START, &nic_dev->dev_status)) {
@@ -959,6 +992,19 @@ static int spnic_dev_stop(struct rte_eth_dev *dev)
return 0;
}
+ /* Stop phy port and vport */
+ err = spnic_set_port_enable(nic_dev->hwdev, false);
+ if (err)
+ PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, "
+ "dev_name: %s, port_id: %d", err, dev->data->name,
+ dev->data->port_id);
+
+ err = spnic_set_vport_enable(nic_dev->hwdev, false);
+ if (err)
+ PMD_DRV_LOG(WARNING, "Disable vport failed, error: %d, "
+ "dev_name: %s, port_id: %d", err, dev->data->name,
+ dev->data->port_id);
+
/* Clear recorded link status */
memset(&link, 0, sizeof(link));
(void)rte_eth_linkstatus_set(dev, &link);
--
2.32.0
next prev parent reply other threads:[~2021-12-24 8:34 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-24 8:32 [PATCH v3 00/25] Net/SPNIC: support SPNIC into DPDK 22.03 Yanling Song
2021-12-24 8:32 ` [PATCH v3 01/25] drivers/net: introduce a new PMD driver Yanling Song
2021-12-24 8:32 ` [PATCH v3 02/25] net/spnic: initialize the HW interface Yanling Song
2021-12-24 8:32 ` [PATCH v3 03/25] net/spnic: add mbox message channel Yanling Song
2021-12-24 8:32 ` [PATCH v3 04/25] net/spnic: introduce event queue Yanling Song
2021-12-24 8:32 ` [PATCH v3 05/25] net/spnic: add mgmt module Yanling Song
2021-12-28 15:59 ` Stephen Hemminger
2021-12-29 10:26 ` Yanling Song
2021-12-24 8:32 ` [PATCH v3 06/25] net/spnic: add cmdq and work queue Yanling Song
2021-12-24 8:32 ` [PATCH v3 07/25] net/spnic: add interface handling cmdq message Yanling Song
2021-12-24 8:32 ` [PATCH v3 08/25] net/spnic: add hardware info initialization Yanling Song
2021-12-24 8:32 ` [PATCH v3 09/25] net/spnic: support MAC and link event handling Yanling Song
2021-12-24 8:32 ` [PATCH v3 10/25] net/spnic: add function info initialization Yanling Song
2021-12-24 8:32 ` [PATCH v3 11/25] net/spnic: add queue pairs context initialization Yanling Song
2021-12-24 8:32 ` [PATCH v3 12/25] net/spnic: support mbuf handling of Tx/Rx Yanling Song
2021-12-24 8:32 ` [PATCH v3 13/25] net/spnic: support Rx congfiguration Yanling Song
2021-12-24 8:32 ` Yanling Song [this message]
2021-12-24 8:32 ` [PATCH v3 15/25] net/spnic: support IO packets handling Yanling Song
2021-12-24 8:32 ` [PATCH v3 16/25] net/spnic: add device configure/version/info Yanling Song
2021-12-24 8:32 ` [PATCH v3 17/25] net/spnic: support RSS configuration update and get Yanling Song
2021-12-24 8:32 ` [PATCH v3 18/25] net/spnic: support VLAN filtering and offloading Yanling Song
2021-12-24 8:32 ` [PATCH v3 19/25] net/spnic: support promiscuous and allmulticast Rx modes Yanling Song
2021-12-24 8:32 ` [PATCH v3 20/25] net/spnic: support flow control Yanling Song
2021-12-24 8:32 ` [PATCH v3 21/25] net/spnic: support getting Tx/Rx queues info Yanling Song
2021-12-24 8:32 ` [PATCH v3 22/25] net/spnic: net/spnic: support xstats statistics Yanling Song
2021-12-24 8:32 ` [PATCH v3 23/25] net/spnic: support VFIO interrupt Yanling Song
2021-12-24 8:32 ` [PATCH v3 24/25] net/spnic: support Tx/Rx queue start/stop Yanling Song
2021-12-24 8:32 ` [PATCH v3 25/25] net/spnic: add doc infrastructure Yanling Song
2021-12-24 17:44 ` [PATCH v3 00/25] Net/SPNIC: support SPNIC into DPDK 22.03 Stephen Hemminger
2021-12-28 7:01 ` Yanling Song
2021-12-28 15:55 ` Stephen Hemminger
2021-12-29 12:11 ` Yanling Song
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=39315a3d77adba26094fd1ede6d1e2bc37c75ec2.1640332922.git.songyl@ramaxel.com \
--to=songyl@ramaxel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=xuyun@ramaxel.com \
--cc=yanggan@ramaxel.com \
--cc=yanling.song@linux.dev \
/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).