From: Pascal Mazon <pascal.mazon@6wind.com>
To: keith.wiles@intel.com
Cc: dev@dpdk.org, Pascal Mazon <pascal.mazon@6wind.com>
Subject: [dpdk-dev] [PATCH v3 2/4] net/tap: reflect tap flags on the remote
Date: Wed, 8 Mar 2017 11:06:45 +0100 [thread overview]
Message-ID: <dd0dfeac610fa0e2c912be73f94dd28c97561dbc.1488967463.git.pascal.mazon@6wind.com> (raw)
In-Reply-To: <cover.1488967463.git.pascal.mazon@6wind.com>
Synchronize PROMISC and ALLMULTI flags to the remote netdevice if
possible.
Leave the IFF_UP flag as it is, however.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
---
drivers/net/tap/rte_eth_tap.c | 37 ++++++++++++++++++++++++-------------
drivers/net/tap/tap.h | 2 ++
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index f3d9d8fe96aa..b0f5ffbb8ace 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -254,7 +254,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
}
static int
-tap_link_set_flags(struct pmd_internals *pmd, short flags, int add)
+tap_netdev_set_flags(const char *iface, short flags, int add)
{
struct ifreq ifr;
int err, s;
@@ -271,11 +271,11 @@ tap_link_set_flags(struct pmd_internals *pmd, short flags, int add)
return -1;
}
memset(&ifr, 0, sizeof(ifr));
- snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name);
+ snprintf(ifr.ifr_name, IFNAMSIZ, "%s", iface);
err = ioctl(s, SIOCGIFFLAGS, &ifr);
if (err < 0) {
RTE_LOG(WARNING, PMD, "Unable to get %s device flags: %s\n",
- pmd->name, strerror(errno));
+ iface, strerror(errno));
close(s);
return -1;
}
@@ -293,6 +293,7 @@ tap_link_set_flags(struct pmd_internals *pmd, short flags, int add)
close(s);
return 0;
+
}
static int
@@ -301,7 +302,7 @@ tap_link_set_down(struct rte_eth_dev *dev)
struct pmd_internals *pmd = dev->data->dev_private;
dev->data->dev_link.link_status = ETH_LINK_DOWN;
- return tap_link_set_flags(pmd, IFF_UP | IFF_NOARP, 0);
+ return tap_netdev_set_flags(pmd->name, IFF_UP | IFF_NOARP, 0);
}
static int
@@ -310,7 +311,7 @@ tap_link_set_up(struct rte_eth_dev *dev)
struct pmd_internals *pmd = dev->data->dev_private;
dev->data->dev_link.link_status = ETH_LINK_UP;
- return tap_link_set_flags(pmd, IFF_UP | IFF_NOARP, 1);
+ return tap_netdev_set_flags(pmd->name, IFF_UP | IFF_NOARP, 1);
}
static int
@@ -482,9 +483,11 @@ tap_promisc_enable(struct rte_eth_dev *dev)
struct pmd_internals *pmd = dev->data->dev_private;
dev->data->promiscuous = 1;
- tap_link_set_flags(pmd, IFF_PROMISC, 1);
- if (pmd->remote_if_index)
+ tap_netdev_set_flags(pmd->name, IFF_PROMISC, 1);
+ if (pmd->remote_if_index) {
tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+ tap_netdev_set_flags(pmd->remote_iface, IFF_PROMISC, 1);
+ }
}
static void
@@ -493,9 +496,11 @@ tap_promisc_disable(struct rte_eth_dev *dev)
struct pmd_internals *pmd = dev->data->dev_private;
dev->data->promiscuous = 0;
- tap_link_set_flags(pmd, IFF_PROMISC, 0);
- if (pmd->remote_if_index)
+ tap_netdev_set_flags(pmd->name, IFF_PROMISC, 0);
+ if (pmd->remote_if_index) {
tap_flow_implicit_destroy(dev, TAP_REMOTE_PROMISC);
+ tap_netdev_set_flags(pmd->remote_iface, IFF_PROMISC, 0);
+ }
}
static void
@@ -504,9 +509,11 @@ tap_allmulti_enable(struct rte_eth_dev *dev)
struct pmd_internals *pmd = dev->data->dev_private;
dev->data->all_multicast = 1;
- tap_link_set_flags(pmd, IFF_ALLMULTI, 1);
- if (pmd->remote_if_index)
+ tap_netdev_set_flags(pmd->name, IFF_ALLMULTI, 1);
+ if (pmd->remote_if_index) {
tap_flow_implicit_create(pmd, TAP_REMOTE_ALLMULTI);
+ tap_netdev_set_flags(pmd->remote_iface, IFF_ALLMULTI, 1);
+ }
}
static void
@@ -515,9 +522,11 @@ tap_allmulti_disable(struct rte_eth_dev *dev)
struct pmd_internals *pmd = dev->data->dev_private;
dev->data->all_multicast = 0;
- tap_link_set_flags(pmd, IFF_ALLMULTI, 0);
- if (pmd->remote_if_index)
+ tap_netdev_set_flags(pmd->name, IFF_ALLMULTI, 0);
+ if (pmd->remote_if_index) {
tap_flow_implicit_destroy(dev, TAP_REMOTE_ALLMULTI);
+ tap_netdev_set_flags(pmd->remote_iface, IFF_ALLMULTI, 0);
+ }
}
static void
@@ -962,6 +971,8 @@ eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface)
*/
pmd->nlsk_fd = nl_init();
if (strlen(remote_iface)) {
+ snprintf(pmd->remote_iface, RTE_ETH_NAME_MAX_LEN,
+ "%s", remote_iface);
pmd->remote_if_index = if_nametoindex(remote_iface);
if (!pmd->remote_if_index)
RTE_LOG(ERR, PMD, "Could not find %s ifindex: "
diff --git a/drivers/net/tap/tap.h b/drivers/net/tap/tap.h
index 4c4de939f1cc..9811d0b0f085 100644
--- a/drivers/net/tap/tap.h
+++ b/drivers/net/tap/tap.h
@@ -63,9 +63,11 @@ struct tx_queue {
};
struct pmd_internals {
+ char remote_iface[RTE_ETH_NAME_MAX_LEN]; /* Remote netdevice name */
char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap device name */
uint16_t nb_queues; /* Number of queues supported */
struct ether_addr eth_addr; /* Mac address of the device port */
+ int remote_if_index; /* remote netdevice IF_INDEX */
int if_index; /* IF_INDEX for the port */
int nlsk_fd; /* Netlink socket fd */
int flower_support; /* 1 if kernel supports, else 0 */
--
2.8.0.rc0
next prev parent reply other threads:[~2017-03-08 10:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 12:27 [dpdk-dev] [PATCH 0/4] net/tap: remote netdevice traffic capture Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 1/4] net/tap: add " Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 2/4] net/tap: reflect tap flags on the remote Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 3/4] net/tap: use the remote MAC address if available Pascal Mazon
2017-03-03 12:27 ` [dpdk-dev] [PATCH 4/4] net/tap: set MTU on the remote Pascal Mazon
2017-03-03 15:54 ` [dpdk-dev] [PATCH 0/4] net/tap: remote netdevice traffic capture Wiles, Keith
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 0/4] " Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 1/4] net/tap: add " Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 2/4] net/tap: reflect tap flags on the remote Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 3/4] net/tap: use the remote MAC address if available Pascal Mazon
2017-03-07 16:38 ` [dpdk-dev] [PATCH v2 4/4] net/tap: set MTU on the remote Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 0/4] net/tap: remote netdevice traffic capture Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 1/4] net/tap: add " Pascal Mazon
2017-03-08 10:06 ` Pascal Mazon [this message]
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 3/4] net/tap: use the remote MAC address if available Pascal Mazon
2017-03-08 10:06 ` [dpdk-dev] [PATCH v3 4/4] net/tap: set MTU on the remote Pascal Mazon
2017-03-14 8:34 ` [dpdk-dev] [PATCH v4] net/tap: remote netdevice traffic capture Pascal Mazon
2017-03-14 8:34 ` [dpdk-dev] [PATCH v4] net/tap: add " Pascal Mazon
2017-03-14 14:00 ` Wiles, Keith
2017-03-15 15:03 ` [dpdk-dev] [PATCH v5] net/tap: " Pascal Mazon
2017-03-15 15:03 ` [dpdk-dev] [PATCH v5] net/tap: add " Pascal Mazon
2017-03-23 8:42 ` [dpdk-dev] [PATCH v6 0/1] net/tap: " Pascal Mazon
2017-03-23 8:42 ` [dpdk-dev] [PATCH v6 1/1] net/tap: add " Pascal Mazon
2017-03-24 15:48 ` 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=dd0dfeac610fa0e2c912be73f94dd28c97561dbc.1488967463.git.pascal.mazon@6wind.com \
--to=pascal.mazon@6wind.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@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).