DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Boule <ivan.boule@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/5] ethdev: add multicast address filtering
Date: Thu, 28 May 2015 17:05:19 +0200	[thread overview]
Message-ID: <1432825523-19006-2-git-send-email-ivan.boule@6wind.com> (raw)
In-Reply-To: <1432825523-19006-1-git-send-email-ivan.boule@6wind.com>

With the current PMD API, the receipt of multicast packets on a given
port can only be enabled by invoking the "rte_eth_allmulticast_enable"
function.
This method may not work on Virtual Functions in SR-IOV architectures
when the host PF driver does not allow such operation on VFs.
In such cases, joined multicast addresses must be individually added
in the set of multicast addresses that are filtered by the [VF] port.

For this purpose, a new function "set_mc_addr_list" is introduced
into the set of functions that are exported by a Poll Mode Driver.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
---
 lib/librte_ether/rte_ethdev.c |   17 +++++++++++++++++
 lib/librte_ether/rte_ethdev.h |   26 ++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 024fe8b..f5784de 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3628,3 +3628,20 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
 	/* Callback wasn't found. */
 	return -EINVAL;
 }
+
+int
+rte_eth_dev_set_mc_addr_list(uint8_t port_id,
+			     struct ether_addr *mc_addr_set,
+			     uint32_t nb_mc_addr)
+{
+	struct rte_eth_dev *dev;
+
+	if (port_id >= nb_ports) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return -ENODEV;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	return dev->dev_ops->set_mc_addr_list(dev, mc_addr_set, nb_mc_addr);
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 16dbe00..04c192d 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1228,6 +1228,10 @@ typedef int (*eth_udp_tunnel_del_t)(struct rte_eth_dev *dev,
 				    struct rte_eth_udp_tunnel *tunnel_udp);
 /**< @internal Delete tunneling UDP info */
 
+typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
+				      struct ether_addr *mc_addr_set,
+				      uint32_t nb_mc_addr);
+/**< @internal set the list of multicast addresses on an Ethernet device */
 
 #ifdef RTE_NIC_BYPASS
 
@@ -1386,6 +1390,7 @@ struct eth_dev_ops {
 	/** Get current RSS hash configuration. */
 	rss_hash_conf_get_t rss_hash_conf_get;
 	eth_filter_ctrl_t              filter_ctrl;          /**< common filter control*/
+	eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs */
 };
 
 /**
@@ -3615,4 +3620,25 @@ int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
 }
 #endif
 
+/**
+ * Set the list of multicast addresses to filter on an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param mc_addr_set
+ *   The array of multicast addresses to set. Equal to NULL when the function
+ *   is invoked to flush the set of filtered addresses.
+ * @param nb_mc_addr
+ *   The number of multicast addresses in the *mc_addr_set* array. Equal to 0
+ *   when the function is invoked to flush the set of filtered addresses.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-ENOTSUP) if PMD of *port_id* doesn't support multicast filtering.
+ *   - (-ENOSPC) if *port_id* has not enough multicast filtering resources.
+ */
+int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
+				 struct ether_addr *mc_addr_set,
+				 uint32_t nb_mc_addr);
+
 #endif /* _RTE_ETHDEV_H_ */
-- 
1.7.10.4

  reply	other threads:[~2015-05-28 15:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 15:05 [dpdk-dev] [PATCH 0/5] " Ivan Boule
2015-05-28 15:05 ` Ivan Boule [this message]
2015-05-28 16:22   ` [dpdk-dev] [PATCH 1/5] ethdev: add " Stephen Hemminger
2015-05-29  7:52     ` Ivan Boule
2015-05-29  8:56     ` [dpdk-dev] [PATCH v2 " Ivan Boule
2015-05-29 13:12     ` [dpdk-dev] default unicast mac address - was: " Thomas Monjalon
2015-05-29 15:18       ` Stephen Hemminger
2015-05-28 15:05 ` [dpdk-dev] [PATCH 2/5] app/testpmd: new command to add/remove multicast MAC addresses Ivan Boule
2015-05-28 15:05 ` [dpdk-dev] [PATCH 3/5] e1000: add multicast MAC address filtering Ivan Boule
2015-05-28 15:05 ` [dpdk-dev] [PATCH 4/5] ixgbe: " Ivan Boule
2015-05-28 15:05 ` [dpdk-dev] [PATCH 5/5] app/testpmd: fix reply to a multicast ICMP request Ivan Boule
2015-05-28 16:21 ` [dpdk-dev] [PATCH 0/5] multicast address filtering Stephen Hemminger
2015-05-29  9:33   ` Ivan Boule
2015-05-29 15:17     ` Stephen Hemminger
2015-06-12 13:58 ` Thomas Monjalon

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=1432825523-19006-2-git-send-email-ivan.boule@6wind.com \
    --to=ivan.boule@6wind.com \
    --cc=dev@dpdk.org \
    /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).