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 9A27BA04FF; Tue, 24 May 2022 10:43:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8981242B80; Tue, 24 May 2022 10:43:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4149B42B7D for ; Tue, 24 May 2022 10:43:17 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24NNBIlj022495 for ; Tue, 24 May 2022 01:43:16 -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=FAW0Iskrg5Y18TrT1Z0/B1wbRse4pXrdUvY7kD2+z4ufCnAXgwFUNcAi3dN5ZvRrZ1v6 hkZlTDpcFQskWn2aHB52AzlRwa5Je8LrMZCH0wLAo2/3kt0Lz75/A85CnHIthAANqBS9 LUyth74BaNk0Si0lT5jmYGK/cFT3U8ejdOTesmVnxS5wmZY5Lhqw+66eOS34hcFsU34a b/MtjPVu0lj7PUa7Ee7qHHMrmoj1P64RkI8plQ+V2M0qpwAugg2LXPKNLZIC//4k+0/o CjEVW/Ho1srVuvzC8XqHifu2NCV4rgEDyWBYMTL/69MX7COFWX1hpZEUFEaHwwt/2qxj Iw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3g8kqjhrvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 24 May 2022 01:43:15 -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; Tue, 24 May 2022 01:43:13 -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; Tue, 24 May 2022 01:43:14 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id B2F753F709F; Tue, 24 May 2022 01:43:12 -0700 (PDT) From: Harman Kalra To: , Harman Kalra Subject: [PATCH v3 09/11] net/octeontx: support allmulticast Date: Tue, 24 May 2022 14:12:33 +0530 Message-ID: <20220524084235.17796-9-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220524084235.17796-1-hkalra@marvell.com> References: <20220517173941.189330-2-hkalra@marvell.com> <20220524084235.17796-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: 9zvkmT_cDYrsoPJlL5GfINJqi5Sy4y2_ X-Proofpoint-GUID: 9zvkmT_cDYrsoPJlL5GfINJqi5Sy4y2_ 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-24_06,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