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 16EC3A00C2; Mon, 23 May 2022 18:12:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07EBB42B7F; Mon, 23 May 2022 18:11:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 8493342B73 for ; Mon, 23 May 2022 18:11:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24NAJfnG014073 for ; Mon, 23 May 2022 09:11:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=BFmHf9U5TBrv7lbZMMjsmrmbENizidcFi5jYNEj49/k=; b=RNRY+d62efgpQS6gFtCmSCtW4GfxHmJf34rjyepFeZ0jAC9St4rJWhw6l3ODoA2jljjh xnycfILcrzm9L8iT1IGKhfF36eQzYK11SHqXCigRVFDdR9eZx6w5WhEtyYLuzTDgl9x6 joFWOaOMzPfzzDtaeC1hXU5dODq9JEtf311Y1PNjcoS4NFG35MSCR+Dl8qKwB8AF0yCg mmY66GcJnc/RBPoGtPkusJ/zr0UHEw3q0ohan7lZ0Z71K0duAZMByF5x1N2iR962tQtN 6Dozja7FkmKue9JYAQV8zRxwBczaykCV1gu+VSdq/DJI3je5+E4B7hhRAGvyDWb6Rkc7 zw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g6ykkxh93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 23 May 2022 09:11:34 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 23 May 2022 09:11:32 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 23 May 2022 09:11:32 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id 368AD3F70A4; Mon, 23 May 2022 09:11:30 -0700 (PDT) From: Harman Kalra To: , Harman Kalra Subject: [PATCH v2 09/11] net/octeontx: support allmulticast Date: Mon, 23 May 2022 21:40:58 +0530 Message-ID: <20220523161100.86280-9-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220523161100.86280-1-hkalra@marvell.com> References: <20220517173941.189330-2-hkalra@marvell.com> <20220523161100.86280-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: IHdvcXJQg62KI0G-jQqCKtgQBwTGkFNk X-Proofpoint-ORIG-GUID: IHdvcXJQg62KI0G-jQqCKtgQBwTGkFNk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-23_07,2022-05-23_01,2022-02-23_01 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 Implement allmulticast operations for octeontx driver: rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable(). Signed-off-by: Harman Kalra --- drivers/net/octeontx/base/octeontx_bgx.c | 19 ++++++++++ drivers/net/octeontx/base/octeontx_bgx.h | 1 + drivers/net/octeontx/octeontx_ethdev.c | 46 ++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/drivers/net/octeontx/base/octeontx_bgx.c b/drivers/net/octeontx/base/octeontx_bgx.c index 81a8cbecaf..1eacecbccc 100644 --- a/drivers/net/octeontx/base/octeontx_bgx.c +++ b/drivers/net/octeontx/base/octeontx_bgx.c @@ -144,6 +144,25 @@ octeontx_bgx_port_status(int port, octeontx_mbox_bgx_port_status_t *stat) return res; } +int +octeontx_bgx_port_multicast_set(int port, int en) +{ + struct octeontx_mbox_hdr hdr; + uint8_t prom; + int res; + + hdr.coproc = OCTEONTX_BGX_COPROC; + hdr.msg = MBOX_BGX_PORT_SET_MCAST; + hdr.vfid = port; + prom = en ? 1 : 0; + + res = octeontx_mbox_send(&hdr, &prom, sizeof(prom), NULL, 0); + if (res < 0) + return -EACCES; + + return res; +} + int octeontx_bgx_port_xstats(int port, octeontx_mbox_bgx_port_stats_t *stats) { diff --git a/drivers/net/octeontx/base/octeontx_bgx.h b/drivers/net/octeontx/base/octeontx_bgx.h index c5662202ac..3213d04e99 100644 --- a/drivers/net/octeontx/base/octeontx_bgx.h +++ b/drivers/net/octeontx/base/octeontx_bgx.h @@ -166,6 +166,7 @@ int octeontx_bgx_port_stats_clr(int port); int octeontx_bgx_port_xstats(int port, octeontx_mbox_bgx_port_stats_t *stats); int octeontx_bgx_port_link_status(int port); int octeontx_bgx_port_promisc_set(int port, int en); +int octeontx_bgx_port_multicast_set(int port, int en); int octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr); int octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr, int index); int octeontx_bgx_port_mac_del(int port, uint32_t index); diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index c15014bdde..3aca53fb98 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -847,6 +847,50 @@ octeontx_dev_link_update(struct rte_eth_dev *dev, return rte_eth_linkstatus_set(dev, &link); } +static int +octeontx_port_mcast_set(struct octeontx_nic *nic, int en) +{ + struct rte_eth_dev *dev; + int res; + + res = 0; + PMD_INIT_FUNC_TRACE(); + dev = nic->dev; + + res = octeontx_bgx_port_multicast_set(nic->port_id, en); + if (res < 0) { + octeontx_log_err("failed to set multicast mode %d", + nic->port_id); + return res; + } + + /* Set proper flag for the mode */ + dev->data->all_multicast = (en != 0) ? 1 : 0; + + octeontx_log_dbg("port %d : multicast mode %s", + nic->port_id, en ? "set" : "unset"); + + return 0; +} + +static int +octeontx_allmulticast_enable(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + + PMD_INIT_FUNC_TRACE(); + return octeontx_port_mcast_set(nic, 1); +} + +static int +octeontx_allmulticast_disable(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + + PMD_INIT_FUNC_TRACE(); + return octeontx_port_mcast_set(nic, 0); +} + static inline int octeontx_dev_total_xstat(void) { return NUM_BGX_XSTAT; @@ -1480,6 +1524,8 @@ static const struct eth_dev_ops octeontx_dev_ops = { .xstats_get_by_id = octeontx_dev_xstats_get_by_id, .xstats_get_names = octeontx_dev_xstats_get_names, .xstats_get_names_by_id = octeontx_dev_xstats_get_names_by_id, + .allmulticast_enable = octeontx_allmulticast_enable, + .allmulticast_disable = octeontx_allmulticast_disable, }; /* Create Ethdev interface per BGX LMAC ports */ -- 2.18.0