DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alfredo Cardigliano <cardigliano@ntop.org>
To: Alfredo Cardigliano <cardigliano@ntop.org>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 12/17] net/ionic: add Flow Control support
Date: Tue, 15 Oct 2019 10:22:30 +0200	[thread overview]
Message-ID: <20191015082235.28639-13-cardigliano@ntop.org> (raw)
In-Reply-To: <20191015082235.28639-1-cardigliano@ntop.org>

Add support for managing Flow Control.

Signed-off-by: Alfredo Cardigliano <cardigliano@ntop.org>
Reviewed-by: Shannon Nelson <snelson@pensando.io>
---
 doc/guides/nics/features/ionic.ini |  1 +
 drivers/net/ionic/ionic_ethdev.c   | 56 ++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini
index 3dd5dab45..05bdb2d98 100644
--- a/doc/guides/nics/features/ionic.ini
+++ b/doc/guides/nics/features/ionic.ini
@@ -12,6 +12,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 Linux UIO            = Y
 Linux VFIO           = Y
 x86-64               = Y
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index cf02cdae3..072e2edba 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -29,6 +29,10 @@ static int  ionic_dev_set_link_up(struct rte_eth_dev *dev);
 static int  ionic_dev_set_link_down(struct rte_eth_dev *dev);
 static int  ionic_dev_link_update(struct rte_eth_dev *eth_dev,
 		int wait_to_complete);
+static int  ionic_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+		struct rte_eth_fc_conf *fc_conf);
+static int  ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+		struct rte_eth_fc_conf *fc_conf);
 
 int ionic_logtype_init;
 int ionic_logtype_driver;
@@ -58,6 +62,8 @@ static const struct eth_dev_ops ionic_eth_dev_ops = {
 	.promiscuous_disable    = ionic_dev_promiscuous_disable,
 	.allmulticast_enable    = ionic_dev_allmulticast_enable,
 	.allmulticast_disable   = ionic_dev_allmulticast_disable,
+	.flow_ctrl_get          = ionic_flow_ctrl_get,
+	.flow_ctrl_set          = ionic_flow_ctrl_set,
 };
 
 /*
@@ -247,6 +253,56 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+static int
+ionic_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+		struct rte_eth_fc_conf *fc_conf)
+{
+	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
+	struct ionic_adapter *adapter = lif->adapter;
+	struct ionic_dev *idev = &adapter->idev;
+
+	if (idev->port_info) {
+		fc_conf->autoneg = idev->port_info->config.an_enable;
+
+		if (idev->port_info->config.pause_type)
+			fc_conf->mode = RTE_FC_FULL;
+		else
+			fc_conf->mode = RTE_FC_NONE;
+	}
+
+	return 0;
+}
+
+static int
+ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+		struct rte_eth_fc_conf *fc_conf)
+{
+	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
+	struct ionic_adapter *adapter = lif->adapter;
+	struct ionic_dev *idev = &adapter->idev;
+	uint8_t pause_type = IONIC_PORT_PAUSE_TYPE_NONE;
+	uint8_t an_enable;
+
+	switch (fc_conf->mode) {
+	case RTE_FC_NONE:
+		pause_type = IONIC_PORT_PAUSE_TYPE_NONE;
+		break;
+	case RTE_FC_FULL:
+		pause_type = IONIC_PORT_PAUSE_TYPE_LINK;
+		break;
+	case RTE_FC_RX_PAUSE:
+	case RTE_FC_TX_PAUSE:
+		return -ENOTSUP;
+	}
+
+	an_enable = fc_conf->autoneg;
+
+	ionic_dev_cmd_port_pause(idev, pause_type);
+	ionic_dev_cmd_port_autoneg(idev, an_enable);
+
+	return 0;
+}
+
 static int
 ionic_dev_configure(struct rte_eth_dev *eth_dev)
 {
-- 
2.17.1


  parent reply	other threads:[~2019-10-15  8:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  8:22 [dpdk-dev] [PATCH v2 00/17] Introduces net/ionic PMD Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 01/17] net/ionic: add skeleton Alfredo Cardigliano
2019-12-02 16:06   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 02/17] net/ionic: add hardware structures definitions Alfredo Cardigliano
2019-12-02 16:07   ` Ferruh Yigit
2019-12-02 16:33   ` Stephen Hemminger
2019-12-04 16:26     ` Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 03/17] net/ionic: add log Alfredo Cardigliano
2019-12-02 16:07   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 04/17] net/ionic: register and initialize the adapter Alfredo Cardigliano
2019-12-02 16:09   ` Ferruh Yigit
2019-12-08 19:25     ` Alfredo Cardigliano
2019-12-09  9:12       ` Ferruh Yigit
2019-12-02 16:35   ` Stephen Hemminger
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 05/17] net/ionic: add port management commands Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 06/17] net/ionic: add basic lif support Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 07/17] net/ionic: add doorbells Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 08/17] net/ionic: add adminq support Alfredo Cardigliano
2019-12-02 16:15   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 09/17] net/ionic: add notifyq support Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 10/17] net/ionic: add basic port operations Alfredo Cardigliano
2019-12-02 16:11   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 11/17] net/ionic: add RX filters support Alfredo Cardigliano
2019-10-15  8:22 ` Alfredo Cardigliano [this message]
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 13/17] net/ionic: add RX and TX handling Alfredo Cardigliano
2019-12-02 16:13   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 14/17] net/ionic: add RSS support Alfredo Cardigliano
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 15/17] net/ionic: add stats Alfredo Cardigliano
2019-12-02 16:14   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 16/17] net/ionic: add TX checksum support Alfredo Cardigliano
2019-12-02 16:15   ` Ferruh Yigit
2019-10-15  8:22 ` [dpdk-dev] [PATCH v2 17/17] net/ionic: read fw version Alfredo Cardigliano
2019-10-15 13:09 ` [dpdk-dev] [PATCH v2 00/17] Introduces net/ionic PMD 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=20191015082235.28639-13-cardigliano@ntop.org \
    --to=cardigliano@ntop.org \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@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).