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 B9C7945509; Thu, 27 Jun 2024 09:41:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 340A040E96; Thu, 27 Jun 2024 09:39:53 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 1270640E1E for ; Thu, 27 Jun 2024 09:39:44 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2233.outbound.protection.outlook.com [104.47.51.233]) by mx-outbound11-228.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Jun 2024 07:39:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aKPoQogsJaZ1whIIUb674roHRN06KVU+kKZONEbPZwzH2U3dk2rWgKnqJR4gY6nABmyh6J4j8v/NoMUCOfKZ1kyMqeVOdAoUG9W8le3JgsAHqBlgZzvHTfGPclYRx//UeyAC41KoLEt49+SnhinUJ+Qvs5QVEFxWtw5CR9VQ1R42H3kGlUKSf7ClEa02DjQiT9LELwrnI8Txa/fFdhQQB6Y8mq3D+tpJpP31okBpYQSfPBIDcyqJKOTdKp0Gw4AHqvWbUaCUTRuFiLOfivvNl4RDntsLazH8th+2ZKz3n44RQzVhnRNOfbedvky1smZl9gitF/ECqw/+C/nrNl1x+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=noNOMOxq/45rdfCGU55RNSEsb8EpMUo1DpTm+RceZOU=; b=aPfLFd8l5Rxy3AAm7cJvSNyVvMY8++CTv2XIfsIzMx3l57+1qEaqWL6KirQCYNR5E8DzGHQ2E4sUgriIDlsOxwesWdnbhGYf1dgjBpVdgqVHrvEAbL3O/aINzqezEgePx2jkAkQSdjfjj2GALkTrHEoDQ1zn1bmP4U87jWS79VmpTdsST2dJrgzQbtoHYOzfXBDx/vE6WkJc4ixHsMK7ETqMLy4djfSeChtzTXUeElcfg/NiZX0ABxFnMnW8WQv6NqUcKxapqMDx6RQY5MlcpTCBABbFqIfHPL3TcPx/TFgsEvaDHLKZbBrTsobT84WtXsThTFVXjAJpzCN2NomuNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=noNOMOxq/45rdfCGU55RNSEsb8EpMUo1DpTm+RceZOU=; b=pxe7vWpVTU+Idfe87U9mwr5QUZPMOVPWZ0dYbXCHl90/IsEYUJsdTSh6rp/BPOcG/1NiF/hxSjk6Nd+OCDsyyMmvQ6VU0CcsF4kbIpt2LpzlldjJd7FV/9B80Md/EdHB+gJtY9Ieuj1zTc9d6/TfqHrT6EbSnRyDdOSPe+aiIgQ= Received: from DUZPR01CA0347.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::20) by PA4P190MB1199.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Thu, 27 Jun 2024 07:39:39 +0000 Received: from DB1PEPF000509E2.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::a5) by DUZPR01CA0347.outlook.office365.com (2603:10a6:10:4b8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.25 via Frontend Transport; Thu, 27 Jun 2024 07:39:39 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DB1PEPF000509E2.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server id 15.20.7677.15 via Frontend Transport; Thu, 27 Jun 2024 07:39:38 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com Subject: [PATCH v5 15/23] net/ntnic: add MAC and packet features Date: Thu, 27 Jun 2024 09:38:56 +0200 Message-ID: <20240627073918.2039719-15-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240627073918.2039719-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240627073918.2039719-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E2:EE_|PA4P190MB1199:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2fc41193-95c9-4e65-c6ca-08dc967c4d0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Ant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mmZCKnYzJmj+2l+V9LsFMGaIxRgu6xW76i3yGzkOBKN6Q9T9?= =?us-ascii?Q?IWVizX1ofbFhdKPT+jGEqm7fYzkC5qGHvSxn5oYuXyugnbR96DE9AO+hUhMS?= =?us-ascii?Q?9Askno2CGi7rPU3k+ixeDCgASEAJhSUgfa862C8g1bbbYFXOBuaDsWZHOwAQ?= =?us-ascii?Q?gg43rlIMYjVCeo5YvOGs572MsAP8FdGdNG63MirHsR4EZQxaOrv8XOJHmaa4?= =?us-ascii?Q?WSJiEyJg4zkRgFhCWNEgmmw0eu8tnTG2mXn6Fn+JakYB/mCdYpcQhLkVNjvm?= =?us-ascii?Q?xOLazdmipPELTLrq6nA1DknqhVNwpuZpAvKrtaPa7QLbleFRsV5pWTO0po2h?= =?us-ascii?Q?Qo+1xyAYqYHw+51nZ4nyMFF7xW4T7RRXHZZGnTt1r7lZcQ49+vsv84YEA/YY?= =?us-ascii?Q?8/YaSwp6TnYK5NSuLv1lGWLD0H/7JeTDrpkCNP1Eb1abity9dbprof7NXOh0?= =?us-ascii?Q?Y2VFgp+kRFfy63zKspXXFr2bgRdgagqRlLcCiUltnd03IK20+mt7ccZEMejQ?= =?us-ascii?Q?sgLhtI0LSWCWV+inEec/M8XrCYEdq8Aoxnk9o7hr3i4MiIQr75wErsLNpatL?= =?us-ascii?Q?0NItZl9LemKj+lQkQL+j5QED17r9yVnZ?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(82310400026)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WiDHrL4paI41jwSbF0y38+Tq1WzqUZr0FeWfrWWyzyCo/5KPd3yJaJT1NCmq1LTR23I/bRN+rWsGE95qrRjsk97vbR2uPMMEABfEHtpP6+GY6ZPhekWp0RHvMR6K0IJE/6gMkWB/TKdrj6U0XTJQfRo41Is0Lx4LhPw2uIyW1MKtgFm+LNwH6IOQ3haZ0LYaMK2a+cR00g7lLUz9rDzZL2Eq/8cNhWM6UcEnlDisjZNnL2iguq+HTg+PPj2bwwSifzqBksGSQBYoTojLoIWbe6MSem82rDCf1NFCNfQE7WwxrTFQwkVF8ug0hVwd/9pLNrLV8oJHwAJ2bJDKsO6MWKPnX+vmyZTgqLIOAl7eaQ29C0ttCgLjgl3EQfRRGkLfjgPz61jYaf8/+JVZCqaPT6SC9H1LW3UCxwJ2dCLL0x9uXCsOh+OSJ/NHtdKtk6fn/4X1gidExVX1bPrgxEHJJICXnWzmkWH2A+iQomrZp87Ef4FgqNTapJi+Bh1pVD1v81C/eeKSnbu9u/ySwkx7y8Pee0zmOR3Y0H6VDFLWEExOQFlxJdcPNSSKPgLGRJ/fq+Rs9qda0AJS6W3CP0XAt+Wn/Y1KvEd3+bfcGezqVc471MPPOy8JlBBEN77cVtBqYFgcKC8jgNji4F1Uyg7SnA== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 07:39:38.9749 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc41193-95c9-4e65-c6ca-08dc967c4d0c X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509E2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4P190MB1199 X-BESS-ID: 1719473981-303044-12646-2718-2 X-BESS-VER: 2019.1_20240620.2317 X-BESS-Apparent-Source-IP: 104.47.51.233 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZmpuZAVgZQMNE0KSXJ0Ng4yd DUzMA0xSLVIiXFxNTYxNDA2NLQNCVFqTYWAKyhG1dBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.257231 [from cloudscan21-100.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 Add basic control for MAC addresses packets and queues Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/include/ntos_drv.h | 15 +++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 39 ++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index 0014e267ec..6fdffa8357 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -26,9 +26,24 @@ struct pmd_internals { char name[20]; int n_intf_no; int if_index; + int lpbk_mode; + uint8_t ts_multiplier; + uint16_t min_tx_pkt_size; + uint16_t max_tx_pkt_size; + unsigned int nb_rx_queues; + unsigned int nb_tx_queues; uint32_t port; uint32_t port_id; + /* Offset of the VF from the PF */ + uint8_t vf_offset; + nt_meta_port_type_t type; + /* if a virtual port type - the vhid */ + int vhid; struct drv_s *p_drv; + /* Ethernet (MAC) addresses. Element number zero denotes default address. */ + struct rte_ether_addr eth_addrs[NUM_MAC_ADDRS_PER_PORT]; + /* Multicast ethernet (MAC) addresses. */ + struct rte_ether_addr mc_addrs[NUM_MULTICAST_ADDRS_PER_PORT]; struct pmd_internals *next; }; diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 364ef8df17..2d2a228bdc 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -19,6 +19,9 @@ #include "ntnic_mod_reg.h" #include "nt_util.h" +#define HW_MAX_PKT_LEN (10000) +#define MAX_MTU (HW_MAX_PKT_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN) + #define EXCEPTION_PATH_HID 0 /* Global static variables: */ @@ -108,6 +111,16 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info dev_info->if_index = internals->if_index; dev_info->driver_name = internals->name; + dev_info->max_mac_addrs = NUM_MAC_ADDRS_PER_PORT; + dev_info->max_rx_pktlen = HW_MAX_PKT_LEN; + dev_info->max_mtu = MAX_MTU; + + if (internals->p_drv) { + dev_info->max_rx_queues = internals->nb_rx_queues; + dev_info->max_tx_queues = internals->nb_tx_queues; + + dev_info->min_rx_bufsize = 64; + } return 0; } @@ -142,8 +155,8 @@ eth_dev_stop(struct rte_eth_dev *eth_dev) { struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; - NT_LOG_DBGX(DEBUG, NTNIC, "Port %u, %u\n", - internals->n_intf_no, internals->if_index); + NT_LOG_DBGX(DEBUG, NTNIC, "Port %u, %u, type %u\n", + internals->n_intf_no, internals->if_index, internals->type); eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; return 0; @@ -212,6 +225,9 @@ eth_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size { struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + if (internals->type == PORT_TYPE_VIRTUAL || internals->type == PORT_TYPE_OVERRIDE) + return 0; + fpga_info_t *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info; const int length = snprintf(fw_version, fw_size, "%03d-%04d-%02d-%02d", fpga_info->n_fpga_type_id, fpga_info->n_fpga_prod_id, @@ -384,6 +400,12 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) internals->pci_dev = pci_dev; internals->n_intf_no = n_intf_no; internals->if_index = n_intf_no; + internals->min_tx_pkt_size = 64; + internals->max_tx_pkt_size = 10000; + internals->type = PORT_TYPE_PHYSICAL; + internals->vhid = -1; + internals->nb_rx_queues = nb_rx_queues; + internals->nb_tx_queues = nb_tx_queues; /* Setup queue_ids */ @@ -399,6 +421,18 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) 0 /*port*/, nb_tx_queues); } + /* Set MAC address (but only if the MAC address is permitted) */ + if (n_intf_no < fpga_info->nthw_hw_info.vpd_info.mn_mac_addr_count) { + const uint64_t mac = + fpga_info->nthw_hw_info.vpd_info.mn_mac_addr_value + n_intf_no; + internals->eth_addrs[0].addr_bytes[0] = (mac >> 40) & 0xFFu; + internals->eth_addrs[0].addr_bytes[1] = (mac >> 32) & 0xFFu; + internals->eth_addrs[0].addr_bytes[2] = (mac >> 24) & 0xFFu; + internals->eth_addrs[0].addr_bytes[3] = (mac >> 16) & 0xFFu; + internals->eth_addrs[0].addr_bytes[4] = (mac >> 8) & 0xFFu; + internals->eth_addrs[0].addr_bytes[5] = (mac >> 0) & 0xFFu; + } + eth_dev = rte_eth_dev_allocate(name); /* TODO: name */ if (!eth_dev) { @@ -413,6 +447,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) /* connect structs */ internals->p_drv = p_drv; eth_dev->data->dev_private = internals; + eth_dev->data->mac_addrs = internals->eth_addrs; internals->port_id = eth_dev->data->port_id; -- 2.45.0