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 D146045710; Thu, 1 Aug 2024 12:55:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7645433FE; Thu, 1 Aug 2024 12:53:55 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012034.outbound.protection.outlook.com [52.101.66.34]) by mails.dpdk.org (Postfix) with ESMTP id 83E02433E2 for ; Thu, 1 Aug 2024 12:53:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JfblRZqMiKUHMWFaLsIfQYOO7hkjJu/ASzHtQxpgOeaf0DRhp01NnLvzkFX7wSAh0b+ZxPfgwaPPXfICoWlrbUre8JAjZxV5hmW0IB7YaZT8nViHPaA15Tr25U4EpTi0H343unPEqVQUlG8FLqU/7N9Z5u91sod/XqbVYKPsrYNs6MDlkbSj3IlrPINLB8WzP1OVkEhT8lGMaXMPG9FTlvNGy858HokYyk1c2WSel8tgI7AZCklRyaE3GlOkgl0KlUy5l6A/e6iieHvR/XR4P9h3vpr8bQkcLPAOIZsgWFGzz3IVOVphmdl0M2z7VoGm17i+Q7GOx2IZ2Yv1QBX01w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=9ISKY7xqUDJyRzOvBKSZe7FfnrK6IuF9QnIqKZaDtj0=; b=khK5HVckBZNly2wfELtlYfSYseMrEugn6q/yk2FCM7RbVhP0TcSGsyJJgfmf0lQNyKvXxokVSJ5BRiFa/LQdVwnTmKjm6LRvXSMg0xMAWr+TaxJa72A6VQDGUgM7k4iki0A7eshpBbJ8LrrzjTICxmD1oDhFz5bBFhpCehf09XaQU77te4d9o0MO8USC81j7nx4bLEkmXXqBTxgmnQEjYNy8fy0mDgk7nSK9tyyttcGn1Pe4czLhT9ZtZUDwNYHeij8Q0Hmx+oedKuXPjD9fTyAcXS0Ma0SUqjhFOsLYBNJP6lX/8K7hOZ3es39LVAOmRk4Z35QLvl6G2BsDfL8oOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9ISKY7xqUDJyRzOvBKSZe7FfnrK6IuF9QnIqKZaDtj0=; b=FcncI8NO43m5YIUjJS0myoD0Pzt1vh05LT24Y10bkTKjHanX+5ih/+n07i+xcfBunatHJTmUwdKnmjFrGtcRzcQjQrOvw26FR4DEX/6gowZMsk3dngw6HqztwM7hiqnlztbIr5IckY+X7p34UwUxPpwruXuCXDf2k3ELPD9zx8eqdBktckmt8OswZ45mZX2/mB5SBSyyvZj6ajM3cGJnbWdVkDcDiovVjmvq9Ro5LZfkzvPEH1bpJRt53dcfDngbXZfz3Jcz/Djvd4O28U89D/JJ4nE6ndIptQjjA2IjXtSpdMXSa3PjK0xuKo/AlQCmdxL0ZYeNuq/5v84zYO8xYg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:49 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:49 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Rohit Raj Subject: [PATCH 15/17] bus/dpaa: add ONIC port mode for the DPAA eth Date: Thu, 1 Aug 2024 16:23:11 +0530 Message-Id: <20240801105313.630280-16-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fbe4e31-6fdb-4a13-232c-08dcb2183950 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DPbeoDvBhKSCMpjIcxnjHAI2ZIMQ15O0dSku5XlCkIndVAqaDjjMubo1ORuF?= =?us-ascii?Q?+4TYiiANnWQMY6h2MGk4XIPSTWOyygj3aJi6jRYPmkj9B4z/0+6jZ71VOU55?= =?us-ascii?Q?KAzEjlT3jKrkNBGecioIzIVvBPERYj1at/6tKFczTYX+F5CwgD1Ls4qEyQfg?= =?us-ascii?Q?irpFuig2IjLto3OwebZUQNO4BMmqA7E6xZ43YuVYI00AfAVEpHdBEWTsQk+8?= =?us-ascii?Q?aYkc+2BSNxSNrpGsGpQ6WatfCxdVWiqUviBJQHsthWWYD1YWQCI7j+tR6nQP?= =?us-ascii?Q?J+1jHSrGq8BaSyeQ/sNgsDJlV3vwZ5vp0wkX9xb+fpg1iPPfgBmBAcVrgYxp?= =?us-ascii?Q?7iIg3/E/4qG4qdiwJ1fhQFbtrSk6BmvgqUN6B7nzRqC+aMiDW7UK1WYy9WaF?= =?us-ascii?Q?avpnRzAvXcle2z4Mr72Iq6MxvB8jRTMzx2zH5K/JlB6jZFcjJ8zqsqKVNy7m?= =?us-ascii?Q?akXGdVZlOdCNnI/faVnFsOsSdzlc1n1A9gxcP1pghiHp04ncO8CQVi3XWYX7?= =?us-ascii?Q?HmLQ1atRZj/3XDGAw/J1zM3QTu2hxwCCdWC6dyh5+A9M591283vnGylWn39v?= =?us-ascii?Q?+LkeJOFjdfq/Wi+MQLkWPraU//aMQjhptuTOvfVSj7BmaNaF2K6MuJwf2u2M?= =?us-ascii?Q?GfhX8vwE/Cv2vwF2GJQpLRnuLokn61Kz7Z4C7cMThiALaFKPBanKGI1QO2SD?= =?us-ascii?Q?XEVDsH4Tl+NvcxxnF4pZltjNBo3Ie8uaOXtQ6p3g+t6WsXAciUo77VGYPcIU?= =?us-ascii?Q?0TcTOZSMPde+71Illysrm3u2sElaqsgsXNWIr1zz/5fvyfpk7lB0nO65vlLy?= =?us-ascii?Q?0kFxz6B+bsA6AbPPaFu9QyS3GxWOU6Ng09VU6C2Wma7uYN8bTXwVmDhE7i0E?= =?us-ascii?Q?a2iOzSTsg35MuNIpO+2pawjDZRcr9ed2Qyb7SxjDJpELZw2nkdUpPfIVjjfN?= =?us-ascii?Q?femyLzSDLmvyeejZjDHVKwr7/qaEVNlF3DqK262EMNsu9N0NSHfOTwl4vO6W?= =?us-ascii?Q?oH53D+dnAc/09zdxbbdHdzuqqFCD6cGI7yIiMHDlC+mmLO2WDv+TRMd6Svt8?= =?us-ascii?Q?y88iG9VhRyTWqCmsP5VqcUS64yEdm0V2bTAXbIpOUrRuONhVonAa1aNE3P+d?= =?us-ascii?Q?58wQrnz/Nchk6TPsvzHRed7TZBbIQgnEQL+oTtbUENgcZRWSeCAl+hsvthc/?= =?us-ascii?Q?ril+omE78z8Jbqr/lc82t8YCBlF6Zgt0gWAb2qEAwZbemhTaXBqZbq5ckDe2?= =?us-ascii?Q?jEfjueesacURxbWp3+apyK4ZaiT8oAmmFWGf0BRzv1H+Z2iutFunYzUi9NK/?= =?us-ascii?Q?yYc7fzzYbP4N+eqQ0PMS1/Md8coFwNBeBjDtaBx3FRpFg+AMxh6BMCe2htcP?= =?us-ascii?Q?5lRlZ3xTOb2dGlBf3G/m8uULbQXabBvkELftp0KJeTJV5LDHrA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?h1ocO+uLdEBsaCg1+r7x8TlOWhWfiOHn5dOT8zKHFx4vFHv7jW/QiMAQ73PG?= =?us-ascii?Q?+Z+PX2Ctq4ge0cYJTYJOnm4tZe/OG/lUfmL2wZFqBChglDGUBVFe56l7GH7A?= =?us-ascii?Q?XctPopsAjIJwGAsGCrR3oz1Hgs7Ow5V3tOGOfv0P7bnJ/zV6Wf+pYx5Tt19l?= =?us-ascii?Q?MIS3lMRx+nv5VQ5Nm+wIF+ILA3O2cKieiit+3upC6dCRAnT4KPOE3Zz8WFS1?= =?us-ascii?Q?5P6qfbBr2N2+P+W9SDv0Dqq9ZpS3v1IOMispDhsUYLvaoyxn96mK7krdX7Ly?= =?us-ascii?Q?NgRWK8PYRHFWNpyvyZJU6iZNj/yob3o9LCjRFRPcEpKjezPPKDkItbhW7jqD?= =?us-ascii?Q?D/IRhiTRBKjmvRpDpUtw5Y+7rI0PWsfLFhZRcLL5zUhq4kihgRvEaal8EZ8t?= =?us-ascii?Q?bMtO+a+Ux5VxZ8ZSEL7Bthemk0bnZH81MVLog5IDuQlwhtqEHe6wM5QPiCHu?= =?us-ascii?Q?XR77YP+P9GgXHcYtLL1CMBIPp1bqCbYgSBi85lc+GAs6P4SPY9mYnxJQb78v?= =?us-ascii?Q?CvIGRpeMXSr3TI6i4Tx7GFO2pIcGK6wiTeRWmMbxLHmnQ6WemfEcd6B5UJab?= =?us-ascii?Q?cF5Tm6erqBx1owjSnxxoMwNqJJXG3nT4SAvpOysQg83cgfHOhK15Q6gNDdwe?= =?us-ascii?Q?f/TMvQfevDsoZjh7DL98VGb2mjtinLeKwUJo6jlNdq3bhnxHiu7JdsCw1vIw?= =?us-ascii?Q?YwKSonkO65UpVQUOYEFeznmuN3ozMJ1WQeA/M7UqovOgY6hsiBw+ofv0kPfi?= =?us-ascii?Q?buKIM1dt1PEMsb1t0SFImxYVHGjesYFUfnIGKAyCFQUoaEUicz+8FXD38HZ2?= =?us-ascii?Q?NGleoSEcF+/nvV4tcPvArKbNBLfCFc5zfcQdmuz7dlJ6KDeYcNKXR2+4b9Am?= =?us-ascii?Q?ebFIm7gkURu7sQy1j+Qzl5kwyaKDsGQ7BWlTSupaP7tM+tV3hs9qa0hPfetM?= =?us-ascii?Q?570KxYPCha3OTNJJEXlEY8cFi9P9jWAUHW5U1SmooQxkpVB3X3OcYulKndpr?= =?us-ascii?Q?e0Cm9HKWBowR+BZTeQURfMA8fSSQocXd9hx5KxfqsQ1Sf/nveuP2cqm54BPF?= =?us-ascii?Q?a7ho89TNG5CFx4vlPI4kpu3weNytFqj+txFSpajp+uSYj5rXTwYkRiWZ6kq2?= =?us-ascii?Q?qhhKaUFklWoPUZ2y6/4745sbirJAh1J2l2ADJ+ijHKphavwMl+hLwyesDm6A?= =?us-ascii?Q?U2WfAGGw2qAbFbWy2jdihk90Lq4q5piJi06JlVmvw6dXUYAeI8VLqtbXXn/x?= =?us-ascii?Q?3vsA4noVhPHKKa6pJbI9WJUcvZAIfQYyE0Uri4I6yoc2tSsl32HDEuPY2T9c?= =?us-ascii?Q?u+3/Dt6qTzkKrxwydnyD2ERCrDdVd0EVqiprhvC8SDKsOsZgcrwww3N2kT+D?= =?us-ascii?Q?ZCcZGrwwgnXPHkj1C29ADlsn0hHO5eX2ALu/+7sScEBChooZDlvyeA52vZxL?= =?us-ascii?Q?V069V4lAoWyXBHvDIbSInL50wxIuyA3RlUPqz31kzRfUZr2aAY6AITG1tVEd?= =?us-ascii?Q?xhCvITH7Xu61XSZILVf9kfrSmHg0KwKNR9fOTWviyOqskto1WlrwnBOrPWqX?= =?us-ascii?Q?EEyW3os+QT30BFacBu7gv3jKjH3pPLF0O2TSHB4VJxC36RpC+W9CslMBnGaC?= =?us-ascii?Q?ow=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fbe4e31-6fdb-4a13-232c-08dcb2183950 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:49.3258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s9oLV/soQXoI3lR171+fvrVIEBza0PEP15sZn/MII4VBaCnCFz/Mnix5ZU7YxjAAIRsPWgn+MRCEZHaTxPLSsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Rohit Raj The OH ports can also be used by two application, processing contexts to communicate to each other. This patch enables this mode for dpaa-eth OH port as ONIC port, so that application can use the dpaa-eth to communicate to each other on the same SoC. Again,this properties is driven by the system device-tree variables. Signed-off-by: Rohit Raj --- doc/guides/nics/dpaa.rst | 3 + drivers/bus/dpaa/base/fman/fman.c | 299 +++++++++++++++++++++- drivers/bus/dpaa/base/fman/fman_hw.c | 20 +- drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +- drivers/bus/dpaa/dpaa_bus.c | 10 +- drivers/bus/dpaa/include/fman.h | 15 +- drivers/net/dpaa/dpaa_ethdev.c | 114 +++++++-- drivers/net/dpaa/dpaa_flow.c | 28 +- drivers/net/dpaa/dpaa_fmc.c | 3 +- 9 files changed, 439 insertions(+), 57 deletions(-) diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index 448607e9ac..4bd95398ca 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -136,6 +136,8 @@ RTE framework and DPAA internal components/drivers. The Ethernet driver is bound to a FMAN port and implements the interfaces needed to connect the DPAA network interface to the network stack. Each FMAN Port corresponds to a DPDK network interface. +- PMD also support OH/ONIC mode, where the port works as a HW assisted + virtual port without actually connecting to a Physical MAC. Features @@ -149,6 +151,7 @@ Features - Checksum offload - Promiscuous mode - IEEE1588 PTP + - OH/ONIC virtual port support DPAA Mempool Driver ~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index f817305ab7..efe6eab4a9 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -43,7 +43,7 @@ if_destructor(struct __fman_if *__if) if (!__if) return; - if (__if->__if.mac_type == fman_offline) + if (__if->__if.mac_type == fman_offline_internal) goto cleanup; list_for_each_entry_safe(bp, tmpbp, &__if->__if.bpool_list, node) { @@ -465,7 +465,7 @@ fman_if_init(const struct device_node *dpa_node) __if->__if.is_memac = 0; if (is_offline) - __if->__if.mac_type = fman_offline; + __if->__if.mac_type = fman_offline_internal; else if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac")) __if->__if.mac_type = fman_mac_1g; else if (of_device_is_compatible(mac_node, "fsl,fman-10g-mac")) @@ -791,6 +791,292 @@ fman_if_init(const struct device_node *dpa_node) dname, __if->__if.tx_channel_id, __if->__if.fman_idx, __if->__if.mac_idx); + /* Don't add OH port to the port list since they will be used by ONIC + * ports. + */ + if (!is_offline) + list_add_tail(&__if->__if.node, &__ifs); + + return 0; +err: + if_destructor(__if); + return _errno; +} + +static int fman_if_init_onic(const struct device_node *dpa_node) +{ + struct __fman_if *__if; + struct fman_if_bpool *bpool; + const phandle *tx_pools_phandle; + const phandle *tx_channel_id, *mac_addr, *cell_idx; + const phandle *rx_phandle; + const struct device_node *pool_node; + size_t lenp; + int _errno; + const phandle *p_onic_oh_nodes = NULL; + const struct device_node *rx_oh_node = NULL; + const struct device_node *tx_oh_node = NULL; + const phandle *p_fman_rx_oh_node = NULL, *p_fman_tx_oh_node = NULL; + const struct device_node *fman_rx_oh_node = NULL; + const struct device_node *fman_tx_oh_node = NULL; + const struct device_node *fman_node; + uint32_t na = OF_DEFAULT_NA; + uint64_t rx_phandle_host[4] = {0}; + uint64_t cell_idx_host = 0; + + if (of_device_is_available(dpa_node) == false) + return 0; + + if (!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-generic")) + return 0; + + /* Allocate an object for this network interface */ + __if = rte_malloc(NULL, sizeof(*__if), RTE_CACHE_LINE_SIZE); + if (!__if) { + FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*__if)); + goto err; + } + memset(__if, 0, sizeof(*__if)); + + INIT_LIST_HEAD(&__if->__if.bpool_list); + + strlcpy(__if->node_name, dpa_node->name, IF_NAME_MAX_LEN - 1); + __if->node_name[IF_NAME_MAX_LEN - 1] = '\0'; + + strlcpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1); + __if->node_path[PATH_MAX - 1] = '\0'; + + /* Mac node is onic */ + __if->__if.is_memac = 0; + __if->__if.mac_type = fman_onic; + + /* Extract the MAC address for linux peer */ + mac_addr = of_get_property(dpa_node, "local-mac-address", &lenp); + if (!mac_addr) { + FMAN_ERR(-EINVAL, "%s: no local-mac-address\n", + dpa_node->full_name); + goto err; + } + + memcpy(&__if->__if.onic_info.peer_mac, mac_addr, ETHER_ADDR_LEN); + + /* Extract the Rx port (it's the first of the two port handles) + * and get its channel ID. + */ + p_onic_oh_nodes = of_get_property(dpa_node, "fsl,oh-ports", &lenp); + if (!p_onic_oh_nodes) { + FMAN_ERR(-EINVAL, "%s: couldn't get p_onic_oh_nodes\n", + dpa_node->full_name); + goto err; + } + + rx_oh_node = of_find_node_by_phandle(p_onic_oh_nodes[0]); + if (!rx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get rx_oh_node\n", + dpa_node->full_name); + goto err; + } + + p_fman_rx_oh_node = of_get_property(rx_oh_node, "fsl,fman-oh-port", + &lenp); + if (!p_fman_rx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get p_fman_rx_oh_node\n", + rx_oh_node->full_name); + goto err; + } + + fman_rx_oh_node = of_find_node_by_phandle(*p_fman_rx_oh_node); + if (!fman_rx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get fman_rx_oh_node\n", + rx_oh_node->full_name); + goto err; + } + + tx_channel_id = of_get_property(fman_rx_oh_node, "fsl,qman-channel-id", + &lenp); + if (!tx_channel_id) { + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id\n", + rx_oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*tx_channel_id)); + + __if->__if.tx_channel_id = of_read_number(tx_channel_id, na); + + /* Extract the FQs from which oNIC driver in Linux is dequeuing */ + rx_phandle = of_get_property(rx_oh_node, "fsl,qman-frame-queues-oh", + &lenp); + if (!rx_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-oh\n", + rx_oh_node->full_name); + goto err; + } + assert(lenp == (4 * sizeof(phandle))); + + __if->__if.onic_info.rx_start = of_read_number(&rx_phandle[2], na); + __if->__if.onic_info.rx_count = of_read_number(&rx_phandle[3], na); + + /* Extract the Rx FQIDs */ + tx_oh_node = of_find_node_by_phandle(p_onic_oh_nodes[1]); + if (!tx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get tx_oh_node\n", + dpa_node->full_name); + goto err; + } + + p_fman_tx_oh_node = of_get_property(tx_oh_node, "fsl,fman-oh-port", + &lenp); + if (!p_fman_tx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get p_fman_tx_oh_node\n", + tx_oh_node->full_name); + goto err; + } + + fman_tx_oh_node = of_find_node_by_phandle(*p_fman_tx_oh_node); + if (!fman_tx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get fman_tx_oh_node\n", + tx_oh_node->full_name); + goto err; + } + + cell_idx = of_get_property(fman_tx_oh_node, "cell-index", &lenp); + if (!cell_idx) { + FMAN_ERR(-ENXIO, "%s: no cell-index)\n", tx_oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*cell_idx)); + + cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle)); + __if->__if.mac_idx = cell_idx_host; + + fman_node = of_get_parent(fman_tx_oh_node); + cell_idx = of_get_property(fman_node, "cell-index", &lenp); + if (!cell_idx) { + FMAN_ERR(-ENXIO, "%s: no cell-index)\n", tx_oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*cell_idx)); + + cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle)); + __if->__if.fman_idx = cell_idx_host; + + rx_phandle = of_get_property(tx_oh_node, "fsl,qman-frame-queues-oh", + &lenp); + if (!rx_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-oh\n", + dpa_node->full_name); + goto err; + } + assert(lenp == (4 * sizeof(phandle))); + + rx_phandle_host[0] = of_read_number(&rx_phandle[0], na); + rx_phandle_host[1] = of_read_number(&rx_phandle[1], na); + rx_phandle_host[2] = of_read_number(&rx_phandle[2], na); + rx_phandle_host[3] = of_read_number(&rx_phandle[3], na); + + assert((rx_phandle_host[1] == 1) && (rx_phandle_host[3] == 1)); + + __if->__if.fqid_rx_err = rx_phandle_host[0]; + __if->__if.fqid_rx_def = rx_phandle_host[2]; + + /* Don't Extract the Tx FQIDs */ + __if->__if.fqid_tx_err = 0; + __if->__if.fqid_tx_confirm = 0; + + /* Obtain the buffer pool nodes used by Tx OH port */ + tx_pools_phandle = of_get_property(tx_oh_node, "fsl,bman-buffer-pools", + &lenp); + if (!tx_pools_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,bman-buffer-pools\n", + tx_oh_node->full_name); + goto err; + } + assert(lenp && !(lenp % sizeof(phandle))); + + /* For each pool, parse the corresponding node and add a pool object to + * the interface's "bpool_list". + */ + + while (lenp) { + size_t proplen; + const phandle *prop; + uint64_t bpool_host[6] = {0}; + + /* Allocate an object for the pool */ + bpool = rte_malloc(NULL, sizeof(*bpool), RTE_CACHE_LINE_SIZE); + if (!bpool) { + FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*bpool)); + goto err; + } + + /* Find the pool node */ + pool_node = of_find_node_by_phandle(*tx_pools_phandle); + if (!pool_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n", + tx_oh_node->full_name); + rte_free(bpool); + goto err; + } + + /* Extract the BPID property */ + prop = of_get_property(pool_node, "fsl,bpid", &proplen); + if (!prop) { + FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", + pool_node->full_name); + rte_free(bpool); + goto err; + } + assert(proplen == sizeof(*prop)); + + bpool->bpid = of_read_number(prop, na); + + /* Extract the cfg property (count/size/addr). "fsl,bpool-cfg" + * indicates for the Bman driver to seed the pool. + * "fsl,bpool-ethernet-cfg" is used by the network driver. The + * two are mutually exclusive, so check for either of them. + */ + + prop = of_get_property(pool_node, "fsl,bpool-cfg", &proplen); + if (!prop) + prop = of_get_property(pool_node, + "fsl,bpool-ethernet-cfg", + &proplen); + if (!prop) { + /* It's OK for there to be no bpool-cfg */ + bpool->count = bpool->size = bpool->addr = 0; + } else { + assert(proplen == (6 * sizeof(*prop))); + + bpool_host[0] = of_read_number(&prop[0], na); + bpool_host[1] = of_read_number(&prop[1], na); + bpool_host[2] = of_read_number(&prop[2], na); + bpool_host[3] = of_read_number(&prop[3], na); + bpool_host[4] = of_read_number(&prop[4], na); + bpool_host[5] = of_read_number(&prop[5], na); + + bpool->count = ((uint64_t)bpool_host[0] << 32) | + bpool_host[1]; + bpool->size = ((uint64_t)bpool_host[2] << 32) | + bpool_host[3]; + bpool->addr = ((uint64_t)bpool_host[4] << 32) | + bpool_host[5]; + } + + /* Parsing of the pool is complete, add it to the interface + * list. + */ + list_add_tail(&bpool->node, &__if->__if.bpool_list); + lenp -= sizeof(phandle); + tx_pools_phandle++; + } + + fman_if_vsp_init(__if); + + /* Parsing of the network interface is complete, add it to the list. */ + DPAA_BUS_DEBUG("Found %s, Tx Channel = %x, FMAN = %x, Port ID = %x", + dpa_node->full_name, __if->__if.tx_channel_id, + __if->__if.fman_idx, __if->__if.mac_idx); + list_add_tail(&__if->__if.node, &__ifs); return 0; err: @@ -830,6 +1116,13 @@ fman_init(void) } } + for_each_compatible_node(dpa_node, NULL, "fsl,dpa-ethernet-generic") { + /* it is a oNIC interface */ + _errno = fman_if_init_onic(dpa_node); + if (_errno) + FMAN_ERR(_errno, "if_init(%s)\n", dpa_node->full_name); + } + return 0; err: fman_finish(); @@ -847,7 +1140,7 @@ fman_finish(void) int _errno; /* No need to disable Offline port */ - if (__if->__if.mac_type == fman_offline) + if (__if->__if.mac_type == fman_offline_internal) continue; /* disable Rx and Tx */ diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index afe10de4bc..e4e0460b36 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -88,8 +88,9 @@ fman_if_add_hash_mac_addr(struct fman_if *p, uint8_t *eth) struct __fman_if *__if = container_of(p, struct __fman_if, __if); - /* Add hash mac addr not supported on Offline port */ - if (__if->__if.mac_type == fman_offline) + /* Add hash mac addr not supported on Offline port and onic port */ + if (__if->__if.mac_type == fman_offline_internal || + __if->__if.mac_type == fman_onic) return 0; eth_addr = ETH_ADDR_TO_UINT64(eth); @@ -115,9 +116,10 @@ fman_if_get_primary_mac_addr(struct fman_if *p, uint8_t *eth) u32 val = in_be32(mac_reg); int i; - /* Get mac addr not supported on Offline port */ + /* Get mac addr not supported on Offline port and onic port */ /* Return NULL mac address */ - if (__if->__if.mac_type == fman_offline) { + if (__if->__if.mac_type == fman_offline_internal || + __if->__if.mac_type == fman_onic) { for (i = 0; i < 6; i++) eth[i] = 0x0; return 0; @@ -143,8 +145,9 @@ fman_if_clear_mac_addr(struct fman_if *p, uint8_t addr_num) struct __fman_if *m = container_of(p, struct __fman_if, __if); void *reg; - /* Clear mac addr not supported on Offline port */ - if (m->__if.mac_type == fman_offline) + /* Clear mac addr not supported on Offline port and onic port */ + if (m->__if.mac_type == fman_offline_internal || + m->__if.mac_type == fman_onic) return; if (addr_num) { @@ -169,8 +172,9 @@ fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num) void *reg; u32 val; - /* Set mac addr not supported on Offline port */ - if (m->__if.mac_type == fman_offline) + /* Set mac addr not supported on Offline port and onic port */ + if (m->__if.mac_type == fman_offline_internal || + m->__if.mac_type == fman_onic) return 0; memcpy(&m->__if.mac_addr, eth, ETHER_ADDR_LEN); diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index e6a6ed1eb6..ffb37825c2 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -44,7 +44,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, - (__if->mac_type == fman_offline) ? "OFFLINE" : + (__if->mac_type == fman_offline_internal) ? "OFFLINE" : (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); @@ -57,7 +57,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - if (__if->mac_type != fman_offline) { + if (__if->mac_type != fman_offline_internal) { fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); fman_if_for_each_bpool(bpool, __if) diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 6e4ec90670..a6c89c4514 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -204,9 +204,12 @@ dpaa_create_device_list(void) /* Create device name */ memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN); - if (fman_intf->mac_type == fman_offline) + if (fman_intf->mac_type == fman_offline_internal) sprintf(dev->name, "fm%d-oh%d", (fman_intf->fman_idx + 1), fman_intf->mac_idx); + else if (fman_intf->mac_type == fman_onic) + sprintf(dev->name, "fm%d-onic%d", + (fman_intf->fman_idx + 1), fman_intf->mac_idx); else sprintf(dev->name, "fm%d-mac%d", (fman_intf->fman_idx + 1), fman_intf->mac_idx); @@ -477,6 +480,11 @@ rte_dpaa_bus_parse(const char *name, void *out) i >= 2 || j >= 16) return -EINVAL; max_name_len = sizeof("fm.-oh..") - 1; + } else if (strncmp("onic", &name[dev_delta], 4) == 0) { + if (sscanf(&name[delta], "fm%u-onic%u", &i, &j) != 2 || + i >= 2 || j >= 16) + return -EINVAL; + max_name_len = sizeof("fm.-onic..") - 1; } else { if (sscanf(&name[delta], "fm%u-mac%u", &i, &j) != 2 || i >= 2 || j >= 16) diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 377f73bf0d..01556cf2a8 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -78,7 +78,7 @@ TAILQ_HEAD(rte_fman_if_list, __fman_if); /* Represents the different flavour of network interface */ enum fman_mac_type { - fman_offline = 0, + fman_offline_internal = 0, fman_mac_1g, fman_mac_10g, fman_mac_2_5g, @@ -366,6 +366,16 @@ struct fman_port_qmi_regs { uint32_t fmqm_pndcc; /**< PortID n Dequeue Confirm Counter */ }; +struct onic_port_cfg { + char macless_name[IF_NAME_MAX_LEN]; + uint32_t rx_start; + uint32_t rx_count; + uint32_t tx_start; + uint32_t tx_count; + struct rte_ether_addr src_mac; + struct rte_ether_addr peer_mac; +}; + /* This struct exports parameters about an Fman network interface, determined * from the device-tree. */ @@ -401,6 +411,9 @@ struct fman_if { uint32_t fqid_tx_err; uint32_t fqid_tx_confirm; + /* oNIC port info */ + struct onic_port_cfg onic_info; + struct list_head bpool_list; /* The node for linking this interface into "fman_if_list" */ struct list_head node; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 130faa6b92..56607034a9 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -292,7 +292,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) max_rx_pktlen = DPAA_MAX_RX_PKT_LEN; } - if (fif->mac_type != fman_offline) + if (!fif->is_shared_mac && fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) fman_if_set_maxfrm(dev->process_private, max_rx_pktlen); if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { @@ -312,7 +313,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) } /* Disable interrupt support on offline port*/ - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) return 0; /* if the interrupts were configured on this devices*/ @@ -463,10 +465,11 @@ static int dpaa_eth_dev_start(struct rte_eth_dev *dev) else dev->tx_pkt_burst = dpaa_eth_queue_tx; - fman_if_bmi_stats_enable(fif); - fman_if_bmi_stats_reset(fif); - fman_if_enable_rx(fif); - + if (fif->mac_type != fman_onic) { + fman_if_bmi_stats_enable(fif); + fman_if_bmi_stats_reset(fif); + fman_if_enable_rx(fif); + } for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; for (i = 0; i < dev->data->nb_tx_queues; i++) @@ -531,7 +534,8 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) ret = dpaa_eth_dev_stop(dev); - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) return 0; /* Reset link to autoneg */ @@ -647,11 +651,14 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev, | RTE_ETH_LINK_SPEED_1G | RTE_ETH_LINK_SPEED_2_5G | RTE_ETH_LINK_SPEED_10G; - } else if (fif->mac_type == fman_offline) { + } else if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) { dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD | RTE_ETH_LINK_SPEED_10M | RTE_ETH_LINK_SPEED_100M_HD - | RTE_ETH_LINK_SPEED_100M; + | RTE_ETH_LINK_SPEED_100M + | RTE_ETH_LINK_SPEED_1G + | RTE_ETH_LINK_SPEED_2_5G; } else { DPAA_PMD_ERR("invalid link_speed: %s, %d", dpaa_intf->name, fif->mac_type); @@ -753,7 +760,8 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, ioctl_version = dpaa_get_ioctl_version_number(); if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && - fif->mac_type != fman_offline) { + fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) { for (count = 0; count <= MAX_REPEAT_TIME; count++) { ret = dpaa_get_link_status(__fif->node_name, link); if (ret) @@ -766,7 +774,8 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, } } else { link->link_status = dpaa_intf->valid; - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) { /*Max supported rate for O/H port is 3.75Mpps*/ link->link_speed = RTE_ETH_SPEED_NUM_2_5G; link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX; @@ -929,8 +938,16 @@ dpaa_xstats_get_names_by_id( static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Enable promiscuous mode not supported on ONIC " + "port"); + return 0; + } + fman_if_promiscuous_enable(dev->process_private); return 0; @@ -938,8 +955,16 @@ static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev) static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Disable promiscuous mode not supported on ONIC " + "port"); + return 0; + } + fman_if_promiscuous_disable(dev->process_private); return 0; @@ -947,8 +972,15 @@ static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev) static int dpaa_eth_multicast_enable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Enable Multicast not supported on ONIC port"); + return 0; + } + fman_if_set_mcast_filter_table(dev->process_private); return 0; @@ -956,8 +988,15 @@ static int dpaa_eth_multicast_enable(struct rte_eth_dev *dev) static int dpaa_eth_multicast_disable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Disable Multicast not supported on ONIC port"); + return 0; + } + fman_if_reset_mcast_filter_table(dev->process_private); return 0; @@ -1091,7 +1130,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); /* For shared interface, it's done in kernel, skip.*/ - if (!fif->is_shared_mac && fif->mac_type != fman_offline) + if (!fif->is_shared_mac && fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) dpaa_fman_if_pool_setup(dev); if (fif->num_profiles) { @@ -1122,8 +1162,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } dpaa_intf->valid = 1; - DPAA_PMD_DEBUG("if:%s sg_on = %d, max_frm =%d", dpaa_intf->name, - fman_if_get_sg_enable(fif), max_rx_pktlen); + if (fif->mac_type != fman_onic) + DPAA_PMD_DEBUG("if:%s sg_on = %d, max_frm =%d", dpaa_intf->name, + fman_if_get_sg_enable(fif), max_rx_pktlen); /* checking if push mode only, no error check for now */ if (!rxq->is_static && dpaa_push_mode_max_queue > dpaa_push_queue_idx) { @@ -1238,7 +1279,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } /* Enable main queue to receive error packets also by default */ - if (fif->mac_type != fman_offline) + if (fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) fman_if_set_err_fqid(fif, rxq->fqid); return 0; @@ -1390,7 +1432,8 @@ static int dpaa_link_down(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && - fif->mac_type != fman_offline) + fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_DOWN); else return dpaa_eth_dev_stop(dev); @@ -1407,7 +1450,8 @@ static int dpaa_link_up(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && - fif->mac_type != fman_offline) + fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_UP); else dpaa_eth_dev_start(dev); @@ -1506,11 +1550,16 @@ dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal) { DPAA_PMD_DEBUG("Add MAC Address not supported on O/H port"); return 0; } + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Add MAC Address not supported on ONIC port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, index); @@ -1527,11 +1576,16 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal) { DPAA_PMD_DEBUG("Remove MAC Address not supported on O/H port"); return; } + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Remove MAC Address not supported on ONIC port"); + return; + } + fman_if_clear_mac_addr(dev->process_private, index); } @@ -1544,11 +1598,16 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal) { DPAA_PMD_DEBUG("Set MAC Address not supported on O/H port"); return 0; } + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Set MAC Address not supported on ONIC port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, 0); if (ret) DPAA_PMD_ERR("Setting the MAC ADDR failed %d", ret); @@ -1901,7 +1960,8 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, /* Set B0V bit in contextA to set ASPID to 0 */ opts.fqd.context_a.hi |= DPAA_FQD_CTX_A_B0_FIELD_VALID; - if (fman_intf->mac_type == fman_offline) { + if (fman_intf->mac_type == fman_offline_internal || + fman_intf->mac_type == fman_onic) { opts.fqd.context_a.lo |= DPAA_FQD_CTX_A2_VSPE_BIT; opts.fqd.context_b = fm_default_vsp_id(fman_intf) << DPAA_FQD_CTX_B_SHIFT_BITS; @@ -2112,6 +2172,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) goto free_rx; } if (!num_rx_fqs) { + if (fman_intf->mac_type == fman_offline_internal || + fman_intf->mac_type == fman_onic) { + ret = -ENODEV; + goto free_rx; + } DPAA_PMD_WARN("%s is not configured by FMC.", dpaa_intf->name); } @@ -2279,7 +2344,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_DEBUG("All frame queues created"); /* Get the initial configuration for flow control */ - if (fman_intf->mac_type != fman_offline) + if (fman_intf->mac_type != fman_offline_internal && + fman_intf->mac_type != fman_onic) dpaa_fc_set_default(dpaa_intf, fman_intf); /* reset bpool list, initialize bpool dynamically */ @@ -2311,7 +2377,9 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_INFO("net: dpaa: %s: " RTE_ETHER_ADDR_PRT_FMT, dpaa_device->name, RTE_ETHER_ADDR_BYTES(&fman_intf->mac_addr)); - if (!fman_intf->is_shared_mac && fman_intf->mac_type != fman_offline) { + if (!fman_intf->is_shared_mac && + fman_intf->mac_type != fman_offline_internal && + fman_intf->mac_type != fman_onic) { /* Configure error packet handling */ fman_if_receive_rx_errors(fman_intf, FM_FD_RX_STATUS_ERR_MASK); diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index b43c3b1b86..810b187405 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -646,11 +646,15 @@ static inline int set_pcd_netenv_scheme(struct dpaa_if *dpaa_intf, static inline int get_rx_port_type(struct fman_if *fif) { + /* For onic ports, configure the VSP as offline ports so that + * kernel can configure correct port. + */ + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) + return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; /* For 1G fm-mac9 and fm-mac10 ports, configure the VSP as 10G * ports so that kernel can configure correct port. */ - if (fif->mac_type == fman_offline) - return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; else if (fif->mac_type == fman_mac_1g && fif->mac_idx >= DPAA_10G_MAC_START_IDX) return e_FM_PORT_TYPE_RX_10G; @@ -667,7 +671,8 @@ static inline int get_rx_port_type(struct fman_if *fif) static inline int get_tx_port_type(struct fman_if *fif) { - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; else if (fif->mac_type == fman_mac_1g) return e_FM_PORT_TYPE_TX; @@ -976,25 +981,12 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf, memset(&vsp_params, 0, sizeof(vsp_params)); vsp_params.h_fm = fman_handle; vsp_params.relative_profile_id = vsp_id; - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) vsp_params.port_params.port_id = fif->mac_idx; else vsp_params.port_params.port_id = idx; - if (fif->mac_type == fman_mac_1g) { - vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX; - } else if (fif->mac_type == fman_mac_2_5g) { - vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_2_5G; - } else if (fif->mac_type == fman_mac_10g) { - vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_10G; - } else if (fif->mac_type == fman_offline) { - vsp_params.port_params.port_type = - e_FM_PORT_TYPE_OH_OFFLINE_PARSING; - } else { - DPAA_PMD_ERR("Mac type %d error", fif->mac_type); - return -1; - } - vsp_params.port_params.port_type = get_rx_port_type(fif); if (vsp_params.port_params.port_type == e_FM_PORT_TYPE_DUMMY) { DPAA_PMD_ERR("Mac type %d error", fif->mac_type); diff --git a/drivers/net/dpaa/dpaa_fmc.c b/drivers/net/dpaa/dpaa_fmc.c index abcac51482..30f10fae33 100644 --- a/drivers/net/dpaa/dpaa_fmc.c +++ b/drivers/net/dpaa/dpaa_fmc.c @@ -215,7 +215,8 @@ dpaa_port_fmc_port_parse(struct fman_if *fif, if (pport->type == e_FM_PORT_TYPE_OH_OFFLINE_PARSING && pport->number == fif->mac_idx && - fif->mac_type == fman_offline) + (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic)) return current_port; if (fif->mac_type == fman_mac_1g) { -- 2.25.1