From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-ft6.fr.colt.net (smtp-ft6.fr.colt.net [213.41.78.198]) by dpdk.org (Postfix) with ESMTP id A5A431288 for ; Fri, 29 May 2015 10:56:38 +0200 (CEST) Received: from smtp-ex3.fr.colt.net (smtp-ex3.fr.colt.net [213.41.78.196]) by smtp-ft6.fr.colt.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id t4T8ubf1016867 for ; Fri, 29 May 2015 10:56:37 +0200 Received: from 33.106-14-84.ripe.coltfrance.com ([84.14.106.33] helo=proxy.6wind.com) by smtp-ex3.fr.colt.net with esmtp (Exim) (envelope-from ) id 1YyG5l-0002P3-0M for ; Fri, 29 May 2015 10:56:38 +0200 Received: from 6wind.com (unknown [10.16.0.189]) by proxy.6wind.com (Postfix) with SMTP id 87BBC281D5; Fri, 29 May 2015 10:56:35 +0200 (CEST) Received: by 6wind.com (sSMTP sendmail emulation); Fri, 29 May 2015 10:56:32 +0200 From: Ivan Boule To: dev@dpdk.org Date: Fri, 29 May 2015 10:56:25 +0200 Message-Id: <1432889785-14478-1-git-send-email-ivan.boule@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20150528092256.292e566c@urahara> References: <20150528092256.292e566c@urahara> X-ACL-Warn: 1/1 recipients OK. Subject: [dpdk-dev] [PATCH v2 1/5] ethdev: add multicast address filtering X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2015 08:56:39 -0000 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 --- v2: Use the dedicated function "rte_eth_dev_is_valid_port" to check the "port_id" parameter in "rte_eth_dev_set_mc_addr_list". 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..8001b16 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 (!rte_eth_dev_is_valid_port(port_id)) { + 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