From patchwork Wed Dec 6 10:29:28 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: =?utf-8?q?R=C3=B3bert_Mulik?=
X-Patchwork-Id: 845106
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org;
spf=pass (mailfrom) smtp.mailfrom=openvswitch.org
(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;
envelope-from=ovs-dev-bounces@openvswitch.org;
receiver=)
Authentication-Results: ozlabs.org;
dkim=fail reason="signature verification failed" (1024-bit key;
unprotected) header.d=ericsson.onmicrosoft.com
header.i=@ericsson.onmicrosoft.com header.b="PcpJoKuq";
dkim-atps=neutral
Received: from mail.linuxfoundation.org (mail.linuxfoundation.org
[140.211.169.12])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 3ysFGq6Dsmz9s84
for ;
Wed, 6 Dec 2017 21:29:39 +1100 (AEDT)
Received: from mail.linux-foundation.org (localhost [127.0.0.1])
by mail.linuxfoundation.org (Postfix) with ESMTP id 31E52D66;
Wed, 6 Dec 2017 10:29:36 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@mail.linuxfoundation.org
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 4D732D0E
for ; Wed, 6 Dec 2017 10:29:34 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9A4171B4
for ; Wed, 6 Dec 2017 10:29:32 +0000 (UTC)
X-AuditID: c1b4fb2d-d6fff700000036aa-d5-5a27c68aa3d5
Received: from ESESSHC018.ericsson.se (Unknown_Domain [153.88.183.72])
by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id
D2.39.13994.A86C72A5; Wed, 6 Dec 2017 11:29:30 +0100 (CET)
Received: from EUR02-HE1-obe.outbound.protection.outlook.com (153.88.183.145)
by oa.msg.ericsson.com (153.88.183.72) with Microsoft SMTP Server
(TLS) id 14.3.352.0; Wed, 6 Dec 2017 11:29:30 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=ericsson.onmicrosoft.com; s=selector1-ericsson-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version;
bh=fgL5+Q0135S5GqdwIjgTKNWm8KPEzbOwXBM10JebKL8=;
b=PcpJoKuqlaq8i9f7ZOOtzwLFuZnWXIsD2BfiCrZAynJEQ7i4kR9ADpo6NvNC2KG1wcQObyBh6X7GapwzLzMW5SUHumQoiAauA6zMJV0489zd/A+vXYAG9KoyS2ydpF42RkNZ4bTCP6Tb3ggsPHKlM0aOmAA58NZdoN2OEhLSiGE=
Received: from HE1PR07MB3115.eurprd07.prod.outlook.com (10.170.245.13) by
HE1PR07MB3114.eurprd07.prod.outlook.com (10.170.245.12) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
15.20.282.3; Wed, 6 Dec 2017 10:29:29 +0000
Received: from HE1PR07MB3115.eurprd07.prod.outlook.com
([fe80::4526:3dbd:d2a3:b780]) by
HE1PR07MB3115.eurprd07.prod.outlook.com
([fe80::4526:3dbd:d2a3:b780%13]) with mapi id 15.20.0282.007;
Wed, 6 Dec 2017 10:29:28 +0000
From: =?iso-8859-1?q?R=F3bert_Mulik?=
To: "dev@openvswitch.org"
Thread-Topic: [PATCH] Configurable Link State Change (LSC) detection mode
Thread-Index: AdNue9cLE+i6XvInRViB5fTTJ/9PkA==
Date: Wed, 6 Dec 2017 10:29:28 +0000
Message-ID:
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [91.82.100.59]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; HE1PR07MB3114;
6:rNQ2Hgh/iip9TIYQR1UQn8UN9M42FrLEGgzwNm6Mz1Y0MH33mTvzqQ7boewkaBaPE360khY6klJyUYAKHjupeBoJKcNKNiyIS+7z4q8EIacYgKvvyizQBOZ2s7d6Qi6bVQ+Ibg0Q206RkAaM6d840zfPVzgDBMNbeDFetpvF9+YgK5CV5X364cps5qHGEfXHcyDnc5OtuMi/XpZS9vnO1ORkz4WX3TU/0bo7aB0y/1qZqbi86U5Nco12dK7Xzw4Ll+KA2xO3e4HOyT0B8eD/GXktBXXOQYUCKmntEY1w3FIKMBJtjBJCN/8EL3BS+9zpOhmym2H4ggXWzwLPd1Iaw95YdzWYPMzC7YMJLds22VQ=;
5:DYg7Xy768uBWwfdUFqXj+trJPlYyeiMqVT821jvFJlJcRJpp3RkY6QS/MI8/+MaQNx15q0pWj8VGLhwwKewSz7WBDsfUUrKQyVQRJRsjoDw9Jhr2Ttf7cZBFfdOkXCNuJiUe6LXhTIJ6dk28PftSqhxC8xHJzKmK4QOhl+AYmQw=;
24:3DqKwFehwpJc0rfarpaxvx+BljJm0JWsx+lxmVP+g//13p0V2MmMOxgW30G1K1d3yTsXP+9Ip7pJLc75Htj6koL1DYuaE/lmqCdsXQRNxIE=;
7:rY7cPMwHbfJNkS08KpNGbkfLKycsNWfk0uQcMDU536RY3axu90+twiau2PN/cDP0RE2r2u3Dqzj14d/QOi+/Aww/mlsqW1Y7IiKZnizsCfiPxXEPly5ECPsgGbu/rS32nbjypDqxGaVYFK/QDGD26GPnNMRA7+CIXhbAV0OqqgZf+dLvASLVlG3vkGvYYK3Ex7PYCu4O8x5qGyWpBpWZqXY/J7fmXmtFFlyouu8VYKOdoIg3Fkj/iQlmAsrJlOmI
x-ms-exchange-antispam-srfa-diagnostics: SSOS;
x-ms-office365-filtering-correlation-id: 5eefbdde-2200-4984-3f0b-08d53c943b1f
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603286);
SRVR:HE1PR07MB3114;
x-ms-traffictypediagnostic: HE1PR07MB3114:
x-microsoft-antispam-prvs:
x-exchange-antispam-report-test: UriScan:(37575265505322);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231022)(6041248)(20161123558100)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011);
SRVR:HE1PR07MB3114; BCL:0; PCL:0;
RULEID:(100000803101)(100110400095); SRVR:HE1PR07MB3114;
x-forefront-prvs: 05134F8B4F
x-forefront-antispam-report: SFV:NSPM;
SFS:(10009020)(376002)(366004)(346002)(39860400002)(189003)(199004)(81156014)(106356001)(9686003)(6916009)(55016002)(8676002)(81166006)(6436002)(1730700003)(99286004)(5250100002)(105586002)(33656002)(478600001)(68736007)(101416001)(53936002)(3846002)(25786009)(102836003)(6116002)(53946003)(8936002)(5890100001)(14454004)(2351001)(97736004)(2501003)(305945005)(66066001)(7736002)(86362001)(575784001)(74316002)(316002)(3280700002)(5640700003)(7696005)(5660300001)(3660700001)(6506006)(2906002)(2900100001);
DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR07MB3114;
H:HE1PR07MB3115.eurprd07.prod.outlook.com; FPR:; SPF:None;
PTR:InfoNoRecords; MX:1; A:1; LANG:en;
received-spf: None (protection.outlook.com: ericsson.com does not designate
permitted sender hosts)
authentication-results: spf=none (sender IP is )
smtp.mailfrom=robert.mulik@ericsson.com;
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id:
5eefbdde-2200-4984-3f0b-08d53c943b1f
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2017 10:29:28.6273
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB3114
X-OriginatorOrg: ericsson.com
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrNIsWRmVeSWpSXmKPExsUyM2K7h27XMfUogy2PLC2Ont7D7MDo8ezm
f8YAxigum5TUnMyy1CJ9uwSujAVNv9gKvncwVvydfYqpgXFWShcjJ4eEgInEt+vLWEBsIYHD
jBLLJgt2MXIB2ccZJSauv8wC4rAI9DJL3L68jA2iaiqTxOJGIYiqR4wSk+dcZwVJsAk4Shz9
vIAdxBYR0Jc41HMWqJuDQ1jAReL1Tk+IsKfEmeWHoEr0JO7ueA82k0VAReJ+41KwK3gFYiT2
L/vKBGIzCohJfD+1BsxmFhCXuPVkPhPE1QISS/acZ4awRSVePv7HCmErSGxa8J4dwpaVuDS/
mxHkTgmBQ+wSR7uXQSX0JLZOfMsIYftKNLQvYYIoWsIo0X/jMNQkLYmtB/+xQNjZEk/3fmEF
eUZCwEpi3plYiPoFzBIPW3ZBXSQjsXDKSqhtS1klupfeYYcEV6rE8rWtjBDvxEg8uL8W7Gxh
ASmJu1c6GScwas9C8h2ErSdxY+oUNghbW2LZwtfMs8AhIyhxcuYTlgWMLKsYRYtTi4tz042M
9VKLMpOLi/Pz9PJSSzYxApPEwS2/dXcwrn7teIhRgINRiYe3+Kh6lBBrYllxZe4hRgkOZiUR
XoGDQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8Jz15o4QE0hNLUrNTUwtSi2CyTBycUg2M7A76
dpO0Tp74ejXd0fr8ecs8gZB9GZk/Dgqr/L5wIaBtx4asc4a73yy4+ui0VK38n1f/EtYzis6z
3qt7O1h/p2d/w8ElO2f8eqOeEbhHJ3rmj8uG0ySK/p7+b/hB+UFEaeD5ZeHLezban/wYGWPm
+vZkaDf3w4s7AtadDn9yIkmbaevPE4EpKkosxRmJhlrMRcWJAOw9Y14OAwAA
X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
Subject: [ovs-dev] [PATCH] Configurable Link State Change (LSC) detection
mode
X-BeenThere: ovs-dev@openvswitch.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: ovs-dev-bounces@openvswitch.org
Errors-To: ovs-dev-bounces@openvswitch.org
It is possible to set LSC detection mode to polling or interrupt mode
for DPDK interfaces. The default is polling mode. To set interrupt mode,
option dpdk-lsc-interrupt has to be set to true.
Global settings
Service restart is necessary for the global settings to take effect.
Command to set interrupt mode for all interfaces:
ovs-vsctl set Open_vSwitch . other_config:dpdk-lsc-interrupt=true
Command to set polling mode for all interfaces:
ovs-vsctl set Open_vSwitch . other_config:dpdk-lsc-interrupt=false
or:
ovs-vsctl remove Open_vSwitch . other_config dpdk-lsc-interrupt
Interface specific settings (override global settings)
Service restart is not necessary to take effect.
Command to set interrupt mode for a specific interface:
ovs-vsctl set interface other_config:dpdk-lsc-interrupt=true
Command to set polling mode for a specific interface:
ovs-vsctl set interface other_config:dpdk-lsc-interrupt=false
Command to reset to globally defined mode for a specific interface:
ovs-vsctl remove interface other_config dpdk-lsc-interrupt
Signed-off-by: Robert Mulik
---
lib/dpdk.c | 6 ++++++
lib/netdev-dpdk.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++-
lib/netdev-dpdk.h | 8 +++++++
lib/netdev-dummy.c | 2 ++
lib/netdev-linux.c | 2 ++
lib/netdev-provider.h | 3 +++
lib/netdev-vport.c | 2 ++
lib/netdev.c | 32 +++++++++++++++++++++++++++
lib/netdev.h | 2 ++
vswitchd/bridge.c | 34 +++++++++++++++++++++++++++++
vswitchd/vswitch.xml | 42 ++++++++++++++++++++++++++++++++++++
11 files changed, 192 insertions(+), 1 deletion(-)
--
1.9.1
diff --git a/lib/dpdk.c b/lib/dpdk.c
index 8da6c32..09c4f9b 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -345,6 +345,12 @@ dpdk_init__(const struct smap *ovs_other_config)
vhost_sock_dir = sock_dir_subcomponent;
}
+ if (smap_get_bool(ovs_other_config, "dpdk-lsc-interrupt", false)) {
+ netdev_dpdk_set_default_lsc_detect_mode(NETDEV_DPDK_LSC_DETECT_INTERRUPT_MODE);
+ } else {
+ netdev_dpdk_set_default_lsc_detect_mode(NETDEV_DPDK_LSC_DETECT_POLL_MODE);
+ }
+
argv = grow_argv(&argv, 0, 1);
argc = 1;
argv[0] = xstrdup(ovs_get_program_name());
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index faff842..ac722cc 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -146,7 +146,7 @@ typedef uint8_t dpdk_port_t;
#define VHOST_ENQ_RETRY_NUM 8
#define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
-static const struct rte_eth_conf port_conf = {
+static struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_RSS,
.split_hdr_size = 0,
@@ -165,6 +165,9 @@ static const struct rte_eth_conf port_conf = {
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
},
+ .intr_conf = {
+ .lsc = (uint16_t)NETDEV_DPDK_LSC_DETECT_POLL_MODE, /* LSC interrupt mode disabled, polling mode used. */
+ },
};
/*
@@ -397,6 +400,9 @@ struct netdev_dpdk {
int requested_n_rxq;
int requested_rxq_size;
int requested_txq_size;
+ enum netdev_dpdk_lsc_detect_mode requested_lsc_detect_mode;
+
+ enum netdev_dpdk_lsc_detect_mode lsc_detect_mode;
/* Number of rx/tx descriptors for physical devices */
int rxq_size;
@@ -430,6 +436,18 @@ int netdev_dpdk_get_vid(const struct netdev_dpdk *dev);
struct ingress_policer *
netdev_dpdk_get_ingress_policer(const struct netdev_dpdk *dev);
+void
+netdev_dpdk_set_default_lsc_detect_mode(enum netdev_dpdk_lsc_detect_mode default_lsc)
+{
+ port_conf.intr_conf.lsc = (uint16_t)default_lsc;
+}
+
+enum netdev_dpdk_lsc_detect_mode
+netdev_dpdk_get_default_lsc_detect_mode(void)
+{
+ return port_conf.intr_conf.lsc;
+}
+
static bool
is_dpdk_class(const struct netdev_class *class)
{
@@ -663,6 +681,8 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
int i;
struct rte_eth_conf conf = port_conf;
+ conf.intr_conf.lsc = dev->lsc_detect_mode;
+
/* For some NICs (e.g. Niantic), scatter_rx mode needs to be explicitly
* enabled. */
if (dev->mtu > ETHER_MTU) {
@@ -868,6 +888,7 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
dev->flags = 0;
dev->requested_mtu = ETHER_MTU;
dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
+ dev->requested_lsc_detect_mode = netdev_dpdk_get_default_lsc_detect_mode();
ovsrcu_index_init(&dev->vid, -1);
dev->vhost_reconfigured = false;
dev->attached = false;
@@ -2005,6 +2026,38 @@ netdev_dpdk_set_mtu(struct netdev *netdev, int mtu)
}
static int
+netdev_dpdk_get_lsc_detect_mode(const struct netdev *netdev, uint16_t *lscp)
+{
+ struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+
+ ovs_mutex_lock(&dev->mutex);
+ *lscp = (uint16_t)dev->lsc_detect_mode;
+ ovs_mutex_unlock(&dev->mutex);
+
+ return 0;
+}
+
+static int
+netdev_dpdk_set_lsc_detect_mode(struct netdev *netdev, uint16_t lsc_detect_mode)
+{
+ struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+
+ if (lsc_detect_mode > NETDEV_DPDK_LSC_DETECT_MAX) {
+ VLOG_WARN("%s: invalid LSC value %d\n", dev->up.name, lsc_detect_mode);
+ return EINVAL;
+ }
+
+ ovs_mutex_lock(&dev->mutex);
+ if (dev->requested_lsc_detect_mode != (enum netdev_dpdk_lsc_detect_mode)lsc_detect_mode) {
+ dev->requested_lsc_detect_mode = (enum netdev_dpdk_lsc_detect_mode)lsc_detect_mode;
+ netdev_request_reconfigure(netdev);
+ }
+ ovs_mutex_unlock(&dev->mutex);
+
+ return 0;
+}
+
+static int
netdev_dpdk_get_carrier(const struct netdev *netdev, bool *carrier);
static int
@@ -3166,6 +3219,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
if (netdev->n_txq == dev->requested_n_txq
&& netdev->n_rxq == dev->requested_n_rxq
&& dev->mtu == dev->requested_mtu
+ && dev->lsc_detect_mode == dev->requested_lsc_detect_mode
&& dev->rxq_size == dev->requested_rxq_size
&& dev->txq_size == dev->requested_txq_size
&& dev->socket_id == dev->requested_socket_id) {
@@ -3181,6 +3235,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
goto out;
}
+ dev->lsc_detect_mode = dev->requested_lsc_detect_mode;
+
netdev->n_txq = dev->requested_n_txq;
netdev->n_rxq = dev->requested_n_rxq;
@@ -3343,6 +3399,8 @@ unlock:
netdev_dpdk_get_etheraddr, \
netdev_dpdk_get_mtu, \
netdev_dpdk_set_mtu, \
+ netdev_dpdk_get_lsc_detect_mode, \
+ netdev_dpdk_set_lsc_detect_mode, \
netdev_dpdk_get_ifindex, \
GET_CARRIER, \
netdev_dpdk_get_carrier_resets, \
diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h
index b7d02a7..28a6c98 100644
--- a/lib/netdev-dpdk.h
+++ b/lib/netdev-dpdk.h
@@ -25,8 +25,16 @@ struct dp_packet;
#ifdef DPDK_NETDEV
+enum netdev_dpdk_lsc_detect_mode {
+ NETDEV_DPDK_LSC_DETECT_POLL_MODE,
+ NETDEV_DPDK_LSC_DETECT_INTERRUPT_MODE,
+ NETDEV_DPDK_LSC_DETECT_MAX = NETDEV_DPDK_LSC_DETECT_INTERRUPT_MODE,
+};
+
void netdev_dpdk_register(void);
void free_dpdk_buf(struct dp_packet *);
+void netdev_dpdk_set_default_lsc_detect_mode(enum netdev_dpdk_lsc_detect_mode default_lsc);
+enum netdev_dpdk_lsc_detect_mode netdev_dpdk_get_default_lsc_detect_mode(void);
#else
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 246cdf1..31052c7 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -1378,6 +1378,8 @@ netdev_dummy_update_flags(struct netdev *netdev_,
netdev_dummy_get_etheraddr, \
netdev_dummy_get_mtu, \
netdev_dummy_set_mtu, \
+ NULL, /* get_lsc_detect_mode */ \
+ NULL, /* set_lsc_detect_mode */ \
netdev_dummy_get_ifindex, \
NULL, /* get_carrier */ \
NULL, /* get_carrier_resets */ \
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index e809b88..252a8f9 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2848,6 +2848,8 @@ netdev_linux_update_flags(struct netdev *netdev_, enum netdev_flags off,
netdev_linux_get_etheraddr, \
netdev_linux_get_mtu, \
netdev_linux_set_mtu, \
+ NULL, /* get_lsc_detect_mode */ \
+ NULL, /* set_lsc_detect_mode */ \
netdev_linux_get_ifindex, \
netdev_linux_get_carrier, \
netdev_linux_get_carrier_resets, \
diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index 1720deb..865c0c4 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -413,6 +413,9 @@ struct netdev_class {
* null if it would always return EOPNOTSUPP. */
int (*set_mtu)(struct netdev *netdev, int mtu);
+ int (*get_lsc_detect_mode)(const struct netdev *netdev, uint16_t *lscp);
+ int (*set_lsc_detect_mode)(struct netdev *netdev, uint16_t lsc);
+
/* Returns the ifindex of 'netdev', if successful, as a positive number.
* On failure, returns a negative errno value.
*
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 518058a..7788ce8 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -901,6 +901,8 @@ netdev_vport_get_ifindex(const struct netdev *netdev_)
netdev_vport_get_etheraddr, \
NULL, /* get_mtu */ \
NULL, /* set_mtu */ \
+ NULL, /* get_lsc_detect_mode */ \
+ NULL, /* set_lsc_detect_mode */ \
GET_IFINDEX, \
NULL, /* get_carrier */ \
NULL, /* get_carrier_resets */ \
diff --git a/lib/netdev.c b/lib/netdev.c
index 2d69fe5..3ea2394 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -960,6 +960,38 @@ netdev_set_mtu(struct netdev *netdev, int mtu)
return error;
}
+int
+netdev_get_lsc_detect_mode(const struct netdev *netdev, uint16_t *lscp)
+{
+ const struct netdev_class *class = netdev->netdev_class;
+ int error;
+
+ error = class->get_lsc_detect_mode ? class->get_lsc_detect_mode(netdev, lscp) : EOPNOTSUPP;
+ if (error) {
+ *lscp = 0;
+ if (error != EOPNOTSUPP) {
+ VLOG_DBG_RL(&rl, "failed to retrieve LSC for network device %s: "
+ "%s", netdev_get_name(netdev), ovs_strerror(error));
+ }
+ }
+ return error;
+}
+
+int
+netdev_set_lsc_detect_mode(struct netdev *netdev, uint16_t lsc)
+{
+ const struct netdev_class *class = netdev->netdev_class;
+ int error;
+
+ error = class->set_lsc_detect_mode ? class->set_lsc_detect_mode(netdev, lsc) : EOPNOTSUPP;
+ if (error && error != EOPNOTSUPP) {
+ VLOG_DBG_RL(&rl, "failed to set LSC for network device %s: %s",
+ netdev_get_name(netdev), ovs_strerror(error));
+ }
+
+ return error;
+}
+
/* If 'user_config' is true, the user wants to control 'netdev''s MTU and we
* should not override it. If 'user_config' is false, we may adjust
* 'netdev''s MTU (e.g., if 'netdev' is internal). */
diff --git a/lib/netdev.h b/lib/netdev.h
index 3a545fe..465285a 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -162,6 +162,8 @@ const char *netdev_get_type(const struct netdev *);
const char *netdev_get_type_from_name(const char *);
int netdev_get_mtu(const struct netdev *, int *mtup);
int netdev_set_mtu(struct netdev *, int mtu);
+int netdev_get_lsc_detect_mode(const struct netdev *, uint16_t *lscp);
+int netdev_set_lsc_detect_mode(struct netdev *, uint16_t lsc);
void netdev_mtu_user_config(struct netdev *, bool);
bool netdev_mtu_is_user_config(struct netdev *);
int netdev_get_ifindex(const struct netdev *);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 630c6fa..2249e75 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -68,6 +68,9 @@
#include "lib/vswitch-idl.h"
#include "xenserver.h"
#include "vlan-bitmap.h"
+#ifdef DPDK_NETDEV
+#include "./lib/netdev-provider.h"
+#endif
VLOG_DEFINE_THIS_MODULE(bridge);
@@ -776,6 +779,30 @@ iface_set_netdev_mtu(const struct ovsrec_interface *iface_cfg,
return 0;
}
+#ifdef DPDK_NETDEV
+static void
+iface_set_netdev_lsc_detect_mode(struct netdev *netdev,
+ const struct ovsrec_interface *cfg)
+{
+ if(netdev && netdev_get_class(netdev) && netdev_get_class(netdev)->set_lsc_detect_mode)
+ {
+ struct smap_node *node = smap_get_node(&cfg->other_config, "dpdk-lsc-interrupt");
+ uint16_t lsc;
+
+ if(node) {
+ /* Set local LSC interrupt config for interface. */
+ lsc = smap_get_bool(&cfg->other_config, "dpdk-lsc-interrupt", false);
+ } else {
+ /* Set global LSC interrupt config if port specific is not defined. */
+ lsc = netdev_dpdk_get_default_lsc_detect_mode();
+ }
+ /* Update port specific configuration, and reconfigure device.
+ Can be applied only for physical interfaces. */
+ netdev_set_lsc_detect_mode(netdev, lsc);
+ }
+}
+#endif
+
static void
bridge_delete_or_reconfigure_ports(struct bridge *br)
{
@@ -832,6 +859,10 @@ bridge_delete_or_reconfigure_ports(struct bridge *br)
iface_set_netdev_mtu(iface->cfg, iface->netdev);
+#ifdef DPDK_NETDEV
+ iface_set_netdev_lsc_detect_mode(iface->netdev, iface->cfg);
+#endif
+
/* If the requested OpenFlow port for 'iface' changed, and it's not
* already the correct port, then we might want to temporarily delete
* this interface, so we can add it back again with the new OpenFlow
@@ -1794,6 +1825,9 @@ iface_do_create(const struct bridge *br,
}
iface_set_netdev_mtu(iface_cfg, netdev);
+#ifdef DPDK_NETDEV
+ iface_set_netdev_lsc_detect_mode(netdev, iface_cfg);
+#endif
*ofp_portp = iface_pick_ofport(iface_cfg);
error = ofproto_port_add(br->ofproto, netdev, ofp_portp);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index c145e1a..87c0b52 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -320,6 +320,29 @@
+
+
+ Set this value to true
to set interrupt mode for Link
+ State Change (LSC) detection instead of poll mode for DPDK interfaces.
+
+
+ The default value is false
. Changing this value requires
+ restarting the daemon
+
+
+ If this value is false
at startup, poll mode is used for
+ all netdev dpdk interfaces.
+
+
+ This value can be overridden for a single interface in the other_config
+ section of that interface.
+
+
+ This parameter has any effect only on netdev dpdk interfaces.
+
+
+
@@ -3512,6 +3535,25 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \
+
+
+
+ Set this value to true
to set interrupt mode for Link
+ State Change (LSC) detection instead of poll mode for the DPDK interface.
+
+
+ If this value is not set, the value is taken from the global settings.
+
+
+ If this value is set, the global LSC interrupt settings are overridden.
+
+
+ This parameter has any effect only on netdev dpdk interfaces.
+
+
+
+
The overall purpose of these columns is described under Common
Columns
at the beginning of this document.