DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Kaka <srikanth.k@oneconvergence.com>
To: Matan Azrad <matan@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: dev@dpdk.org, Vag Singh <vag.singh@oneconvergence.com>,
	Anand Thulasiram <avelu@juniper.net>,
	Srikanth Kaka <srikanth.k@oneconvergence.com>
Subject: [dpdk-dev] [PATCH 07/19] net/mlx5: use the newly defined INET socket
Date: Mon, 27 Sep 2021 19:04:38 +0530	[thread overview]
Message-ID: <20210927133450.10653-8-srikanth.k@oneconvergence.com> (raw)
In-Reply-To: <20210927133450.10653-1-srikanth.k@oneconvergence.com>

All the FreeBSD network stack operation can use the INET socket for
set/unset MAC, enable/disable allmulti & promisc mode

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 | 74 ++++++++++++++++++++++--------
 1 file changed, 54 insertions(+), 20 deletions(-)

diff --git a/drivers/net/mlx5/freebsd/mlx5_os.c b/drivers/net/mlx5/freebsd/mlx5_os.c
index 5420a08cf9..cf394763fa 100644
--- a/drivers/net/mlx5/freebsd/mlx5_os.c
+++ b/drivers/net/mlx5/freebsd/mlx5_os.c
@@ -44,6 +44,7 @@
 #include "mlx5_flow.h"
 #include "rte_pmd_mlx5.h"
 #include "mlx5_verbs.h"
+#include "mlx5_inet.h"
 #include "mlx5_devx.h"
 
 #ifndef HAVE_IBV_MLX5_MOD_MPW
@@ -1095,7 +1096,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	priv->mtu = RTE_ETHER_MTU;
 	/* RDMA core has no listener */
 	priv->nl_socket_rdma = -1;
-	priv->nl_socket_route =	-1;
+	priv->nl_socket_route =	mlx5_inet_init();
 	priv->representor = !!switch_info->representor;
 	priv->master = !!switch_info->master;
 	priv->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
@@ -2453,8 +2454,11 @@ mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb,
 void
 mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 {
-	RTE_SET_USED(dev);
-	RTE_SET_USED(index);
+	struct mlx5_priv *priv = dev->data->dev_private;
+	const int vf = priv->config.vf;
+
+	if (vf)
+		mlx5_inet_mac_addr_remove(dev->data->port_id, index);
 }
 
 /**
@@ -2474,11 +2478,18 @@ int
 mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
 		     uint32_t index)
 {
-	RTE_SET_USED(dev);
-	RTE_SET_USED(mac);
-	RTE_SET_USED(index);
-
-	return -ENOTSUP;
+	struct mlx5_priv *priv = dev->data->dev_private;
+	const int vf = priv->config.vf;
+	int ret = 0;
+	char ifname[IF_NAMESIZE];
+
+	mlx5_get_ifname_sysfs(priv->sh->ibdev_path, ifname);
+	if (vf)
+		ret = mlx5_inet_mac_addr_set(priv->nl_socket_route,
+					     ifname, mac, index,
+					     dev->data->port_id,
+					     priv->mac_own);
+	return ret;
 }
 
 /**
@@ -2502,12 +2513,16 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
 			   struct rte_ether_addr *mac_addr,
 			   int vf_index)
 {
-	RTE_SET_USED(priv);
-	RTE_SET_USED(idx);
-	RTE_SET_USED(mac_addr);
-	RTE_SET_USED(vf_index);
+	char ifname[IF_NAMESIZE];
+	int ret;
 
-	return -ENOTSUP;
+	ret = mlx5_get_ifname_sysfs(priv->sh->ibdev_path, ifname);
+	if (!ret)
+		ret = mlx5_inet_mac_addr_set(priv->nl_socket_route, ifname,
+				mac_addr, vf_index,
+				priv->dev_data->port_id,
+				priv->mac_own);
+	return ret;
 }
 
 /**
@@ -2524,10 +2539,16 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
 int
 mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
 {
-	RTE_SET_USED(dev);
-	RTE_SET_USED(enable);
+	struct mlx5_priv *priv = dev->data->dev_private;
+	char ifname[IF_NAMESIZE];
+	int ret;
 
-	return -ENOTSUP;
+	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;
 }
 
 /**
@@ -2544,10 +2565,15 @@ mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
 int
 mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
 {
-	RTE_SET_USED(dev);
-	RTE_SET_USED(enable);
+	struct mlx5_priv *priv = dev->data->dev_private;
+	char ifname[IF_NAMESIZE];
+	int ret;
 
-	return -ENOTSUP;
+	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;
 }
 
 /**
@@ -2560,5 +2586,13 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
 void
 mlx5_os_mac_addr_flush(struct rte_eth_dev *dev)
 {
-	RTE_SET_USED(dev);
+	struct mlx5_priv *priv = dev->data->dev_private;
+	struct rte_ether_addr *lladdr = &dev->data->mac_addrs[0];
+	char ifname[IF_NAMESIZE];
+
+	if (mlx5_get_ifname_sysfs(priv->sh->ibdev_path, ifname))
+		return;
+
+	mlx5_inet_mac_addr_flush(priv->nl_socket_route, ifname,
+				 lladdr, dev->data->port_id);
 }
-- 
2.30.2


  parent reply	other threads:[~2021-09-27 14:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 13:34 [dpdk-dev] [PATCH 00/19] MLX5 FreeBSD support Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 01/19] common/mlx5: stub for FreeBSD Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 02/19] net/mlx5: " Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 03/19] common/mlx5: disabling auxiliary bus support Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 04/19] net/mlx5: " Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 05/19] net/mlx5: modified PCI probe to work on FreeBSD Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 06/19] common/mlx5: define PF_INET socket Srikanth Kaka
2021-09-27 13:34 ` Srikanth Kaka [this message]
2021-09-27 13:34 ` [dpdk-dev] [PATCH 08/19] common/mlx5: derive PCI addr in FreeBSD Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 09/19] common/mlx5: get interface name Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 10/19] net/mlx5: fix socket MAC request Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 11/19] net/mlx5: removing port representator support Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 12/19] net/mlx5: Added procedure to detect link state Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 13/19] net/mlx5: added placeholder for VLAN vmwa Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 14/19] net/mlx5: added stats support Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 15/19] net/mlx5: making flow control DPDK callback invalid Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 16/19] net/mlx5: making module DPDK callbacks invalid Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 17/19] common/mlx5: fixed missing dependency in mlx5_glue.h Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 18/19] net/mlx5: fixed compilation warnings Srikanth Kaka
2021-09-27 13:34 ` [dpdk-dev] [PATCH 19/19] mlx5: Added meson support for FreeBSD Srikanth Kaka
2021-09-29 12:20 ` [dpdk-dev] [PATCH 00/19] MLX5 FreeBSD support Thomas Monjalon
2021-09-29 15:56   ` Srikanth K
2021-09-29 16:20     ` Thomas Monjalon
2021-09-30 16:27       ` Srikanth K
2021-09-30 16:55         ` Thomas Monjalon
2021-10-01 11:35           ` Srikanth K

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=20210927133450.10653-8-srikanth.k@oneconvergence.com \
    --to=srikanth.k@oneconvergence.com \
    --cc=avelu@juniper.net \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=vag.singh@oneconvergence.com \
    --cc=viacheslavo@nvidia.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).