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 5420EA034F; Fri, 8 Oct 2021 12:59:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3CD54120C; Fri, 8 Oct 2021 12:56:39 +0200 (CEST) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id 37932411E0 for ; Thu, 7 Oct 2021 20:45:58 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id c4so4521292pls.6 for ; Thu, 07 Oct 2021 11:45:58 -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=1nIZNMwNdND0ed5qfMB2dFPzSVCJAF0F0TqmuTw/TnI=; b=BMqV6xiU1BRW5M2Bkjt6IVEdjJdaSxw83cfNteI9NFa7FBRtTVyWnoQWcnrsEv/XKK QjyY5P7ur3D+s/cmmWYC69Hioi7qdMofryfkLBVxUX9ahw+Vvq+bcPZA509lWjBT3sEs YR/fEl99tmtsrCDNgb63usXpBfNVYHLfxW4ZM= 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=1nIZNMwNdND0ed5qfMB2dFPzSVCJAF0F0TqmuTw/TnI=; b=FAUG+BEgKY1CckfwM0oiM44CMOwbztObY43H9V832abwLjetVJCVATb9iDaX/82Lev uoDyT11KB3UqZiL2xEHrf3hsTXpnr3+6eyHVuAzCRRYhIMGaL6ivk26vGpPUnTWS7JJF vY1U6cqb9AfgMhPGWtuE0viCV48c/MIJ5H1NLlJiiuysT6zixm19bYkF8aabSKxTWdIV PlAYBwcmuIcQ0cJoHqRRA/a0cvAXP/J4t9FLKPmjSvBTN+64WQaWIdje14E9iY1kInwX u4r/kPjpYojCXTGLw5GB6SvPmBSYb6r4BDGmIKRR+lMeUylLMAOQxdUQrxvrMDNMTLgi ecFA== X-Gm-Message-State: AOAM531qKEsk6CldpGlgCl2LQrTRfk/iLlfFuQmAM97aUDFYF0tZC5Zy dRRw7ldvvXX5d1foYPui7kl+QA== X-Google-Smtp-Source: ABdhPJymKepCoi7NZUn8prfwqPBLkOTLNFUB7qJ4ECsSms/VV1XWwXCUeb5dXYme8mcEqlHY2WSn9A== X-Received: by 2002:a17:90b:344b:: with SMTP id lj11mr7160757pjb.15.1633632357389; Thu, 07 Oct 2021 11:45:57 -0700 (PDT) Received: from srikanth-ThinkPad-T450.domain.name ([136.185.113.102]) by smtp.gmail.com with ESMTPSA id c11sm3311586pji.38.2021.10.07.11.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 11:45:56 -0700 (PDT) From: Srikanth Kaka To: Matan Azrad , Viacheslav Ovsiienko Cc: dev@dpdk.org, Vag Singh , Anand Thulasiram , Srikanth Kaka Date: Fri, 8 Oct 2021 00:13:47 +0530 Message-Id: <20211007184350.73858-39-srikanth.k@oneconvergence.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211007184350.73858-1-srikanth.k@oneconvergence.com> References: <20211007184350.73858-1-srikanth.k@oneconvergence.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 08 Oct 2021 12:55:54 +0200 Subject: [dpdk-dev] [PATCH v2 38/41] net/mlx5: set promisc and allmulti modes 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" 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 Signed-off-by: Vag Singh Signed-off-by: Anand Thulasiram --- drivers/net/mlx5/freebsd/mlx5_os.c | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/net/mlx5/freebsd/mlx5_os.c b/drivers/net/mlx5/freebsd/mlx5_os.c index 9992cb1d6a..fef5cdaf34 100644 --- a/drivers/net/mlx5/freebsd/mlx5_os.c +++ b/drivers/net/mlx5/freebsd/mlx5_os.c @@ -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 * -- 2.30.2