Using INET socket, promisc and allmulti modes are set/unset
In FreeBSD, allmulti mode cannot be toggled from userspace
thus it can only be unset in DPDK but not at device level.
Signed-off-by: Srikanth Kaka <srikanth.k@oneconvergence.com>
Signed-off-by: Vag Singh <vag.singh@oneconvergence.com>
Signed-off-by: Anand Thulasiram <avelu@juniper.net>
---
drivers/net/mlx5/freebsd/mlx5_os.c | 52 ++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
@@ -2480,6 +2480,58 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
return ret;
}
+/**
+ * Set device promiscuous mode
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param enable
+ * 0 - promiscuous is disabled, otherwise - enabled
+ *
+ * @return
+ * 0 on success, a negative error value otherwise
+ */
+int
+mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ char ifname[IF_NAMESIZE];
+ int ret;
+
+ ret = mlx5_get_ifname_sysfs(priv->sh->ibdev_path, ifname);
+ if (!ret)
+ ret = mlx5_inet_promisc(priv->nl_socket_route,
+ ifname, enable,
+ dev->data->port_id);
+ return ret;
+}
+
+/**
+ * Set device allmulti mode
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param enable
+ * 0 - all multicase is disabled, otherwise - enabled
+ *
+ * @return
+ * 0 on success, a negative error value otherwise
+ */
+int
+mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ char ifname[IF_NAMESIZE];
+ int ret;
+
+ RTE_SET_USED(enable);
+ ret = mlx5_get_ifname_sysfs(priv->sh->ibdev_path, ifname);
+ if (!ret)
+ ret = mlx5_inet_check_allmulti_flag(priv->nl_socket_route,
+ ifname, dev->data->port_id);
+ return ret;
+}
+
/**
* Flush device MAC addresses
*