From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE09EA0C46; Mon, 27 Sep 2021 16:58:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6282041130; Mon, 27 Sep 2021 16:58:16 +0200 (CEST) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 0C7CE40E3C for ; Mon, 27 Sep 2021 15:36:24 +0200 (CEST) Received: by mail-pl1-f169.google.com with SMTP id bb10so11819462plb.2 for ; Mon, 27 Sep 2021 06:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oneconvergence.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AfuO8OJkyPI5BRSd97bK2O7FncBiiTGX7ra0sr+8YLg=; b=P6p9rGxQh7/QVsSFIoRAiq2a6vEhul2dsowpxt8ylB4reXYKUiexal20dCabWssg3l h2yzsLRIzYgWmJFD6/uubT/vCamkubFR4/kEtvL+VOeD7I8p6ewzuPoo2Z41P1FTCkE7 zlwKuh+aYkDcihLeaKhxSsHloDsc3fLebLJZA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AfuO8OJkyPI5BRSd97bK2O7FncBiiTGX7ra0sr+8YLg=; b=I09jjqZyH9ve4Op6WLVEL51lMuvBJ8jeLnZMhXMFLks5oVQSZcFnJksCMHXIbGUBGV +RXeUjXoZEipDga7iJvz3wY10eWWTaFg/yuuGULePW7n/8y4zsjN2td0FpkmrStGLPUP Wizg26pVFdkiHabVr3/FzexKLq0QKxMffCx+cKs/TMbOdme7901yajj9kT2dm+6aNTQ5 XOP4NW209NSiKSzMH7PUHFaX2woYKqJa6lNM/48pd4MtMUz9OR46ZL00ZNKCVv7KpPEV VhHKnDwiixoOvxl4zSvsj/Ec5z+I4WHP9jdzv4JOKUYDiAGI08cEEBMKzJwnEvujqzz1 yhpg== X-Gm-Message-State: AOAM532m1Nfu9xRZpIJReBW04Mnq0BFDVTaKcNX2r0VJFEBmorgUfO9c T7ffN16FeAjpjmmTjoI7WSVpZA== X-Google-Smtp-Source: ABdhPJxp2Cc1PybfDnhfohv2rkt2jIppylLz9toQDpkpmy4JzAnSkDTop6qFx4w9N30vbVUUEWAWlQ== X-Received: by 2002:a17:902:c408:b0:13d:c6ef:7cf3 with SMTP id k8-20020a170902c40800b0013dc6ef7cf3mr57592plk.86.1632749782270; Mon, 27 Sep 2021 06:36:22 -0700 (PDT) Received: from srikanth-ThinkPad-T450.domain.name ([223.178.22.200]) by smtp.gmail.com with ESMTPSA id t6sm17342274pfh.63.2021.09.27.06.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 06:36:22 -0700 (PDT) From: Srikanth Kaka To: Matan Azrad , Viacheslav Ovsiienko Cc: dev@dpdk.org, Vag Singh , Anand Thulasiram , Srikanth Kaka Date: Mon, 27 Sep 2021 19:04:38 +0530 Message-Id: <20210927133450.10653-8-srikanth.k@oneconvergence.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210927133450.10653-1-srikanth.k@oneconvergence.com> References: <20210927133450.10653-1-srikanth.k@oneconvergence.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 27 Sep 2021 16:58:07 +0200 Subject: [dpdk-dev] [PATCH 07/19] net/mlx5: use the newly defined INET socket X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Vag Singh Signed-off-by: Anand Thulasiram --- 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