From: Shijith Thotton <shijith.thotton@caviumnetworks.com>
To: dev@dpdk.org
Cc: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>,
Ferruh Yigit <ferruh.yigit@intel.com>,
dchickles@caviumnetworks.com
Subject: [dpdk-dev] [PATCH] net/liquidio: add support for promiscuous mode
Date: Wed, 11 Oct 2017 13:17:47 +0530 [thread overview]
Message-ID: <1507708067-5127-1-git-send-email-shijith.thotton@caviumnetworks.com> (raw)
From: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>
Signed-off-by: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>
Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
---
doc/guides/nics/features/liquidio.ini | 1 +
doc/guides/nics/liquidio.rst | 8 ++++++
drivers/net/liquidio/base/lio_hw_defs.h | 3 +++
drivers/net/liquidio/lio_ethdev.c | 47 +++++++++++++++++++++++++++++++++
drivers/net/liquidio/lio_struct.h | 1 +
5 files changed, 60 insertions(+)
diff --git a/doc/guides/nics/features/liquidio.ini b/doc/guides/nics/features/liquidio.ini
index d673d7a..f628b76 100644
--- a/doc/guides/nics/features/liquidio.ini
+++ b/doc/guides/nics/features/liquidio.ini
@@ -10,6 +10,7 @@ Link status event = Y
MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
+Promiscuous mode = Y
Allmulticast mode = Y
RSS hash = Y
RSS key update = Y
diff --git a/doc/guides/nics/liquidio.rst b/doc/guides/nics/liquidio.rst
index f04cb16..4ccde0c 100644
--- a/doc/guides/nics/liquidio.rst
+++ b/doc/guides/nics/liquidio.rst
@@ -195,6 +195,14 @@ This section provides instructions to configure SR-IOV with Linux OS.
Done
testpmd>
+#. Enabling VF promiscuous mode
+
+ One VF per PF can be marked as trusted for promiscuous mode.
+
+ .. code-block:: console
+
+ ip link set dev <PF iface> vf <VF id> trust on
+
Limitations
-----------
diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h
index 8713519..c7f97f2 100644
--- a/drivers/net/liquidio/base/lio_hw_defs.h
+++ b/drivers/net/liquidio/base/lio_hw_defs.h
@@ -106,6 +106,8 @@ enum lio_card_type {
#define LIO_FW_VERSION_LENGTH 32
+#define LIO_VF_TRUST_MIN_VERSION "1.7.1"
+
/** Tag types used by Octeon cores in its work. */
enum octeon_tag_type {
OCTEON_ORDERED_TAG = 0,
@@ -185,6 +187,7 @@ enum octeon_tag_type {
/* Interface flags communicated between host driver and core app. */
enum lio_ifflags {
+ LIO_IFFLAG_PROMISC = 0x01,
LIO_IFFLAG_ALLMULTI = 0x02,
LIO_IFFLAG_UNICAST = 0x10
};
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 5407e39..239f6af 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -1049,6 +1049,48 @@ struct rte_lio_xstats_name_off {
}
static void
+lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+ struct lio_device *lio_dev = LIO_DEV(eth_dev);
+
+ if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
+ lio_dev_err(lio_dev, "Require firmware version >= %s\n",
+ LIO_VF_TRUST_MIN_VERSION);
+ return;
+ }
+
+ if (!lio_dev->intf_open) {
+ lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
+ lio_dev->port_id);
+ return;
+ }
+
+ lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
+ lio_change_dev_flag(eth_dev);
+}
+
+static void
+lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+ struct lio_device *lio_dev = LIO_DEV(eth_dev);
+
+ if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
+ lio_dev_err(lio_dev, "Require firmware version >= %s\n",
+ LIO_VF_TRUST_MIN_VERSION);
+ return;
+ }
+
+ if (!lio_dev->intf_open) {
+ lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
+ lio_dev->port_id);
+ return;
+ }
+
+ lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
+ lio_change_dev_flag(eth_dev);
+}
+
+static void
lio_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1748,6 +1790,9 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
goto nic_config_fail;
}
+ snprintf(lio_dev->firmware_version, LIO_FW_VERSION_LENGTH, "%s",
+ resp->cfg_info.lio_firmware_version);
+
lio_swap_8B_data((uint64_t *)(&resp->cfg_info),
sizeof(struct octeon_if_cfg_info) >> 3);
@@ -1851,6 +1896,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
.dev_set_link_up = lio_dev_set_link_up,
.dev_set_link_down = lio_dev_set_link_down,
.dev_close = lio_dev_close,
+ .promiscuous_enable = lio_dev_promiscuous_enable,
+ .promiscuous_disable = lio_dev_promiscuous_disable,
.allmulticast_enable = lio_dev_allmulticast_enable,
.allmulticast_disable = lio_dev_allmulticast_disable,
.link_update = lio_dev_link_update,
diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h
index d9cbf00..635e47f 100644
--- a/drivers/net/liquidio/lio_struct.h
+++ b/drivers/net/liquidio/lio_struct.h
@@ -685,5 +685,6 @@ struct lio_device {
uint8_t port_configured;
struct lio_rss_ctx rss_state;
uint8_t port_id;
+ char firmware_version[LIO_FW_VERSION_LENGTH];
};
#endif /* _LIO_STRUCT_H_ */
--
1.8.3.1
next reply other threads:[~2017-10-11 7:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 7:47 Shijith Thotton [this message]
2017-10-25 1:00 ` 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=1507708067-5127-1-git-send-email-shijith.thotton@caviumnetworks.com \
--to=shijith.thotton@caviumnetworks.com \
--cc=dchickles@caviumnetworks.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=intiyaz.basha@caviumnetworks.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).