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 CC08642B37; Thu, 18 May 2023 08:32:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B89C342BC9; Thu, 18 May 2023 08:32:53 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2090.outbound.protection.outlook.com [40.107.237.90]) by mails.dpdk.org (Postfix) with ESMTP id 5CABF42B71 for ; Thu, 18 May 2023 08:32:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDwWlVjD3UP/YMkWuJQCKhPbBko3iLX+hZVaM7ql69pAe12TufpsX+WVt2XFftCv8wn+BGk+73Jh1G9eNv45lA8Qk4ag+KglYYO9I32lxhlJbwY0IoEE19AkMGW+J7/FvCXJi200Ax7Rbe/0QYUwH2OpfHE00ZLY2H9Ik2FLfh6Lz6vGCU99zRN/j/KwCo2gW+YZutOWq02QKBPK2FnpUuG0bbr5Pluxb9T5Lit1G6UXLpCu3V+I1mu6LbTlxj6BejcY2rlXffzG5EhmMcXl3gTXNGjDbhGI9/epC0P8ZEiS3A68ChKnxvNxgTeou6WN7j7+abImtB3qX8R4p0kfYw== 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=fjaSn/JluvftWL1YRESb2reGfM4gQ/n6S5PxoZ9xJOU=; b=fIms9sle4/3lwD9qINQEiaTKuNe3WhMQi8XbovC5N/NG+ICwBYYDT0ySPoXnYWY9q2ixENZPgggkNzQz4mAMWHXiDmSAHejjgLjo8TrBiCoeznYKptC73OjoZuJZyfFXhNbrrUY2tCXmrpR2bEmsTg7gnoWkstFWRVqv59/retfrZyC09ln1QxQ/ArsK1AS/hdySdzG0jcSfF5waYGrwjWD32FsEphq48GR+19b24UZyW08/SAMrQpSuxUwJ24nNPeL7jUyow1fCEoa4BDCkOX2pn7sB11vzw/V00y2hNvzSs6cZOf3ImNcc977FXiXv0FHOeUtqNlEPj/tgEsu9eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fjaSn/JluvftWL1YRESb2reGfM4gQ/n6S5PxoZ9xJOU=; b=Y130KLwnRluNr4RHB0X9VilLALg95H9awfc4KgArRS8GWpKyYPYkRlTgBrSqno6bqHLkFPtzT/Bhk8/Ytf7unhVAL8EG4jk/q8u/f9yWkYgzy66A9YtnUx4zDhiLFyVwtoxDVkGXO8YX8H4K8b6wyYmwkLYrQ66d6apf/y9b19U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by BY3PR13MB5012.namprd13.prod.outlook.com (2603:10b6:a03:364::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Thu, 18 May 2023 06:32:29 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994%3]) with mapi id 15.20.6411.017; Thu, 18 May 2023 06:32:28 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Long Wu , James Hershaw Subject: [PATCH v2] net/bonding: replace master/slave to main/member Date: Thu, 18 May 2023 14:32:02 +0800 Message-Id: <20230518063202.1529123-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230517065905.1310752-1-chaoyong.he@corigine.com> References: <20230517065905.1310752-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR06CA0242.apcprd06.prod.outlook.com (2603:1096:4:ac::26) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY3PR13MB5012:EE_ X-MS-Office365-Filtering-Correlation-Id: 6539509b-d129-4902-a588-08db5769a584 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QtyD0xVWfMO52HCQ8FVLiL3qPif38nsEVSBrHQMCzwhrrOH2SgAF7nXhDRf5dgKsJgr4ywg+g39R8ARGX3BTV6ynYwpksK5W3xbVXqFrhOKmpO9SFnyqRQx/Ubdmn5S7MsIJazZaWhJmK5PvEzxX2pQweTpDCyM4N+NnIfl1ZY6PKEYdBnFd1KXzcl175n480SLaI28GLhOhayMdF+nht4TgeRa7+jQJg7uUiycjC+wEIllPNGVqGr9DCa3sWqdzGhgQK8aY9FQ74X6CQ+VCovdFISTfR1o7dYhHtk7M+JcbHCuqJ8kZgB0BcXg7QNJyQFkNP3ZH9AG413uloSZhPVMhRf+od0wSt44rVOkG+Mzf5UBYgiwSn8mdr1b/nSR+1j8vKaWM2c22B03/6XxhZ/2RDS4aEmKtTqUjdFRAeWUrx3bfu5bYUprtQJfNYpQXTbynx4Rqf6dg8R4h5HT2UB67hSqpiLt+NRkl5CW+fSLDYQURZ/p4B6psGPGfI5a+e5jJsvcOVYlr33BIXp4pEECbh2TmOqwQahfFFGuygBhmhFRLHZdTDqDeG9VofEfUlBFTFlngexyndEyRqdX4gnm8m/p1Dec22W1FIrkKRrSzqunqgJwxR70Gq40DU90Iz3FPxocMSVpF0kmu20pOztJW4GliCcxe69+7MPdNJWU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(366004)(396003)(39840400004)(376002)(136003)(346002)(451199021)(83380400001)(478600001)(6916009)(38100700002)(4326008)(38350700002)(36756003)(5660300002)(44832011)(2906002)(30864003)(8676002)(316002)(41300700001)(86362001)(8936002)(66556008)(66946007)(66476007)(54906003)(66574015)(52116002)(186003)(107886003)(1076003)(26005)(6506007)(6486002)(6666004)(2616005)(6512007)(559001)(579004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y3gwZ25mQ2dZNGczRTVOSmpRZWhwbVcrK1F5bENTWUdabTVnbVdsNVZYM1lz?= =?utf-8?B?MlY5M2RnNnlvb0dTanBtd1FqWEh5RGpEejVEaTY1TFpES3loOCs2REJSaXNR?= =?utf-8?B?cUdZbEw1STBsOXgvZmRkVUd0ZDkyL09Bby81Njl6TjlYbStIMkdQd0tYZ0ZF?= =?utf-8?B?VjlheGZCc0JYcnNFdXk5ZWYzMzNSWXh4emdhK0VUTW9Mc1RDdDJXNzNPNnEv?= =?utf-8?B?ME1jNE1wMExmc21UaWlQL2VKaFhoK0FKdnI4cEFxL1VSd2lGdnhaNjdKWVFG?= =?utf-8?B?MjRpTmVFdUxvZGJZM1RJeW91V09Yd0ZZSG5IM2lXYktTS3U3cExNYW1aa1Vk?= =?utf-8?B?UHVuMTVIdUE3dkhEYURGY3k4Z2hYMWUwOHNoMEN3TExNVGdRMjJiRmJTbTh4?= =?utf-8?B?QVd5V3VlOTdudVJQNUkrZGNzZldoUkxlVmV3dDFBWlFURSsxdDE5L2IwbDdO?= =?utf-8?B?OWk0UW4zRnBTQUptd21LeTBBcXVYNEVFK0pIUkV5ZXpIS2E0UkRWYnZmK2Js?= =?utf-8?B?L1o2bnVva2FPYUpNWGVwVmVDMklzODRQa0JWbENOVlZ3NG0xNDBXTFZnRXI3?= =?utf-8?B?SFNDdVZWUlMyRWFFcW14by82WER0V0ZVWjZ6dG4vV09NMUpvYk13RmZCNHlz?= =?utf-8?B?VllUN3ZxVnl0TitCZytFUmpVSXNKU0h2dnN2QnhYTGRIbGlaZVRjVStaZzR0?= =?utf-8?B?SGswbkw5a2s2MHJ2VnNINlF2SEZjWUdiSWJtZGxvdEVHMTltdUpkQnp1cjNO?= =?utf-8?B?V0YzY2JSQnVieGhvbTRqNVBVeVJHUXArODVEbzMwWDJWUVg4SXNLVjdSSytk?= =?utf-8?B?S2pjRjBCeDUwYk90YUNMZlVwNHlOcm9IcmZLR3plVkNSU0NsMXgwaGdEWVlF?= =?utf-8?B?NGtXa1lsKzhYVmJtZ3BrWnhDU2RXNHRLMkgzdEs0S29waUN4cDFmSVZpdDdT?= =?utf-8?B?QWlOK0s2MTFaU1ljR25WZWpkMjFkZjBUMHQ4QXRIZ2h2N212c21neDlBb0N3?= =?utf-8?B?RDZSUEVOTmtFNy9yVmE1ZVljR0ZjbUoybUxrZm9iTGRpMUdkNTBGRGZPME5v?= =?utf-8?B?RU9rcW5SNytOaHQrT2U1Z2pLU1IrZTI0U1ZZS0JsS2dxK00zNjREVjkyem5u?= =?utf-8?B?UEVkN2d5eVpFZHBFNE0zTnpmSVdpOGdnU1BpYXhEbUpSMEI4OCtJa2hlWVIy?= =?utf-8?B?U1J0WXhaU1V2S250VUxXc2R6Y3h5THp6UHZjMkZzR1JSR2VrQ1Vod2hHeU1n?= =?utf-8?B?cjNYbEJnSkxDaGM3REZQaS80NEdIQlI4V2YyZ3VoUjhFMWMxS1NRQnFoeDBl?= =?utf-8?B?SUhEcE1oYmowTHNvcExrNWkyS2lodm1WZm9YdHRzS3djM3F1VHlWb2E3Uk1I?= =?utf-8?B?cWdPbkpBUGdvRTI2L3FxVUNUcjhSTHM0bE9xZGxXdFplMFludXpBT25vV29Y?= =?utf-8?B?QXl4VisvcDNlSHJUMkJQQVJ4M2RsazJUcXAwbmVQaEw1TDBQd3JwaFpqQ0RV?= =?utf-8?B?T0lHelpDcWZKQ3VoZ1o2MUFtUkswQmpUT2FyNE1jVm5qcCtQdmoyZ3I2K1px?= =?utf-8?B?Ymd3MDhFVU5mREh5SUV4K2xNVE5PeWhDVTFsZm0vNHJaeThkTmFHRjM1YmIy?= =?utf-8?B?OHYvNnl5T1hjbjliUTRFZDJqUDFMR2d6djBMYzVEa0NzNC9Dd09vTEJaMGZ0?= =?utf-8?B?OTVpbVJ2MFBVdmNuWHgxR2NOOEtMTFJ1UjFvNCtjVGY4b0hmTVBYYm9zYlZS?= =?utf-8?B?OHNhWUpzL05VUVR1OURqMEtvblVCa3o1ZFRpMXh0VjI1S0pJNHQxK3g2bGxr?= =?utf-8?B?b3VDNCtHeW12eDRDT0lhZUx3S1pPRXl1dFBidVJGU3ZLTTE4U3Nuc0FrTll2?= =?utf-8?B?eFgyVlp2eVhOWG1BYk41WHUyVm1NRmJRcGNGeFRab3NnMFFxc1lLVWxrU2kr?= =?utf-8?B?Ym05NTRuR2U4UFpneklhRHlXOER3bnN3U3NiVVpEaUR0MUtPQU01UDh6RlNV?= =?utf-8?B?SVBUZ2kvZHluR1czWllJa0JDZlczcTh0MUxYWnpISlFYZ04rL1lscDk1bHV0?= =?utf-8?B?SmVCSklnbVFNTERhNUNRcUYvQnE2d2s1QWcwaStKaVRLWGtpR1lTZDFBYktr?= =?utf-8?B?YmpjMlBhdGlkVjhJYzc5WXFpdlVoTmxyNEhCcm9CdGI5U3M0c29BeXdTZFVC?= =?utf-8?B?R3c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6539509b-d129-4902-a588-08db5769a584 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 06:32:27.8717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0d5fWPNPChJx8SbReq4voSQn9HNLV/E3Nz9YX/X7sYbVY9DhnLKBbuK2PNLQzvhC2ObV3686UYmOeEMA3YF0apOY5FdWfBL/rKbQNjfESFI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR13MB5012 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: Long Wu This patch replaces the usage of the word 'master/slave' with more appropriate word 'main/member' in bonding PMD as well as in its docs and examples. Also the test app and testpmd were modified to use the new wording. The bonding PMD's public API was modified according to the changes in word: rte_eth_bond_8023ad_slave_info is now called rte_eth_bond_8023ad_member_info, rte_eth_bond_active_slaves_get is now called rte_eth_bond_active_members_get, rte_eth_bond_slave_add is now called rte_eth_bond_member_add, rte_eth_bond_slave_remove is now called rte_eth_bond_member_remove, rte_eth_bond_slaves_get is now called rte_eth_bond_members_get. Also the macro RTE_ETH_DEV_BONDED_SLAVE was renamed to RTE_ETH_DEV_BONDED_MEMBER. Mark the old visible API's as deprecated and remove from the ABI. Signed-off-by: Long Wu Acked-by: Niklas Söderlund Reviewed-by: James Hershaw --- app/test-pmd/testpmd.c | 112 +- app/test-pmd/testpmd.h | 8 +- app/test/test_link_bonding.c | 2792 +++++++++-------- app/test/test_link_bonding_mode4.c | 588 ++-- app/test/test_link_bonding_rssconf.c | 166 +- doc/guides/howto/lm_bond_virtio_sriov.rst | 24 +- doc/guides/nics/bnxt.rst | 4 +- doc/guides/prog_guide/img/bond-mode-1.svg | 2 +- .../link_bonding_poll_mode_drv_lib.rst | 222 +- drivers/net/bonding/bonding_testpmd.c | 178 +- drivers/net/bonding/eth_bond_8023ad_private.h | 40 +- drivers/net/bonding/eth_bond_private.h | 108 +- drivers/net/bonding/rte_eth_bond.h | 126 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 372 +-- drivers/net/bonding/rte_eth_bond_8023ad.h | 75 +- drivers/net/bonding/rte_eth_bond_alb.c | 44 +- drivers/net/bonding/rte_eth_bond_alb.h | 20 +- drivers/net/bonding/rte_eth_bond_api.c | 474 +-- drivers/net/bonding/rte_eth_bond_args.c | 32 +- drivers/net/bonding/rte_eth_bond_flow.c | 54 +- drivers/net/bonding/rte_eth_bond_pmd.c | 1384 ++++---- drivers/net/bonding/version.map | 15 +- examples/bond/main.c | 40 +- lib/ethdev/rte_ethdev.h | 9 +- 24 files changed, 3505 insertions(+), 3384 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5cb6f92523..d8fd87105a 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -588,27 +588,27 @@ eth_dev_configure_mp(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, } static int -change_bonding_slave_port_status(portid_t bond_pid, bool is_stop) +change_bonding_member_port_status(portid_t bond_pid, bool is_stop) { #ifdef RTE_NET_BOND - portid_t slave_pids[RTE_MAX_ETHPORTS]; + portid_t member_pids[RTE_MAX_ETHPORTS]; struct rte_port *port; - int num_slaves; - portid_t slave_pid; + int num_members; + portid_t member_pid; int i; - num_slaves = rte_eth_bond_slaves_get(bond_pid, slave_pids, + num_members = rte_eth_bond_members_get(bond_pid, member_pids, RTE_MAX_ETHPORTS); - if (num_slaves < 0) { - fprintf(stderr, "Failed to get slave list for port = %u\n", + if (num_members < 0) { + fprintf(stderr, "Failed to get member list for port = %u\n", bond_pid); - return num_slaves; + return num_members; } - for (i = 0; i < num_slaves; i++) { - slave_pid = slave_pids[i]; - port = &ports[slave_pid]; + for (i = 0; i < num_members; i++) { + member_pid = member_pids[i]; + port = &ports[member_pid]; port->port_status = is_stop ? RTE_PORT_STOPPED : RTE_PORT_STARTED; } @@ -632,12 +632,12 @@ eth_dev_start_mp(uint16_t port_id) struct rte_port *port = &ports[port_id]; /* - * Starting a bonded port also starts all slaves under the bonded + * Starting a bonded port also starts all members under the bonded * device. So if this port is bond device, we need to modify the - * port status of these slaves. + * port status of these members. */ if (port->bond_flag == 1) - return change_bonding_slave_port_status(port_id, false); + return change_bonding_member_port_status(port_id, false); } return 0; @@ -656,12 +656,12 @@ eth_dev_stop_mp(uint16_t port_id) struct rte_port *port = &ports[port_id]; /* - * Stopping a bonded port also stops all slaves under the bonded + * Stopping a bonded port also stops all members under the bonded * device. So if this port is bond device, we need to modify the - * port status of these slaves. + * port status of these members. */ if (port->bond_flag == 1) - return change_bonding_slave_port_status(port_id, true); + return change_bonding_member_port_status(port_id, true); } return 0; @@ -2610,7 +2610,7 @@ all_ports_started(void) port = &ports[pi]; /* Check if there is a port which is not started */ if ((port->port_status != RTE_PORT_STARTED) && - (port->slave_flag == 0)) + (port->member_flag == 0)) return 0; } @@ -2624,7 +2624,7 @@ port_is_stopped(portid_t port_id) struct rte_port *port = &ports[port_id]; if ((port->port_status != RTE_PORT_STOPPED) && - (port->slave_flag == 0)) + (port->member_flag == 0)) return 0; return 1; } @@ -2970,8 +2970,8 @@ fill_xstats_display_info(void) /* * Some capabilities (like, rx_offload_capa and tx_offload_capa) of bonding - * device in dev_info is zero when no slave is added. And its capability - * will be updated when add a new slave device. So adding a slave device need + * device in dev_info is zero when no member is added. And its capability + * will be updated when add a new member device. So adding a member device need * to update the port configurations of bonding device. */ static void @@ -3028,7 +3028,7 @@ start_port(portid_t pid) if (pid != pi && pid != (portid_t)RTE_PORT_ALL) continue; - if (port_is_bonding_slave(pi)) { + if (port_is_bonding_member(pi)) { fprintf(stderr, "Please remove port %d from bonded device.\n", pi); @@ -3350,7 +3350,7 @@ stop_port(portid_t pid) continue; } - if (port_is_bonding_slave(pi)) { + if (port_is_bonding_member(pi)) { fprintf(stderr, "Please remove port %d from bonded device.\n", pi); @@ -3439,28 +3439,28 @@ flush_port_owned_resources(portid_t pi) } static void -clear_bonding_slave_device(portid_t *slave_pids, uint16_t num_slaves) +clear_bonding_member_device(portid_t *member_pids, uint16_t num_members) { struct rte_port *port; - portid_t slave_pid; + portid_t member_pid; uint16_t i; - for (i = 0; i < num_slaves; i++) { - slave_pid = slave_pids[i]; - if (port_is_started(slave_pid) == 1) { - if (rte_eth_dev_stop(slave_pid) != 0) + for (i = 0; i < num_members; i++) { + member_pid = member_pids[i]; + if (port_is_started(member_pid) == 1) { + if (rte_eth_dev_stop(member_pid) != 0) fprintf(stderr, "rte_eth_dev_stop failed for port %u\n", - slave_pid); + member_pid); - port = &ports[slave_pid]; + port = &ports[member_pid]; port->port_status = RTE_PORT_STOPPED; } - clear_port_slave_flag(slave_pid); + clear_port_member_flag(member_pid); - /* Close slave device when testpmd quit or is killed. */ + /* Close member device when testpmd quit or is killed. */ if (cl_quit == 1 || f_quit == 1) - rte_eth_dev_close(slave_pid); + rte_eth_dev_close(member_pid); } } @@ -3469,8 +3469,8 @@ close_port(portid_t pid) { portid_t pi; struct rte_port *port; - portid_t slave_pids[RTE_MAX_ETHPORTS]; - int num_slaves = 0; + portid_t member_pids[RTE_MAX_ETHPORTS]; + int num_members = 0; if (port_id_is_invalid(pid, ENABLED_WARN)) return; @@ -3488,7 +3488,7 @@ close_port(portid_t pid) continue; } - if (port_is_bonding_slave(pi)) { + if (port_is_bonding_member(pi)) { fprintf(stderr, "Please remove port %d from bonded device.\n", pi); @@ -3505,17 +3505,17 @@ close_port(portid_t pid) flush_port_owned_resources(pi); #ifdef RTE_NET_BOND if (port->bond_flag == 1) - num_slaves = rte_eth_bond_slaves_get(pi, - slave_pids, RTE_MAX_ETHPORTS); + num_members = rte_eth_bond_members_get(pi, + member_pids, RTE_MAX_ETHPORTS); #endif rte_eth_dev_close(pi); /* - * If this port is bonded device, all slaves under the + * If this port is bonded device, all members under the * device need to be removed or closed. */ - if (port->bond_flag == 1 && num_slaves > 0) - clear_bonding_slave_device(slave_pids, - num_slaves); + if (port->bond_flag == 1 && num_members > 0) + clear_bonding_member_device(member_pids, + num_members); } free_xstats_display_info(pi); @@ -3555,7 +3555,7 @@ reset_port(portid_t pid) continue; } - if (port_is_bonding_slave(pi)) { + if (port_is_bonding_member(pi)) { fprintf(stderr, "Please remove port %d from bonded device.\n", pi); @@ -4203,38 +4203,38 @@ init_port_config(void) } } -void set_port_slave_flag(portid_t slave_pid) +void set_port_member_flag(portid_t member_pid) { struct rte_port *port; - port = &ports[slave_pid]; - port->slave_flag = 1; + port = &ports[member_pid]; + port->member_flag = 1; } -void clear_port_slave_flag(portid_t slave_pid) +void clear_port_member_flag(portid_t member_pid) { struct rte_port *port; - port = &ports[slave_pid]; - port->slave_flag = 0; + port = &ports[member_pid]; + port->member_flag = 0; } -uint8_t port_is_bonding_slave(portid_t slave_pid) +uint8_t port_is_bonding_member(portid_t member_pid) { struct rte_port *port; struct rte_eth_dev_info dev_info; int ret; - port = &ports[slave_pid]; - ret = eth_dev_info_get_print_err(slave_pid, &dev_info); + port = &ports[member_pid]; + ret = eth_dev_info_get_print_err(member_pid, &dev_info); if (ret != 0) { TESTPMD_LOG(ERR, "Failed to get device info for port id %d," - "cannot determine if the port is a bonded slave", - slave_pid); + "cannot determine if the port is a bonded member", + member_pid); return 0; } - if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1)) + if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_MEMBER) || (port->member_flag == 1)) return 1; return 0; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index bdfbfd36d3..7bc2f70323 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -321,7 +321,7 @@ struct rte_port { uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ queueid_t queue_nb; /**< nb. of queues for flow rules */ uint32_t queue_sz; /**< size of a queue for flow rules */ - uint8_t slave_flag : 1, /**< bonding slave port */ + uint8_t member_flag : 1, /**< bonding member port */ bond_flag : 1, /**< port is bond device */ fwd_mac_swap : 1, /**< swap packet MAC before forward */ update_conf : 1; /**< need to update bonding device configuration */ @@ -1082,9 +1082,9 @@ void stop_packet_forwarding(void); void dev_set_link_up(portid_t pid); void dev_set_link_down(portid_t pid); void init_port_config(void); -void set_port_slave_flag(portid_t slave_pid); -void clear_port_slave_flag(portid_t slave_pid); -uint8_t port_is_bonding_slave(portid_t slave_pid); +void set_port_member_flag(portid_t member_pid); +void clear_port_member_flag(portid_t member_pid); +uint8_t port_is_bonding_member(portid_t member_pid); int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode, enum rte_eth_nb_tcs num_tcs, diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 5c496352c2..82daf037f1 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -59,13 +59,13 @@ #define INVALID_BONDING_MODE (-1) -uint8_t slave_mac[] = {0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 }; +uint8_t member_mac[] = {0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 }; uint8_t bonded_mac[] = {0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; struct link_bonding_unittest_params { int16_t bonded_port_id; - int16_t slave_port_ids[TEST_MAX_NUMBER_OF_PORTS]; - uint16_t bonded_slave_count; + int16_t member_port_ids[TEST_MAX_NUMBER_OF_PORTS]; + uint16_t bonded_member_count; uint8_t bonding_mode; uint16_t nb_rx_q; @@ -73,7 +73,7 @@ struct link_bonding_unittest_params { struct rte_mempool *mbuf_pool; - struct rte_ether_addr *default_slave_mac; + struct rte_ether_addr *default_member_mac; struct rte_ether_addr *default_bonded_mac; /* Packet Headers */ @@ -90,8 +90,8 @@ static struct rte_udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { .bonded_port_id = -1, - .slave_port_ids = { -1 }, - .bonded_slave_count = 0, + .member_port_ids = { -1 }, + .bonded_member_count = 0, .bonding_mode = BONDING_MODE_ROUND_ROBIN, .nb_rx_q = 1, @@ -99,7 +99,7 @@ static struct link_bonding_unittest_params default_params = { .mbuf_pool = NULL, - .default_slave_mac = (struct rte_ether_addr *)slave_mac, + .default_member_mac = (struct rte_ether_addr *)member_mac, .default_bonded_mac = (struct rte_ether_addr *)bonded_mac, .pkt_eth_hdr = NULL, @@ -202,8 +202,8 @@ configure_ethdev(uint16_t port_id, uint8_t start, uint8_t en_isr) return 0; } -static int slaves_initialized; -static int mac_slaves_initialized; +static int members_initialized; +static int mac_members_initialized; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t cvar = PTHREAD_COND_INITIALIZER; @@ -213,7 +213,7 @@ static int test_setup(void) { int i, nb_mbuf_per_pool; - struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)member_mac; /* Allocate ethernet packet header with space for VLAN header */ if (test_params->pkt_eth_hdr == NULL) { @@ -235,7 +235,7 @@ test_setup(void) } /* Create / Initialize virtual eth devs */ - if (!slaves_initialized) { + if (!members_initialized) { for (i = 0; i < TEST_MAX_NUMBER_OF_PORTS; i++) { char pmd_name[RTE_ETH_NAME_MAX_LEN]; @@ -243,16 +243,16 @@ test_setup(void) snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_%d", i); - test_params->slave_port_ids[i] = virtual_ethdev_create(pmd_name, + test_params->member_port_ids[i] = virtual_ethdev_create(pmd_name, mac_addr, rte_socket_id(), 1); - TEST_ASSERT(test_params->slave_port_ids[i] >= 0, + TEST_ASSERT(test_params->member_port_ids[i] >= 0, "Failed to create virtual virtual ethdev %s", pmd_name); TEST_ASSERT_SUCCESS(configure_ethdev( - test_params->slave_port_ids[i], 1, 0), + test_params->member_port_ids[i], 1, 0), "Failed to configure virtual ethdev %s", pmd_name); } - slaves_initialized = 1; + members_initialized = 1; } return 0; @@ -261,9 +261,9 @@ test_setup(void) static int test_create_bonded_device(void) { - int current_slave_count; + int current_member_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; /* Don't try to recreate bonded device if re-running test suite*/ if (test_params->bonded_port_id == -1) { @@ -281,19 +281,19 @@ test_create_bonded_device(void) test_params->bonding_mode), "Failed to set ethdev %d to mode %d", test_params->bonded_port_id, test_params->bonding_mode); - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, 0, - "Number of slaves %d is great than expected %d.", - current_slave_count, 0); + TEST_ASSERT_EQUAL(current_member_count, 0, + "Number of members %d is great than expected %d.", + current_member_count, 0); - current_slave_count = rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS); + current_member_count = rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, 0, - "Number of active slaves %d is great than expected %d.", - current_slave_count, 0); + TEST_ASSERT_EQUAL(current_member_count, 0, + "Number of active members %d is great than expected %d.", + current_member_count, 0); return 0; } @@ -329,46 +329,46 @@ test_create_bonded_device_with_invalid_params(void) } static int -test_add_slave_to_bonded_device(void) +test_add_member_to_bonded_device(void) { - int current_slave_count; + int current_member_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params->bonded_port_id, - test_params->slave_port_ids[test_params->bonded_slave_count]), - "Failed to add slave (%d) to bonded port (%d).", - test_params->slave_port_ids[test_params->bonded_slave_count], + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(test_params->bonded_port_id, + test_params->member_port_ids[test_params->bonded_member_count]), + "Failed to add member (%d) to bonded port (%d).", + test_params->member_port_ids[test_params->bonded_member_count], test_params->bonded_port_id); - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, test_params->bonded_slave_count + 1, - "Number of slaves (%d) is greater than expected (%d).", - current_slave_count, test_params->bonded_slave_count + 1); + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, test_params->bonded_member_count + 1, + "Number of members (%d) is greater than expected (%d).", + current_member_count, test_params->bonded_member_count + 1); - current_slave_count = rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, 0, - "Number of active slaves (%d) is not as expected (%d).\n", - current_slave_count, 0); + current_member_count = rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, 0, + "Number of active members (%d) is not as expected (%d).\n", + current_member_count, 0); - test_params->bonded_slave_count++; + test_params->bonded_member_count++; return 0; } static int -test_add_slave_to_invalid_bonded_device(void) +test_add_member_to_invalid_bonded_device(void) { /* Invalid port ID */ - TEST_ASSERT_FAIL(rte_eth_bond_slave_add(test_params->bonded_port_id + 5, - test_params->slave_port_ids[test_params->bonded_slave_count]), + TEST_ASSERT_FAIL(rte_eth_bond_member_add(test_params->bonded_port_id + 5, + test_params->member_port_ids[test_params->bonded_member_count]), "Expected call to failed as invalid port specified."); /* Non bonded device */ - TEST_ASSERT_FAIL(rte_eth_bond_slave_add(test_params->slave_port_ids[0], - test_params->slave_port_ids[test_params->bonded_slave_count]), + TEST_ASSERT_FAIL(rte_eth_bond_member_add(test_params->member_port_ids[0], + test_params->member_port_ids[test_params->bonded_member_count]), "Expected call to failed as invalid port specified."); return 0; @@ -376,63 +376,63 @@ test_add_slave_to_invalid_bonded_device(void) static int -test_remove_slave_from_bonded_device(void) +test_remove_member_from_bonded_device(void) { - int current_slave_count; + int current_member_count; struct rte_ether_addr read_mac_addr, *mac_addr; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params->bonded_port_id, - test_params->slave_port_ids[test_params->bonded_slave_count-1]), - "Failed to remove slave %d from bonded port (%d).", - test_params->slave_port_ids[test_params->bonded_slave_count-1], + TEST_ASSERT_SUCCESS(rte_eth_bond_member_remove(test_params->bonded_port_id, + test_params->member_port_ids[test_params->bonded_member_count-1]), + "Failed to remove member %d from bonded port (%d).", + test_params->member_port_ids[test_params->bonded_member_count-1], test_params->bonded_port_id); - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, test_params->bonded_slave_count - 1, - "Number of slaves (%d) is great than expected (%d).\n", - current_slave_count, test_params->bonded_slave_count - 1); + TEST_ASSERT_EQUAL(current_member_count, test_params->bonded_member_count - 1, + "Number of members (%d) is great than expected (%d).\n", + current_member_count, test_params->bonded_member_count - 1); - mac_addr = (struct rte_ether_addr *)slave_mac; + mac_addr = (struct rte_ether_addr *)member_mac; mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = - test_params->bonded_slave_count-1; + test_params->bonded_member_count-1; TEST_ASSERT_SUCCESS(rte_eth_macaddr_get( - test_params->slave_port_ids[test_params->bonded_slave_count-1], + test_params->member_port_ids[test_params->bonded_member_count-1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[test_params->bonded_slave_count-1]); + test_params->member_port_ids[test_params->bonded_member_count-1]); TEST_ASSERT_SUCCESS(memcmp(mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port\n"); rte_eth_stats_reset( - test_params->slave_port_ids[test_params->bonded_slave_count-1]); + test_params->member_port_ids[test_params->bonded_member_count-1]); virtual_ethdev_simulate_link_status_interrupt(test_params->bonded_port_id, 0); - test_params->bonded_slave_count--; + test_params->bonded_member_count--; return 0; } static int -test_remove_slave_from_invalid_bonded_device(void) +test_remove_member_from_invalid_bonded_device(void) { /* Invalid port ID */ - TEST_ASSERT_FAIL(rte_eth_bond_slave_remove( + TEST_ASSERT_FAIL(rte_eth_bond_member_remove( test_params->bonded_port_id + 5, - test_params->slave_port_ids[test_params->bonded_slave_count - 1]), + test_params->member_port_ids[test_params->bonded_member_count - 1]), "Expected call to failed as invalid port specified."); /* Non bonded device */ - TEST_ASSERT_FAIL(rte_eth_bond_slave_remove( - test_params->slave_port_ids[0], - test_params->slave_port_ids[test_params->bonded_slave_count - 1]), + TEST_ASSERT_FAIL(rte_eth_bond_member_remove( + test_params->member_port_ids[0], + test_params->member_port_ids[test_params->bonded_member_count - 1]), "Expected call to failed as invalid port specified."); return 0; @@ -441,19 +441,19 @@ test_remove_slave_from_invalid_bonded_device(void) static int bonded_id = 2; static int -test_add_already_bonded_slave_to_bonded_device(void) +test_add_already_bonded_member_to_bonded_device(void) { - int port_id, current_slave_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + int port_id, current_member_count; + uint16_t members[RTE_MAX_ETHPORTS]; char pmd_name[RTE_ETH_NAME_MAX_LEN]; - test_add_slave_to_bonded_device(); + test_add_member_to_bonded_device(); - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, 1, - "Number of slaves (%d) is not that expected (%d).", - current_slave_count, 1); + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, 1, + "Number of members (%d) is not that expected (%d).", + current_member_count, 1); snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, "%s_%d", BONDED_DEV_NAME, ++bonded_id); @@ -461,93 +461,93 @@ test_add_already_bonded_slave_to_bonded_device(void) rte_socket_id()); TEST_ASSERT(port_id >= 0, "Failed to create bonded device."); - TEST_ASSERT(rte_eth_bond_slave_add(port_id, - test_params->slave_port_ids[test_params->bonded_slave_count - 1]) + TEST_ASSERT(rte_eth_bond_member_add(port_id, + test_params->member_port_ids[test_params->bonded_member_count - 1]) < 0, - "Added slave (%d) to bonded port (%d) unexpectedly.", - test_params->slave_port_ids[test_params->bonded_slave_count-1], + "Added member (%d) to bonded port (%d) unexpectedly.", + test_params->member_port_ids[test_params->bonded_member_count-1], port_id); - return test_remove_slave_from_bonded_device(); + return test_remove_member_from_bonded_device(); } static int -test_get_slaves_from_bonded_device(void) +test_get_members_from_bonded_device(void) { - int current_slave_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + int current_member_count; + uint16_t members[RTE_MAX_ETHPORTS]; - TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), - "Failed to add slave to bonded device"); + TEST_ASSERT_SUCCESS(test_add_member_to_bonded_device(), + "Failed to add member to bonded device"); /* Invalid port id */ - current_slave_count = rte_eth_bond_slaves_get(INVALID_PORT_ID, slaves, + current_member_count = rte_eth_bond_members_get(INVALID_PORT_ID, members, RTE_MAX_ETHPORTS); - TEST_ASSERT(current_slave_count < 0, + TEST_ASSERT(current_member_count < 0, "Invalid port id unexpectedly succeeded"); - current_slave_count = rte_eth_bond_active_slaves_get(INVALID_PORT_ID, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT(current_slave_count < 0, + current_member_count = rte_eth_bond_active_members_get(INVALID_PORT_ID, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT(current_member_count < 0, "Invalid port id unexpectedly succeeded"); - /* Invalid slaves pointer */ - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, + /* Invalid members pointer */ + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, NULL, RTE_MAX_ETHPORTS); - TEST_ASSERT(current_slave_count < 0, - "Invalid slave array unexpectedly succeeded"); + TEST_ASSERT(current_member_count < 0, + "Invalid member array unexpectedly succeeded"); - current_slave_count = rte_eth_bond_active_slaves_get( + current_member_count = rte_eth_bond_active_members_get( test_params->bonded_port_id, NULL, RTE_MAX_ETHPORTS); - TEST_ASSERT(current_slave_count < 0, - "Invalid slave array unexpectedly succeeded"); + TEST_ASSERT(current_member_count < 0, + "Invalid member array unexpectedly succeeded"); /* non bonded device*/ - current_slave_count = rte_eth_bond_slaves_get( - test_params->slave_port_ids[0], NULL, RTE_MAX_ETHPORTS); - TEST_ASSERT(current_slave_count < 0, + current_member_count = rte_eth_bond_members_get( + test_params->member_port_ids[0], NULL, RTE_MAX_ETHPORTS); + TEST_ASSERT(current_member_count < 0, "Invalid port id unexpectedly succeeded"); - current_slave_count = rte_eth_bond_active_slaves_get( - test_params->slave_port_ids[0], NULL, RTE_MAX_ETHPORTS); - TEST_ASSERT(current_slave_count < 0, + current_member_count = rte_eth_bond_active_members_get( + test_params->member_port_ids[0], NULL, RTE_MAX_ETHPORTS); + TEST_ASSERT(current_member_count < 0, "Invalid port id unexpectedly succeeded"); - TEST_ASSERT_SUCCESS(test_remove_slave_from_bonded_device(), - "Failed to remove slaves from bonded device"); + TEST_ASSERT_SUCCESS(test_remove_member_from_bonded_device(), + "Failed to remove members from bonded device"); return 0; } static int -test_add_remove_multiple_slaves_to_from_bonded_device(void) +test_add_remove_multiple_members_to_from_bonded_device(void) { int i; for (i = 0; i < TEST_MAX_NUMBER_OF_PORTS; i++) - TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), - "Failed to add slave to bonded device"); + TEST_ASSERT_SUCCESS(test_add_member_to_bonded_device(), + "Failed to add member to bonded device"); for (i = 0; i < TEST_MAX_NUMBER_OF_PORTS; i++) - TEST_ASSERT_SUCCESS(test_remove_slave_from_bonded_device(), - "Failed to remove slaves from bonded device"); + TEST_ASSERT_SUCCESS(test_remove_member_from_bonded_device(), + "Failed to remove members from bonded device"); return 0; } static void -enable_bonded_slaves(void) +enable_bonded_members(void) { int i; - for (i = 0; i < test_params->bonded_slave_count; i++) { - virtual_ethdev_tx_burst_fn_set_success(test_params->slave_port_ids[i], + for (i = 0; i < test_params->bonded_member_count; i++) { + virtual_ethdev_tx_burst_fn_set_success(test_params->member_port_ids[i], 1); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 1); + test_params->member_port_ids[i], 1); } } @@ -556,34 +556,36 @@ test_start_bonded_device(void) { struct rte_eth_link link_status; - int current_slave_count, current_bonding_mode, primary_port; - uint16_t slaves[RTE_MAX_ETHPORTS]; + int current_member_count, current_bonding_mode, primary_port; + uint16_t members[RTE_MAX_ETHPORTS]; int retval; - /* Add slave to bonded device*/ - TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), - "Failed to add slave to bonded device"); + /* Add member to bonded device*/ + TEST_ASSERT_SUCCESS(test_add_member_to_bonded_device(), + "Failed to add member to bonded device"); TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start bonded pmd eth device %d.", test_params->bonded_port_id); - /* Change link status of virtual pmd so it will be added to the active - * slave list of the bonded device*/ + /* + * Change link status of virtual pmd so it will be added to the active + * member list of the bonded device. + */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[test_params->bonded_slave_count-1], 1); + test_params->member_port_ids[test_params->bonded_member_count-1], 1); - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, test_params->bonded_slave_count, - "Number of slaves (%d) is not expected value (%d).", - current_slave_count, test_params->bonded_slave_count); + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, test_params->bonded_member_count, + "Number of members (%d) is not expected value (%d).", + current_member_count, test_params->bonded_member_count); - current_slave_count = rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, test_params->bonded_slave_count, - "Number of active slaves (%d) is not expected value (%d).", - current_slave_count, test_params->bonded_slave_count); + current_member_count = rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, test_params->bonded_member_count, + "Number of active members (%d) is not expected value (%d).", + current_member_count, test_params->bonded_member_count); current_bonding_mode = rte_eth_bond_mode_get(test_params->bonded_port_id); TEST_ASSERT_EQUAL(current_bonding_mode, test_params->bonding_mode, @@ -591,9 +593,9 @@ test_start_bonded_device(void) current_bonding_mode, test_params->bonding_mode); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); - TEST_ASSERT_EQUAL(primary_port, test_params->slave_port_ids[0], + TEST_ASSERT_EQUAL(primary_port, test_params->member_port_ids[0], "Primary port (%d) is not expected value (%d).", - primary_port, test_params->slave_port_ids[0]); + primary_port, test_params->member_port_ids[0]); retval = rte_eth_link_get(test_params->bonded_port_id, &link_status); TEST_ASSERT(retval >= 0, @@ -609,8 +611,8 @@ test_start_bonded_device(void) static int test_stop_bonded_device(void) { - int current_slave_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + int current_member_count; + uint16_t members[RTE_MAX_ETHPORTS]; struct rte_eth_link link_status; int retval; @@ -627,29 +629,29 @@ test_stop_bonded_device(void) "Bonded port (%d) status (%d) is not expected value (%d).", test_params->bonded_port_id, link_status.link_status, 0); - current_slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, test_params->bonded_slave_count, - "Number of slaves (%d) is not expected value (%d).", - current_slave_count, test_params->bonded_slave_count); + current_member_count = rte_eth_bond_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, test_params->bonded_member_count, + "Number of members (%d) is not expected value (%d).", + current_member_count, test_params->bonded_member_count); - current_slave_count = rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(current_slave_count, 0, - "Number of active slaves (%d) is not expected value (%d).", - current_slave_count, 0); + current_member_count = rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(current_member_count, 0, + "Number of active members (%d) is not expected value (%d).", + current_member_count, 0); return 0; } static int -remove_slaves_and_stop_bonded_device(void) +remove_members_and_stop_bonded_device(void) { - /* Clean up and remove slaves from bonded device */ + /* Clean up and remove members from bonded device */ free_virtualpmd_tx_queue(); - while (test_params->bonded_slave_count > 0) - TEST_ASSERT_SUCCESS(test_remove_slave_from_bonded_device(), - "test_remove_slave_from_bonded_device failed"); + while (test_params->bonded_member_count > 0) + TEST_ASSERT_SUCCESS(test_remove_member_from_bonded_device(), + "test_remove_member_from_bonded_device failed"); TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), "Failed to stop bonded port %u", @@ -681,10 +683,10 @@ test_set_bonding_mode(void) INVALID_PORT_ID); /* Non bonded device */ - TEST_ASSERT_FAIL(rte_eth_bond_mode_set(test_params->slave_port_ids[0], + TEST_ASSERT_FAIL(rte_eth_bond_mode_set(test_params->member_port_ids[0], bonding_modes[i]), "Expected call to failed as invalid port (%d) specified.", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(rte_eth_bond_mode_set(test_params->bonded_port_id, bonding_modes[i]), @@ -704,26 +706,26 @@ test_set_bonding_mode(void) INVALID_PORT_ID); /* Non bonded device */ - bonding_mode = rte_eth_bond_mode_get(test_params->slave_port_ids[0]); + bonding_mode = rte_eth_bond_mode_get(test_params->member_port_ids[0]); TEST_ASSERT(bonding_mode < 0, "Expected call to failed as invalid port (%d) specified.", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); } - return remove_slaves_and_stop_bonded_device(); + return remove_members_and_stop_bonded_device(); } static int -test_set_primary_slave(void) +test_set_primary_member(void) { int i, j, retval; struct rte_ether_addr read_mac_addr; struct rte_ether_addr *expected_mac_addr; - /* Add 4 slaves to bonded device */ - for (i = test_params->bonded_slave_count; i < 4; i++) - TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), - "Failed to add slave to bonded device."); + /* Add 4 members to bonded device */ + for (i = test_params->bonded_member_count; i < 4; i++) + TEST_ASSERT_SUCCESS(test_add_member_to_bonded_device(), + "Failed to add member to bonded device."); TEST_ASSERT_SUCCESS(rte_eth_bond_mode_set(test_params->bonded_port_id, BONDING_MODE_ROUND_ROBIN), @@ -732,34 +734,34 @@ test_set_primary_slave(void) /* Invalid port ID */ TEST_ASSERT_FAIL(rte_eth_bond_primary_set(INVALID_PORT_ID, - test_params->slave_port_ids[i]), + test_params->member_port_ids[i]), "Expected call to failed as invalid port specified."); /* Non bonded device */ - TEST_ASSERT_FAIL(rte_eth_bond_primary_set(test_params->slave_port_ids[i], - test_params->slave_port_ids[i]), + TEST_ASSERT_FAIL(rte_eth_bond_primary_set(test_params->member_port_ids[i], + test_params->member_port_ids[i]), "Expected call to failed as invalid port specified."); - /* Set slave as primary - * Verify slave it is now primary slave - * Verify that MAC address of bonded device is that of primary slave - * Verify that MAC address of all bonded slaves are that of primary slave + /* Set member as primary + * Verify member it is now primary member + * Verify that MAC address of bonded device is that of primary member + * Verify that MAC address of all bonded members are that of primary member */ for (i = 0; i < 4; i++) { TEST_ASSERT_SUCCESS(rte_eth_bond_primary_set(test_params->bonded_port_id, - test_params->slave_port_ids[i]), + test_params->member_port_ids[i]), "Failed to set bonded port (%d) primary port to (%d)", - test_params->bonded_port_id, test_params->slave_port_ids[i]); + test_params->bonded_port_id, test_params->member_port_ids[i]); retval = rte_eth_bond_primary_get(test_params->bonded_port_id); TEST_ASSERT(retval >= 0, "Failed to read primary port from bonded port (%d)\n", test_params->bonded_port_id); - TEST_ASSERT_EQUAL(retval, test_params->slave_port_ids[i], + TEST_ASSERT_EQUAL(retval, test_params->member_port_ids[i], "Bonded port (%d) primary port (%d) not expected value (%d)\n", test_params->bonded_port_id, retval, - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); /* stop/start bonded eth dev to apply new MAC */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), @@ -770,13 +772,14 @@ test_set_primary_slave(void) "Failed to start bonded port %d", test_params->bonded_port_id); - expected_mac_addr = (struct rte_ether_addr *)&slave_mac; + expected_mac_addr = (struct rte_ether_addr *)&member_mac; expected_mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; - /* Check primary slave MAC */ - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + /* Check primary member MAC */ + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(expected_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port\n"); @@ -789,16 +792,17 @@ test_set_primary_slave(void) sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port\n"); - /* Check other slaves MACs */ + /* Check other members MACs */ for (j = 0; j < 4; j++) { if (j != i) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[j], + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get( + test_params->member_port_ids[j], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[j]); + test_params->member_port_ids[j]); TEST_ASSERT_SUCCESS(memcmp(expected_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port mac address not set to that of primary " + "member port mac address not set to that of primary " "port"); } } @@ -809,14 +813,14 @@ test_set_primary_slave(void) TEST_ASSERT_FAIL(rte_eth_bond_primary_get(test_params->bonded_port_id + 10), "read primary port from expectedly"); - /* Test with slave port */ - TEST_ASSERT_FAIL(rte_eth_bond_primary_get(test_params->slave_port_ids[0]), + /* Test with member port */ + TEST_ASSERT_FAIL(rte_eth_bond_primary_get(test_params->member_port_ids[0]), "read primary port from expectedly\n"); - TEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(), - "Failed to stop and remove slaves from bonded device"); + TEST_ASSERT_SUCCESS(remove_members_and_stop_bonded_device(), + "Failed to stop and remove members from bonded device"); - /* No slaves */ + /* No members */ TEST_ASSERT(rte_eth_bond_primary_get(test_params->bonded_port_id) < 0, "read primary port from expectedly\n"); @@ -840,7 +844,7 @@ test_set_explicit_bonded_mac(void) /* Non bonded device */ TEST_ASSERT_FAIL(rte_eth_bond_mac_address_set( - test_params->slave_port_ids[0], mac_addr), + test_params->member_port_ids[0], mac_addr), "Expected call to failed as invalid port specified."); /* NULL MAC address */ @@ -853,10 +857,10 @@ test_set_explicit_bonded_mac(void) "Failed to set MAC address on bonded port (%d)", test_params->bonded_port_id); - /* Add 4 slaves to bonded device */ - for (i = test_params->bonded_slave_count; i < 4; i++) { - TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), - "Failed to add slave to bonded device.\n"); + /* Add 4 members to bonded device */ + for (i = test_params->bonded_member_count; i < 4; i++) { + TEST_ASSERT_SUCCESS(test_add_member_to_bonded_device(), + "Failed to add member to bonded device.\n"); } /* Check bonded MAC */ @@ -866,14 +870,15 @@ test_set_explicit_bonded_mac(void) TEST_ASSERT_SUCCESS(memcmp(mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port"); - /* Check other slaves MACs */ + /* Check other members MACs */ for (i = 0; i < 4; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port mac address not set to that of primary port"); + "member port mac address not set to that of primary port"); } /* test resetting mac address on bonded device */ @@ -883,13 +888,13 @@ test_set_explicit_bonded_mac(void) test_params->bonded_port_id); TEST_ASSERT_FAIL( - rte_eth_bond_mac_address_reset(test_params->slave_port_ids[0]), + rte_eth_bond_mac_address_reset(test_params->member_port_ids[0]), "Reset MAC address on bonded port (%d) unexpectedly", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - /* test resetting mac address on bonded device with no slaves */ - TEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(), - "Failed to remove slaves and stop bonded device"); + /* test resetting mac address on bonded device with no members */ + TEST_ASSERT_SUCCESS(remove_members_and_stop_bonded_device(), + "Failed to remove members and stop bonded device"); TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_reset(test_params->bonded_port_id), "Failed to reset MAC address on bonded port (%d)", @@ -898,25 +903,25 @@ test_set_explicit_bonded_mac(void) return 0; } -#define BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT (3) +#define BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT (3) static int test_set_bonded_port_initialization_mac_assignment(void) { - int i, slave_count; + int i, member_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; static int bonded_port_id = -1; - static int slave_port_ids[BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT]; + static int member_port_ids[BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT]; - struct rte_ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; + struct rte_ether_addr member_mac_addr, bonded_mac_addr, read_mac_addr; /* Initialize default values for MAC addresses */ - memcpy(&slave_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); - memcpy(&bonded_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); + memcpy(&member_mac_addr, member_mac, sizeof(struct rte_ether_addr)); + memcpy(&bonded_mac_addr, member_mac, sizeof(struct rte_ether_addr)); /* - * 1. a - Create / configure bonded / slave ethdevs + * 1. a - Create / configure bonded / member ethdevs */ if (bonded_port_id == -1) { bonded_port_id = rte_eth_bond_create("net_bonding_mac_ass_test", @@ -927,46 +932,46 @@ test_set_bonded_port_initialization_mac_assignment(void) "Failed to configure bonded ethdev"); } - if (!mac_slaves_initialized) { - for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) { + if (!mac_members_initialized) { + for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT; i++) { char pmd_name[RTE_ETH_NAME_MAX_LEN]; - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = i + 100; snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, - "eth_slave_%d", i); + "eth_member_%d", i); - slave_port_ids[i] = virtual_ethdev_create(pmd_name, - &slave_mac_addr, rte_socket_id(), 1); + member_port_ids[i] = virtual_ethdev_create(pmd_name, + &member_mac_addr, rte_socket_id(), 1); - TEST_ASSERT(slave_port_ids[i] >= 0, - "Failed to create slave ethdev %s", + TEST_ASSERT(member_port_ids[i] >= 0, + "Failed to create member ethdev %s", pmd_name); - TEST_ASSERT_SUCCESS(configure_ethdev(slave_port_ids[i], 1, 0), + TEST_ASSERT_SUCCESS(configure_ethdev(member_port_ids[i], 1, 0), "Failed to configure virtual ethdev %s", pmd_name); } - mac_slaves_initialized = 1; + mac_members_initialized = 1; } /* - * 2. Add slave ethdevs to bonded device + * 2. Add member ethdevs to bonded device */ - for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) { - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(bonded_port_id, - slave_port_ids[i]), - "Failed to add slave (%d) to bonded port (%d).", - slave_port_ids[i], bonded_port_id); + for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT; i++) { + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(bonded_port_id, + member_port_ids[i]), + "Failed to add member (%d) to bonded port (%d).", + member_port_ids[i], bonded_port_id); } - slave_count = rte_eth_bond_slaves_get(bonded_port_id, slaves, + member_count = rte_eth_bond_members_get(bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT, slave_count, - "Number of slaves (%d) is not as expected (%d)", - slave_count, BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT); + TEST_ASSERT_EQUAL(BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT, member_count, + "Number of members (%d) is not as expected (%d)", + member_count, BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT); /* @@ -982,16 +987,16 @@ test_set_bonded_port_initialization_mac_assignment(void) /* 4. a - Start bonded ethdev - * b - Enable slave devices - * c - Verify bonded/slaves ethdev MAC addresses + * b - Enable member devices + * c - Verify bonded/members ethdev MAC addresses */ TEST_ASSERT_SUCCESS(rte_eth_dev_start(bonded_port_id), "Failed to start bonded pmd eth device %d.", bonded_port_id); - for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) { + for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT; i++) { virtual_ethdev_simulate_link_status_interrupt( - slave_port_ids[i], 1); + member_port_ids[i], 1); } TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(bonded_port_id, &read_mac_addr), @@ -1001,36 +1006,36 @@ test_set_bonded_port_initialization_mac_assignment(void) sizeof(read_mac_addr)), "bonded port mac address not as expected"); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[0]); + member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 0 mac address not as expected"); + "member port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[1]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[1]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 1 mac address not as expected"); + "member port 1 mac address not as expected"); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[2], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[2]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[2]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 2 mac address not as expected"); + "member port 2 mac address not as expected"); /* 7. a - Change primary port * b - Stop / Start bonded port - * d - Verify slave ethdev MAC addresses + * d - Verify member ethdev MAC addresses */ TEST_ASSERT_SUCCESS(rte_eth_bond_primary_set(bonded_port_id, - slave_port_ids[2]), + member_port_ids[2]), "failed to set primary port on bonded device."); TEST_ASSERT_SUCCESS(rte_eth_dev_stop(bonded_port_id), @@ -1048,94 +1053,94 @@ test_set_bonded_port_initialization_mac_assignment(void) sizeof(read_mac_addr)), "bonded port mac address not as expected"); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[0]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[0]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 0 mac address not as expected"); + "member port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[1]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[1]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 1 mac address not as expected"); + "member port 1 mac address not as expected"); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[2], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[2]); + member_port_ids[2]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 2 mac address not as expected"); + "member port 2 mac address not as expected"); /* 6. a - Stop bonded ethdev - * b - remove slave ethdevs - * c - Verify slave ethdevs MACs are restored + * b - remove member ethdevs + * c - Verify member ethdevs MACs are restored */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(bonded_port_id), "Failed to stop bonded port %u", bonded_port_id); - for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) { - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(bonded_port_id, - slave_port_ids[i]), - "Failed to remove slave %d from bonded port (%d).", - slave_port_ids[i], bonded_port_id); + for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_MEMBER_COUNT; i++) { + TEST_ASSERT_SUCCESS(rte_eth_bond_member_remove(bonded_port_id, + member_port_ids[i]), + "Failed to remove member %d from bonded port (%d).", + member_port_ids[i], bonded_port_id); } - slave_count = rte_eth_bond_slaves_get(bonded_port_id, slaves, + member_count = rte_eth_bond_members_get(bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 0, - "Number of slaves (%d) is great than expected (%d).", - slave_count, 0); + TEST_ASSERT_EQUAL(member_count, 0, + "Number of members (%d) is great than expected (%d).", + member_count, 0); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[0]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[0]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 0 mac address not as expected"); + "member port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[1]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[1]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 1 mac address not as expected"); + "member port 1 mac address not as expected"); - slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr), + member_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(member_port_ids[2], &read_mac_addr), "Failed to get mac address (port %d)", - slave_port_ids[2]); - TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, + member_port_ids[2]); + TEST_ASSERT_SUCCESS(memcmp(&member_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), - "slave port 2 mac address not as expected"); + "member port 2 mac address not as expected"); return 0; } static int -initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr, - uint16_t number_of_slaves, uint8_t enable_slave) +initialize_bonded_device_with_members(uint8_t bonding_mode, uint8_t bond_en_isr, + uint16_t number_of_members, uint8_t enable_member) { /* Configure bonded device */ TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, bond_en_isr), "Failed to configure bonding port (%d) in mode %d " - "with (%d) slaves.", test_params->bonded_port_id, bonding_mode, - number_of_slaves); - - /* Add slaves to bonded device */ - while (number_of_slaves > test_params->bonded_slave_count) - TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), - "Failed to add slave (%d to bonding port (%d).", - test_params->bonded_slave_count - 1, + "with (%d) members.", test_params->bonded_port_id, bonding_mode, + number_of_members); + + /* Add members to bonded device */ + while (number_of_members > test_params->bonded_member_count) + TEST_ASSERT_SUCCESS(test_add_member_to_bonded_device(), + "Failed to add member (%d to bonding port (%d).", + test_params->bonded_member_count - 1, test_params->bonded_port_id); /* Set link bonding mode */ @@ -1148,40 +1153,40 @@ initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr, "Failed to start bonded pmd eth device %d.", test_params->bonded_port_id); - if (enable_slave) - enable_bonded_slaves(); + if (enable_member) + enable_bonded_members(); return 0; } static int -test_adding_slave_after_bonded_device_started(void) +test_adding_member_after_bonded_device_started(void) { int i; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, 4, 0), - "Failed to add slaves to bonded device"); + "Failed to add members to bonded device"); - /* Enabled slave devices */ - for (i = 0; i < test_params->bonded_slave_count + 1; i++) { + /* Enabled member devices */ + for (i = 0; i < test_params->bonded_member_count + 1; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 1); + test_params->member_port_ids[i], 1); } - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params->bonded_port_id, - test_params->slave_port_ids[test_params->bonded_slave_count]), - "Failed to add slave to bonded port.\n"); + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(test_params->bonded_port_id, + test_params->member_port_ids[test_params->bonded_member_count]), + "Failed to add member to bonded port.\n"); rte_eth_stats_reset( - test_params->slave_port_ids[test_params->bonded_slave_count]); + test_params->member_port_ids[test_params->bonded_member_count]); - test_params->bonded_slave_count++; + test_params->bonded_member_count++; - return remove_slaves_and_stop_bonded_device(); + return remove_members_and_stop_bonded_device(); } -#define TEST_STATUS_INTERRUPT_SLAVE_COUNT 4 +#define TEST_STATUS_INTERRUPT_MEMBER_COUNT 4 #define TEST_LSC_WAIT_TIMEOUT_US 500000 int test_lsc_interrupt_count; @@ -1237,13 +1242,13 @@ lsc_timeout(int wait_us) static int test_status_interrupt(void) { - int slave_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + int member_count; + uint16_t members[RTE_MAX_ETHPORTS]; - /* initialized bonding device with T slaves */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* initialized bonding device with T members */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 1, - TEST_STATUS_INTERRUPT_SLAVE_COUNT, 1), + TEST_STATUS_INTERRUPT_MEMBER_COUNT, 1), "Failed to initialise bonded device"); test_lsc_interrupt_count = 0; @@ -1253,27 +1258,27 @@ test_status_interrupt(void) RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback, &test_params->bonded_port_id); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, TEST_STATUS_INTERRUPT_SLAVE_COUNT, - "Number of active slaves (%d) is not as expected (%d)", - slave_count, TEST_STATUS_INTERRUPT_SLAVE_COUNT); + TEST_ASSERT_EQUAL(member_count, TEST_STATUS_INTERRUPT_MEMBER_COUNT, + "Number of active members (%d) is not as expected (%d)", + member_count, TEST_STATUS_INTERRUPT_MEMBER_COUNT); - /* Bring all 4 slaves link status to down and test that we have received a + /* Bring all 4 members link status to down and test that we have received a * lsc interrupts */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[0], 0); + test_params->member_port_ids[0], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 0); + test_params->member_port_ids[1], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[2], 0); + test_params->member_port_ids[2], 0); TEST_ASSERT_EQUAL(test_lsc_interrupt_count, 0, "Received a link status change interrupt unexpectedly"); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 0); + test_params->member_port_ids[3], 0); TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_US) == 0, "timed out waiting for interrupt"); @@ -1281,18 +1286,18 @@ test_status_interrupt(void) TEST_ASSERT(test_lsc_interrupt_count > 0, "Did not receive link status change interrupt"); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 0, - "Number of active slaves (%d) is not as expected (%d)", - slave_count, 0); + TEST_ASSERT_EQUAL(member_count, 0, + "Number of active members (%d) is not as expected (%d)", + member_count, 0); - /* bring one slave port up so link status will change */ + /* bring one member port up so link status will change */ test_lsc_interrupt_count = 0; virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[0], 1); + test_params->member_port_ids[0], 1); TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_US) == 0, "timed out waiting for interrupt"); @@ -1301,12 +1306,12 @@ test_status_interrupt(void) TEST_ASSERT(test_lsc_interrupt_count > 0, "Did not receive link status change interrupt"); - /* Verify that calling the same slave lsc interrupt doesn't cause another + /* Verify that calling the same member lsc interrupt doesn't cause another * lsc interrupt from bonded device */ test_lsc_interrupt_count = 0; virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[0], 1); + test_params->member_port_ids[0], 1); TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_US) != 0, "received unexpected interrupt"); @@ -1320,8 +1325,8 @@ test_status_interrupt(void) RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback, &test_params->bonded_port_id); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -1398,11 +1403,11 @@ test_roundrobin_tx_burst(void) struct rte_mbuf *pkt_burst[MAX_PKT_BURST]; struct rte_eth_stats port_stats; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, 2, 1), "Failed to initialise bonded device"); - burst_size = 20 * test_params->bonded_slave_count; + burst_size = 20 * test_params->bonded_member_count; TEST_ASSERT(burst_size <= MAX_PKT_BURST, "Burst size specified is greater than supported."); @@ -1423,20 +1428,20 @@ test_roundrobin_tx_burst(void) test_params->bonded_port_id, (unsigned int)port_stats.opackets, burst_size); - /* Verify slave ports tx stats */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats); + /* Verify member ports tx stats */ + for (i = 0; i < test_params->bonded_member_count; i++) { + rte_eth_stats_get(test_params->member_port_ids[i], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)burst_size / test_params->bonded_slave_count, - "Slave Port (%d) opackets value (%u) not as expected (%d)\n", + (uint64_t)burst_size / test_params->bonded_member_count, + "Member Port (%d) opackets value (%u) not as expected (%d)\n", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - burst_size / test_params->bonded_slave_count); + burst_size / test_params->bonded_member_count); } - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ @@ -1444,8 +1449,8 @@ test_roundrobin_tx_burst(void) pkt_burst, burst_size), 0, "tx burst return unexpected value"); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -1471,13 +1476,13 @@ free_mbufs(struct rte_mbuf **mbufs, int nb_mbufs) rte_pktmbuf_free(mbufs[i]); } -#define TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT (2) -#define TEST_RR_SLAVE_TX_FAIL_BURST_SIZE (64) -#define TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT (22) -#define TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX (1) +#define TEST_RR_MEMBER_TX_FAIL_MEMBER_COUNT (2) +#define TEST_RR_MEMBER_TX_FAIL_BURST_SIZE (64) +#define TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT (22) +#define TEST_RR_MEMBER_TX_FAIL_FAILING_MEMBER_IDX (1) static int -test_roundrobin_tx_burst_slave_tx_fail(void) +test_roundrobin_tx_burst_member_tx_fail(void) { struct rte_mbuf *pkt_burst[MAX_PKT_BURST]; struct rte_mbuf *expected_tx_fail_pkts[MAX_PKT_BURST]; @@ -1486,49 +1491,51 @@ test_roundrobin_tx_burst_slave_tx_fail(void) int i, first_fail_idx, tx_count; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, - TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT, 1), + TEST_RR_MEMBER_TX_FAIL_MEMBER_COUNT, 1), "Failed to initialise bonded device"); /* Generate test bursts of packets to transmit */ TEST_ASSERT_EQUAL(generate_test_burst(pkt_burst, - TEST_RR_SLAVE_TX_FAIL_BURST_SIZE, 0, 1, 0, 0, 0), - TEST_RR_SLAVE_TX_FAIL_BURST_SIZE, + TEST_RR_MEMBER_TX_FAIL_BURST_SIZE, 0, 1, 0, 0, 0), + TEST_RR_MEMBER_TX_FAIL_BURST_SIZE, "Failed to generate test packet burst"); /* Copy references to packets which we expect not to be transmitted */ - first_fail_idx = (TEST_RR_SLAVE_TX_FAIL_BURST_SIZE - - (TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT * - TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)) + - TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX; + first_fail_idx = (TEST_RR_MEMBER_TX_FAIL_BURST_SIZE - + (TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT * + TEST_RR_MEMBER_TX_FAIL_MEMBER_COUNT)) + + TEST_RR_MEMBER_TX_FAIL_FAILING_MEMBER_IDX; - for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) { + for (i = 0; i < TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT; i++) { expected_tx_fail_pkts[i] = pkt_burst[first_fail_idx + - (i * TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)]; + (i * TEST_RR_MEMBER_TX_FAIL_MEMBER_COUNT)]; } - /* Set virtual slave to only fail transmission of - * TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT packets in burst */ + /* + * Set virtual member to only fail transmission of + * TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT packets in burst. + */ virtual_ethdev_tx_burst_fn_set_success( - test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX], + test_params->member_port_ids[TEST_RR_MEMBER_TX_FAIL_FAILING_MEMBER_IDX], 0); virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count( - test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX], - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT); + test_params->member_port_ids[TEST_RR_MEMBER_TX_FAIL_FAILING_MEMBER_IDX], + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT); tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkt_burst, - TEST_RR_SLAVE_TX_FAIL_BURST_SIZE); + TEST_RR_MEMBER_TX_FAIL_BURST_SIZE); - TEST_ASSERT_EQUAL(tx_count, TEST_RR_SLAVE_TX_FAIL_BURST_SIZE - - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, + TEST_ASSERT_EQUAL(tx_count, TEST_RR_MEMBER_TX_FAIL_BURST_SIZE - + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT, "Transmitted (%d) an unexpected (%d) number of packets", tx_count, - TEST_RR_SLAVE_TX_FAIL_BURST_SIZE - - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT); + TEST_RR_MEMBER_TX_FAIL_BURST_SIZE - + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT); /* Verify that failed packet are expected failed packets */ - for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) { + for (i = 0; i < TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT; i++) { TEST_ASSERT_EQUAL(expected_tx_fail_pkts[i], pkt_burst[i + tx_count], "expected mbuf (%d) pointer %p not expected pointer %p", i, expected_tx_fail_pkts[i], pkt_burst[i + tx_count]); @@ -1538,45 +1545,45 @@ test_roundrobin_tx_burst_slave_tx_fail(void) rte_eth_stats_get(test_params->bonded_port_id, &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)TEST_RR_SLAVE_TX_FAIL_BURST_SIZE - - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, + (uint64_t)TEST_RR_MEMBER_TX_FAIL_BURST_SIZE - + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT, "Bonded Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - TEST_RR_SLAVE_TX_FAIL_BURST_SIZE - - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT); + TEST_RR_MEMBER_TX_FAIL_BURST_SIZE - + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT); - /* Verify slave ports tx stats */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - int slave_expected_tx_count; + /* Verify member ports tx stats */ + for (i = 0; i < test_params->bonded_member_count; i++) { + int member_expected_tx_count; - rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[i], &port_stats); - slave_expected_tx_count = TEST_RR_SLAVE_TX_FAIL_BURST_SIZE / - test_params->bonded_slave_count; + member_expected_tx_count = TEST_RR_MEMBER_TX_FAIL_BURST_SIZE / + test_params->bonded_member_count; - if (i == TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX) - slave_expected_tx_count = slave_expected_tx_count - - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; + if (i == TEST_RR_MEMBER_TX_FAIL_FAILING_MEMBER_IDX) + member_expected_tx_count = member_expected_tx_count - + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT; TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)slave_expected_tx_count, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[i], - (unsigned int)port_stats.opackets, slave_expected_tx_count); + (uint64_t)member_expected_tx_count, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[i], + (unsigned int)port_stats.opackets, member_expected_tx_count); } /* Verify that all mbufs have a ref value of zero */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkt_burst[tx_count], - TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, 1), + TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); - free_mbufs(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT); + free_mbufs(&pkt_burst[tx_count], TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int -test_roundrobin_rx_burst_on_single_slave(void) +test_roundrobin_rx_burst_on_single_member(void) { struct rte_mbuf *gen_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; @@ -1585,19 +1592,19 @@ test_roundrobin_rx_burst_on_single_slave(void) int i, j, burst_size = 25; - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, 4, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); /* Generate test bursts of packets to transmit */ TEST_ASSERT_EQUAL(generate_test_burst( gen_pkt_burst, burst_size, 0, 1, 0, 0, 0), burst_size, "burst generation failed"); - for (i = 0; i < test_params->bonded_slave_count; i++) { - /* Add rx data to slave */ - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + for (i = 0; i < test_params->bonded_member_count; i++) { + /* Add rx data to member */ + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[0], burst_size); /* Call rx burst on bonded device */ @@ -1616,25 +1623,25 @@ test_roundrobin_rx_burst_on_single_slave(void) - /* Verify bonded slave devices rx count */ - /* Verify slave ports tx stats */ - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); + /* Verify bonded member devices rx count */ + /* Verify member ports tx stats */ + for (j = 0; j < test_params->bonded_member_count; j++) { + rte_eth_stats_get(test_params->member_port_ids[j], &port_stats); if (i == j) { TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, - "Slave Port (%d) ipackets value (%u) not as expected" - " (%d)", test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as expected" + " (%d)", test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, burst_size); } else { TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as expected" - " (%d)", test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as expected" + " (%d)", test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, 0); } - /* Reset bonded slaves stats */ - rte_eth_stats_reset(test_params->slave_port_ids[j]); + /* Reset bonded members stats */ + rte_eth_stats_reset(test_params->member_port_ids[j]); } /* reset bonded device stats */ rte_eth_stats_reset(test_params->bonded_port_id); @@ -1646,38 +1653,38 @@ test_roundrobin_rx_burst_on_single_slave(void) } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT (3) +#define TEST_ROUNDROBIN_TX_BURST_MEMBER_COUNT (3) static int -test_roundrobin_rx_burst_on_multiple_slaves(void) +test_roundrobin_rx_burst_on_multiple_members(void) { - struct rte_mbuf *gen_pkt_burst[TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT][MAX_PKT_BURST]; + struct rte_mbuf *gen_pkt_burst[TEST_ROUNDROBIN_TX_BURST_MEMBER_COUNT][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - int burst_size[TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT] = { 15, 13, 36 }; + int burst_size[TEST_ROUNDROBIN_TX_BURST_MEMBER_COUNT] = { 15, 13, 36 }; int i, nb_rx; - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, 4, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); /* Generate test bursts of packets to transmit */ - for (i = 0; i < TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_ROUNDROBIN_TX_BURST_MEMBER_COUNT; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[i][0], burst_size[i], 0, 1, 0, 0, 0), burst_size[i], "burst generation failed"); } - /* Add rx data to slaves */ - for (i = 0; i < TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT; i++) { - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + /* Add rx data to members */ + for (i = 0; i < TEST_ROUNDROBIN_TX_BURST_MEMBER_COUNT; i++) { + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[i][0], burst_size[i]); } @@ -1697,29 +1704,29 @@ test_roundrobin_rx_burst_on_multiple_slaves(void) test_params->bonded_port_id, (unsigned int)port_stats.ipackets, burst_size[0] + burst_size[1] + burst_size[2]); - /* Verify bonded slave devices rx counts */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + /* Verify bonded member devices rx counts */ + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[0], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.ipackets, burst_size[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[1], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[1], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[1], (unsigned int)port_stats.ipackets, burst_size[1]); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[2], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[2], + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[2], (unsigned int)port_stats.ipackets, burst_size[2]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[3], + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[3], (unsigned int)port_stats.ipackets, 0); /* free mbufs */ @@ -1727,8 +1734,8 @@ test_roundrobin_rx_burst_on_multiple_slaves(void) rte_pktmbuf_free(rx_pkt_burst[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -1739,48 +1746,54 @@ test_roundrobin_verify_mac_assignment(void) int i; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], + &expected_mac_addr_0), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_2), + test_params->member_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[2], + &expected_mac_addr_2), "Failed to get mac address (port %d)", - test_params->slave_port_ids[2]); + test_params->member_port_ids[2]); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, 4, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); - /* Verify that all MACs are the same as first slave added to bonded dev */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + /* Verify that all MACs are the same as first member added to bonded dev */ + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[i]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[i]); } /* change primary and verify that MAC addresses haven't changed */ TEST_ASSERT_SUCCESS(rte_eth_bond_primary_set(test_params->bonded_port_id, - test_params->slave_port_ids[2]), + test_params->member_port_ids[2]), "Failed to set bonded port (%d) primary port to (%d)", - test_params->bonded_port_id, test_params->slave_port_ids[i]); + test_params->bonded_port_id, test_params->member_port_ids[i]); - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address has changed to that of primary" + "member port (%d) mac address has changed to that of primary" " port without stop/start toggle of bonded device", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } - /* stop / start bonded device and verify that primary MAC address is - * propagate to bonded device and slaves */ + /* + * stop / start bonded device and verify that primary MAC address is + * propagate to bonded device and members. + */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), "Failed to stop bonded port %u", test_params->bonded_port_id); @@ -1794,16 +1807,17 @@ test_roundrobin_verify_mac_assignment(void) TEST_ASSERT_SUCCESS( memcmp(&expected_mac_addr_2, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_2, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of new primary" - " port", test_params->slave_port_ids[i]); + "member port (%d) mac address not set to that of new primary" + " port", test_params->member_port_ids[i]); } /* Set explicit MAC address */ @@ -1818,19 +1832,20 @@ test_roundrobin_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, - sizeof(read_mac_addr)), "slave port (%d) mac address not set to" - " that of new primary port\n", test_params->slave_port_ids[i]); + sizeof(read_mac_addr)), "member port (%d) mac address not set to" + " that of new primary port\n", test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -1839,10 +1854,10 @@ test_roundrobin_verify_promiscuous_enable_disable(void) int i, promiscuous_en; int ret; - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ROUND_ROBIN, 0, 4, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); ret = rte_eth_promiscuous_enable(test_params->bonded_port_id); TEST_ASSERT_SUCCESS(ret, @@ -1854,12 +1869,12 @@ test_roundrobin_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not enabled", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { promiscuous_en = rte_eth_promiscuous_get( - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_EQUAL(promiscuous_en, 1, - "slave port (%d) promiscuous mode not enabled", - test_params->slave_port_ids[i]); + "member port (%d) promiscuous mode not enabled", + test_params->member_port_ids[i]); } ret = rte_eth_promiscuous_disable(test_params->bonded_port_id); @@ -1872,76 +1887,76 @@ test_roundrobin_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not disabled\n", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { promiscuous_en = rte_eth_promiscuous_get( - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_EQUAL(promiscuous_en, 0, "Port (%d) promiscuous mode not disabled\n", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_RR_LINK_STATUS_SLAVE_COUNT (4) -#define TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT (2) +#define TEST_RR_LINK_STATUS_MEMBER_COUNT (4) +#define TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_MEMBER_COUNT (2) static int -test_roundrobin_verify_slave_link_status_change_behaviour(void) +test_roundrobin_verify_member_link_status_change_behaviour(void) { struct rte_mbuf *tx_pkt_burst[MAX_PKT_BURST] = { NULL }; - struct rte_mbuf *gen_pkt_burst[TEST_RR_LINK_STATUS_SLAVE_COUNT][MAX_PKT_BURST]; + struct rte_mbuf *gen_pkt_burst[TEST_RR_LINK_STATUS_MEMBER_COUNT][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - int i, burst_size, slave_count; + int i, burst_size, member_count; /* NULL all pointers in array to simplify cleanup */ memset(gen_pkt_burst, 0, sizeof(gen_pkt_burst)); - /* Initialize bonded device with TEST_RR_LINK_STATUS_SLAVE_COUNT slaves + /* Initialize bonded device with TEST_RR_LINK_STATUS_MEMBER_COUNT members * in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( - BONDING_MODE_ROUND_ROBIN, 0, TEST_RR_LINK_STATUS_SLAVE_COUNT, 1), - "Failed to initialize bonded device with slaves"); + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( + BONDING_MODE_ROUND_ROBIN, 0, TEST_RR_LINK_STATUS_MEMBER_COUNT, 1), + "Failed to initialize bonded device with members"); - /* Verify Current Slaves Count /Active Slave Count is */ - slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, slaves, + /* Verify Current Members Count /Active Member Count is */ + member_count = rte_eth_bond_members_get(test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, TEST_RR_LINK_STATUS_SLAVE_COUNT, - "Number of slaves (%d) is not as expected (%d).", - slave_count, TEST_RR_LINK_STATUS_SLAVE_COUNT); + TEST_ASSERT_EQUAL(member_count, TEST_RR_LINK_STATUS_MEMBER_COUNT, + "Number of members (%d) is not as expected (%d).", + member_count, TEST_RR_LINK_STATUS_MEMBER_COUNT); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, TEST_RR_LINK_STATUS_SLAVE_COUNT, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, TEST_RR_LINK_STATUS_SLAVE_COUNT); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, TEST_RR_LINK_STATUS_MEMBER_COUNT, + "Number of active members (%d) is not as expected (%d).", + member_count, TEST_RR_LINK_STATUS_MEMBER_COUNT); - /* Set 2 slaves eth_devs link status to down */ + /* Set 2 members eth_devs link status to down */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 0); + test_params->member_port_ids[1], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 0); + test_params->member_port_ids[3], 0); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, - TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT, - "Number of active slaves (%d) is not as expected (%d).\n", - slave_count, TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, + TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_MEMBER_COUNT, + "Number of active members (%d) is not as expected (%d).\n", + member_count, TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_MEMBER_COUNT); burst_size = 20; - /* Verify that pkts are not sent on slaves with link status down: + /* Verify that pkts are not sent on members with link status down: * * 1. Generate test burst of traffic * 2. Transmit burst on bonded eth_dev * 3. Verify stats for bonded eth_dev (opackets = burst_size) - * 4. Verify stats for slave eth_devs (s0 = 10, s1 = 0, s2 = 10, s3 = 0) + * 4. Verify stats for member eth_devs (s0 = 10, s1 = 0, s2 = 10, s3 = 0) */ TEST_ASSERT_EQUAL( generate_test_burst(tx_pkt_burst, burst_size, 0, 1, 0, 0, 0), @@ -1960,41 +1975,41 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void) test_params->bonded_port_id, (int)port_stats.opackets, burst_size); - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)10, "Port (%d) opackets stats (%d) not expected (%d) value", - test_params->slave_port_ids[0], (int)port_stats.opackets, 10); + test_params->member_port_ids[0], (int)port_stats.opackets, 10); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)0, "Port (%d) opackets stats (%d) not expected (%d) value", - test_params->slave_port_ids[1], (int)port_stats.opackets, 0); + test_params->member_port_ids[1], (int)port_stats.opackets, 0); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)10, "Port (%d) opackets stats (%d) not expected (%d) value", - test_params->slave_port_ids[2], (int)port_stats.opackets, 10); + test_params->member_port_ids[2], (int)port_stats.opackets, 10); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)0, "Port (%d) opackets stats (%d) not expected (%d) value", - test_params->slave_port_ids[3], (int)port_stats.opackets, 0); + test_params->member_port_ids[3], (int)port_stats.opackets, 0); - /* Verify that pkts are not sent on slaves with link status down: + /* Verify that pkts are not sent on members with link status down: * * 1. Generate test bursts of traffic * 2. Add bursts on to virtual eth_devs * 3. Rx burst on bonded eth_dev, expected (burst_ size * - * TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT) received + * TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_MEMBER_COUNT) received * 4. Verify stats for bonded eth_dev - * 6. Verify stats for slave eth_devs (s0 = 10, s1 = 0, s2 = 10, s3 = 0) + * 6. Verify stats for member eth_devs (s0 = 10, s1 = 0, s2 = 10, s3 = 0) */ - for (i = 0; i < TEST_RR_LINK_STATUS_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_RR_LINK_STATUS_MEMBER_COUNT; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[i][0], burst_size, 0, 1, 0, 0, 0), burst_size, "failed to generate packet burst"); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[i][0], burst_size); } @@ -2014,49 +2029,49 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void) rte_pktmbuf_free(rx_pkt_burst[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT (2) +#define TEST_RR_POLLING_LINK_STATUS_MEMBER_COUNT (2) -uint8_t polling_slave_mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00 }; +uint8_t polling_member_mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00 }; -int polling_test_slaves[TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT] = { -1, -1 }; +int polling_test_members[TEST_RR_POLLING_LINK_STATUS_MEMBER_COUNT] = { -1, -1 }; static int -test_roundrobin_verfiy_polling_slave_link_status_change(void) +test_roundrobin_verify_polling_member_link_status_change(void) { struct rte_ether_addr *mac_addr = - (struct rte_ether_addr *)polling_slave_mac; - char slave_name[RTE_ETH_NAME_MAX_LEN]; + (struct rte_ether_addr *)polling_member_mac; + char member_name[RTE_ETH_NAME_MAX_LEN]; int i; - for (i = 0; i < TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT; i++) { - /* Generate slave name / MAC address */ - snprintf(slave_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_poll_%d", i); + for (i = 0; i < TEST_RR_POLLING_LINK_STATUS_MEMBER_COUNT; i++) { + /* Generate member name / MAC address */ + snprintf(member_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_poll_%d", i); mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; - /* Create slave devices with no ISR Support */ - if (polling_test_slaves[i] == -1) { - polling_test_slaves[i] = virtual_ethdev_create(slave_name, mac_addr, + /* Create member devices with no ISR Support */ + if (polling_test_members[i] == -1) { + polling_test_members[i] = virtual_ethdev_create(member_name, mac_addr, rte_socket_id(), 0); - TEST_ASSERT(polling_test_slaves[i] >= 0, - "Failed to create virtual virtual ethdev %s\n", slave_name); + TEST_ASSERT(polling_test_members[i] >= 0, + "Failed to create virtual ethdev %s\n", member_name); - /* Configure slave */ - TEST_ASSERT_SUCCESS(configure_ethdev(polling_test_slaves[i], 0, 0), - "Failed to configure virtual ethdev %s(%d)", slave_name, - polling_test_slaves[i]); + /* Configure member */ + TEST_ASSERT_SUCCESS(configure_ethdev(polling_test_members[i], 0, 0), + "Failed to configure virtual ethdev %s(%d)", member_name, + polling_test_members[i]); } - /* Add slave to bonded device */ - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params->bonded_port_id, - polling_test_slaves[i]), - "Failed to add slave %s(%d) to bonded device %d", - slave_name, polling_test_slaves[i], + /* Add member to bonded device */ + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(test_params->bonded_port_id, + polling_test_members[i]), + "Failed to add member %s(%d) to bonded device %d", + member_name, polling_test_members[i], test_params->bonded_port_id); } @@ -2071,26 +2086,26 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void) RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback, &test_params->bonded_port_id); - /* link status change callback for first slave link up */ + /* link status change callback for first member link up */ test_lsc_interrupt_count = 0; - virtual_ethdev_set_link_status(polling_test_slaves[0], 1); + virtual_ethdev_set_link_status(polling_test_members[0], 1); TEST_ASSERT_SUCCESS(lsc_timeout(15000), "timed out waiting for interrupt"); - /* no link status change callback for second slave link up */ + /* no link status change callback for second member link up */ test_lsc_interrupt_count = 0; - virtual_ethdev_set_link_status(polling_test_slaves[1], 1); + virtual_ethdev_set_link_status(polling_test_members[1], 1); TEST_ASSERT_FAIL(lsc_timeout(15000), "unexpectedly succeeded"); - /* link status change callback for both slave links down */ + /* link status change callback for both member links down */ test_lsc_interrupt_count = 0; - virtual_ethdev_set_link_status(polling_test_slaves[0], 0); - virtual_ethdev_set_link_status(polling_test_slaves[1], 0); + virtual_ethdev_set_link_status(polling_test_members[0], 0); + virtual_ethdev_set_link_status(polling_test_members[1], 0); TEST_ASSERT_SUCCESS(lsc_timeout(20000), "timed out waiting for interrupt"); @@ -2100,17 +2115,17 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void) &test_params->bonded_port_id); - /* Clean up and remove slaves from bonded device */ - for (i = 0; i < TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT; i++) { + /* Clean up and remove members from bonded device */ + for (i = 0; i < TEST_RR_POLLING_LINK_STATUS_MEMBER_COUNT; i++) { TEST_ASSERT_SUCCESS( - rte_eth_bond_slave_remove(test_params->bonded_port_id, - polling_test_slaves[i]), - "Failed to remove slave %d from bonded port (%d)", - polling_test_slaves[i], test_params->bonded_port_id); + rte_eth_bond_member_remove(test_params->bonded_port_id, + polling_test_members[i]), + "Failed to remove member %d from bonded port (%d)", + polling_test_members[i], test_params->bonded_port_id); } - return remove_slaves_and_stop_bonded_device(); + return remove_members_and_stop_bonded_device(); } @@ -2123,9 +2138,9 @@ test_activebackup_tx_burst(void) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_eth_stats port_stats; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ACTIVE_BACKUP, 0, 1, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, @@ -2136,7 +2151,7 @@ test_activebackup_tx_burst(void) pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, dst_addr_0, pktlen); - burst_size = 20 * test_params->bonded_slave_count; + burst_size = 20 * test_params->bonded_member_count; TEST_ASSERT(burst_size < MAX_PKT_BURST, "Burst size specified is greater than supported."); @@ -2160,38 +2175,38 @@ test_activebackup_tx_burst(void) primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); - /* Verify slave ports tx stats */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats); - if (test_params->slave_port_ids[i] == primary_port) { + /* Verify member ports tx stats */ + for (i = 0; i < test_params->bonded_member_count; i++) { + rte_eth_stats_get(test_params->member_port_ids[i], &port_stats); + if (test_params->member_port_ids[i] == primary_port) { TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, - "Slave Port (%d) opackets value (%u) not as expected (%d)", + "Member Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - burst_size / test_params->bonded_slave_count); + burst_size / test_params->bonded_member_count); } else { TEST_ASSERT_EQUAL(port_stats.opackets, 0, - "Slave Port (%d) opackets value (%u) not as expected (%d)", + "Member Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, 0); } } - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ TEST_ASSERT_EQUAL(rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst, burst_size), 0, "Sending empty burst failed"); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT (4) +#define TEST_ACTIVE_BACKUP_RX_BURST_MEMBER_COUNT (4) static int test_activebackup_rx_burst(void) @@ -2205,24 +2220,24 @@ test_activebackup_rx_burst(void) int i, j, burst_size = 17; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ACTIVE_BACKUP, 0, - TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT, 1), - "Failed to initialize bonded device with slaves"); + TEST_ACTIVE_BACKUP_RX_BURST_MEMBER_COUNT, 1), + "Failed to initialize bonded device with members"); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); TEST_ASSERT(primary_port >= 0, - "failed to get primary slave for bonded port (%d)", + "failed to get primary member for bonded port (%d)", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { /* Generate test bursts of packets to transmit */ TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[0], burst_size, 0, 1, 0, 0, 0), burst_size, "burst generation failed"); - /* Add rx data to slave */ - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + /* Add rx data to member */ + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[0], burst_size); /* Call rx burst on bonded device */ @@ -2230,7 +2245,7 @@ test_activebackup_rx_burst(void) &rx_pkt_burst[0], MAX_PKT_BURST), burst_size, "rte_eth_rx_burst failed"); - if (test_params->slave_port_ids[i] == primary_port) { + if (test_params->member_port_ids[i] == primary_port) { /* Verify bonded device rx count */ rte_eth_stats_get(test_params->bonded_port_id, &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, @@ -2238,27 +2253,30 @@ test_activebackup_rx_burst(void) test_params->bonded_port_id, (unsigned int)port_stats.ipackets, burst_size); - /* Verify bonded slave devices rx count */ - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); + /* Verify bonded member devices rx count */ + for (j = 0; j < test_params->bonded_member_count; j++) { + rte_eth_stats_get(test_params->member_port_ids[j], &port_stats); if (i == j) { TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, - "Slave Port (%d) ipackets value (%u) not as " - "expected (%d)", test_params->slave_port_ids[i], - (unsigned int)port_stats.ipackets, burst_size); + "Member Port (%d) ipackets value (%u) not as " + "expected (%d)", + test_params->member_port_ids[i], + (unsigned int)port_stats.ipackets, + burst_size); } else { TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as " - "expected (%d)\n", test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as " + "expected (%d)\n", + test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, 0); } } } else { - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); + for (j = 0; j < test_params->bonded_member_count; j++) { + rte_eth_stats_get(test_params->member_port_ids[j], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as expected " - "(%d)", test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as expected " + "(%d)", test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, 0); } } @@ -2275,8 +2293,8 @@ test_activebackup_rx_burst(void) rte_eth_stats_reset(test_params->bonded_port_id); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -2285,14 +2303,14 @@ test_activebackup_verify_promiscuous_enable_disable(void) int i, primary_port, promiscuous_en; int ret; - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ACTIVE_BACKUP, 0, 4, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); TEST_ASSERT(primary_port >= 0, - "failed to get primary slave for bonded port (%d)", + "failed to get primary member for bonded port (%d)", test_params->bonded_port_id); ret = rte_eth_promiscuous_enable(test_params->bonded_port_id); @@ -2304,17 +2322,17 @@ test_activebackup_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not enabled", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { promiscuous_en = rte_eth_promiscuous_get( - test_params->slave_port_ids[i]); - if (primary_port == test_params->slave_port_ids[i]) { + test_params->member_port_ids[i]); + if (primary_port == test_params->member_port_ids[i]) { TEST_ASSERT_EQUAL(promiscuous_en, 1, - "slave port (%d) promiscuous mode not enabled", - test_params->slave_port_ids[i]); + "member port (%d) promiscuous mode not enabled", + test_params->member_port_ids[i]); } else { TEST_ASSERT_EQUAL(promiscuous_en, 0, - "slave port (%d) promiscuous mode enabled", - test_params->slave_port_ids[i]); + "member port (%d) promiscuous mode enabled", + test_params->member_port_ids[i]); } } @@ -2328,16 +2346,16 @@ test_activebackup_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not disabled\n", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { promiscuous_en = rte_eth_promiscuous_get( - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_EQUAL(promiscuous_en, 0, - "slave port (%d) promiscuous mode not disabled\n", - test_params->slave_port_ids[i]); + "member port (%d) promiscuous mode not disabled\n", + test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -2346,19 +2364,21 @@ test_activebackup_verify_mac_assignment(void) struct rte_ether_addr read_mac_addr; struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], + &expected_mac_addr_0), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1), + test_params->member_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], + &expected_mac_addr_1), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - /* Initialize bonded device with 2 slaves in active backup mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 2 members in active backup mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ACTIVE_BACKUP, 0, 2, 1), - "Failed to initialize bonded device with slaves"); + "Failed to initialize bonded device with members"); - /* Verify that bonded MACs is that of first slave and that the other slave + /* Verify that bonded MACs is that of first member and that the other member * MAC hasn't been changed */ TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), "Failed to get mac address (port %d)", @@ -2368,27 +2388,27 @@ test_activebackup_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[1]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[1]); /* change primary and verify that MAC addresses haven't changed */ TEST_ASSERT_EQUAL(rte_eth_bond_primary_set(test_params->bonded_port_id, - test_params->slave_port_ids[1]), 0, + test_params->member_port_ids[1]), 0, "Failed to set bonded port (%d) primary port to (%d)", - test_params->bonded_port_id, test_params->slave_port_ids[1]); + test_params->bonded_port_id, test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), "Failed to get mac address (port %d)", @@ -2398,24 +2418,26 @@ test_activebackup_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[1]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[1]); - /* stop / start bonded device and verify that primary MAC address is - * propagated to bonded device and slaves */ + /* + * stop / start bonded device and verify that primary MAC address is + * propagated to bonded device and members. + */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), "Failed to stop bonded port %u", @@ -2432,21 +2454,21 @@ test_activebackup_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[0]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[1]); /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( @@ -2462,36 +2484,36 @@ test_activebackup_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of bonded port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[0]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of bonded port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of bonded port", + test_params->member_port_ids[1]); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int -test_activebackup_verify_slave_link_status_change_failover(void) +test_activebackup_verify_member_link_status_change_failover(void) { - struct rte_mbuf *pkt_burst[TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT][MAX_PKT_BURST]; + struct rte_mbuf *pkt_burst[TEST_ACTIVE_BACKUP_RX_BURST_MEMBER_COUNT][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - int i, burst_size, slave_count, primary_port; + int i, burst_size, member_count, primary_port; burst_size = 21; @@ -2502,96 +2524,96 @@ test_activebackup_verify_slave_link_status_change_failover(void) &pkt_burst[0][0], burst_size, 0, 1, 0, 0, 0), burst_size, "generate_test_burst failed"); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ACTIVE_BACKUP, 0, - TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT, 1), - "Failed to initialize bonded device with slaves"); + TEST_ACTIVE_BACKUP_RX_BURST_MEMBER_COUNT, 1), + "Failed to initialize bonded device with members"); - /* Verify Current Slaves Count /Active Slave Count is */ - slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, slaves, + /* Verify Current Members Count /Active Member Count is */ + member_count = rte_eth_bond_members_get(test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 4, - "Number of slaves (%d) is not as expected (%d).", - slave_count, 4); + TEST_ASSERT_EQUAL(member_count, 4, + "Number of members (%d) is not as expected (%d).", + member_count, 4); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 4, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 4); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, 4, + "Number of active members (%d) is not as expected (%d).", + member_count, 4); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); - TEST_ASSERT_EQUAL(primary_port, test_params->slave_port_ids[0], + TEST_ASSERT_EQUAL(primary_port, test_params->member_port_ids[0], "Primary port not as expected"); - /* Bring 2 slaves down and verify active slave count */ + /* Bring 2 members down and verify active member count */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 0); + test_params->member_port_ids[1], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 0); + test_params->member_port_ids[3], 0); - TEST_ASSERT_EQUAL(rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS), 2, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 2); + TEST_ASSERT_EQUAL(rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS), 2, + "Number of active members (%d) is not as expected (%d).", + member_count, 2); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 1); + test_params->member_port_ids[1], 1); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 1); + test_params->member_port_ids[3], 1); - /* Bring primary port down, verify that active slave count is 3 and primary + /* Bring primary port down, verify that active member count is 3 and primary * has changed */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[0], 0); + test_params->member_port_ids[0], 0); - TEST_ASSERT_EQUAL(rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS), + TEST_ASSERT_EQUAL(rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS), 3, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 3); + "Number of active members (%d) is not as expected (%d).", + member_count, 3); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); - TEST_ASSERT_EQUAL(primary_port, test_params->slave_port_ids[2], + TEST_ASSERT_EQUAL(primary_port, test_params->member_port_ids[2], "Primary port not as expected"); - /* Verify that pkts are sent on new primary slave */ + /* Verify that pkts are sent on new primary member */ TEST_ASSERT_EQUAL(rte_eth_tx_burst( test_params->bonded_port_id, 0, &pkt_burst[0][0], burst_size), burst_size, "rte_eth_tx_burst failed"); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[2]); + test_params->member_port_ids[2]); - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[3]); + test_params->member_port_ids[3]); /* Generate packet burst for testing */ - for (i = 0; i < TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_ACTIVE_BACKUP_RX_BURST_MEMBER_COUNT; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &pkt_burst[i][0], burst_size, 0, 1, 0, 0, 0), burst_size, "generate_test_burst failed"); virtual_ethdev_add_mbufs_to_rx_queue( - test_params->slave_port_ids[i], &pkt_burst[i][0], burst_size); + test_params->member_port_ids[i], &pkt_burst[i][0], burst_size); } TEST_ASSERT_EQUAL(rte_eth_rx_burst( @@ -2604,28 +2626,28 @@ test_activebackup_verify_slave_link_status_change_failover(void) "(%d) port_stats.ipackets not as expected", test_params->bonded_port_id); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[2]); + test_params->member_port_ids[2]); - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[3]); + test_params->member_port_ids[3]); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } /** Balance Mode Tests */ @@ -2633,9 +2655,9 @@ test_activebackup_verify_slave_link_status_change_failover(void) static int test_balance_xmit_policy_configuration(void) { - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_ACTIVE_BACKUP, 0, 2, 1), - "Failed to initialize_bonded_device_with_slaves."); + "Failed to initialize_bonded_device_with_members."); /* Invalid port id */ TEST_ASSERT_FAIL(rte_eth_bond_xmit_policy_set( @@ -2644,7 +2666,7 @@ test_balance_xmit_policy_configuration(void) /* Set xmit policy on non bonded device */ TEST_ASSERT_FAIL(rte_eth_bond_xmit_policy_set( - test_params->slave_port_ids[0], BALANCE_XMIT_POLICY_LAYER2), + test_params->member_port_ids[0], BALANCE_XMIT_POLICY_LAYER2), "Expected call to failed as invalid port specified."); @@ -2677,25 +2699,25 @@ test_balance_xmit_policy_configuration(void) TEST_ASSERT_FAIL(rte_eth_bond_xmit_policy_get(INVALID_PORT_ID), "Expected call to failed as invalid port specified."); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT (2) +#define TEST_BALANCE_L2_TX_BURST_MEMBER_COUNT (2) static int test_balance_l2_tx_burst(void) { - struct rte_mbuf *pkts_burst[TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT][MAX_PKT_BURST]; - int burst_size[TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT] = { 10, 15 }; + struct rte_mbuf *pkts_burst[TEST_BALANCE_L2_TX_BURST_MEMBER_COUNT][MAX_PKT_BURST]; + int burst_size[TEST_BALANCE_L2_TX_BURST_MEMBER_COUNT] = { 10, 15 }; uint16_t pktlen; int i; struct rte_eth_stats port_stats; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( - BONDING_MODE_BALANCE, 0, TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT, 1), - "Failed to initialize_bonded_device_with_slaves."); + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( + BONDING_MODE_BALANCE, 0, TEST_BALANCE_L2_TX_BURST_MEMBER_COUNT, 1), + "Failed to initialize_bonded_device_with_members."); TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set( test_params->bonded_port_id, BALANCE_XMIT_POLICY_LAYER2), @@ -2730,7 +2752,7 @@ test_balance_l2_tx_burst(void) "failed to generate packet burst"); /* Send burst 1 on bonded port */ - for (i = 0; i < TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_BALANCE_L2_TX_BURST_MEMBER_COUNT; i++) { TEST_ASSERT_EQUAL(rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkts_burst[i][0], burst_size[i]), burst_size[i], "Failed to transmit packet burst"); @@ -2745,24 +2767,24 @@ test_balance_l2_tx_burst(void) burst_size[0] + burst_size[1]); - /* Verify slave ports tx stats */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + /* Verify member ports tx stats */ + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size[0], - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], (unsigned int)port_stats.opackets, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.opackets, burst_size[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size[1], - "Slave Port (%d) opackets value (%u) not as expected (%d)\n", - test_params->slave_port_ids[1], (unsigned int)port_stats.opackets, + "Member Port (%d) opackets value (%u) not as expected (%d)\n", + test_params->member_port_ids[1], (unsigned int)port_stats.opackets, burst_size[1]); - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ @@ -2770,8 +2792,8 @@ test_balance_l2_tx_burst(void) test_params->bonded_port_id, 0, &pkts_burst[0][0], burst_size[0]), 0, "Expected zero packet"); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -2785,9 +2807,9 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, struct rte_eth_stats port_stats; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BALANCE, 0, 2, 1), - "Failed to initialize_bonded_device_with_slaves."); + "Failed to initialize_bonded_device_with_members."); TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set( test_params->bonded_port_id, BALANCE_XMIT_POLICY_LAYER23), @@ -2825,24 +2847,24 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, test_params->bonded_port_id, (unsigned int)port_stats.opackets, nb_tx_1 + nb_tx_2); - /* Verify slave ports tx stats */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + /* Verify member ports tx stats */ + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)nb_tx_1, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], (unsigned int)port_stats.opackets, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.opackets, nb_tx_1); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)nb_tx_2, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[1], (unsigned int)port_stats.opackets, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[1], (unsigned int)port_stats.opackets, nb_tx_2); - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ @@ -2851,8 +2873,8 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, burst_size_1), 0, "Expected zero packet"); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -2897,9 +2919,9 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, struct rte_eth_stats port_stats; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BALANCE, 0, 2, 1), - "Failed to initialize_bonded_device_with_slaves."); + "Failed to initialize_bonded_device_with_members."); TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set( test_params->bonded_port_id, BALANCE_XMIT_POLICY_LAYER34), @@ -2938,24 +2960,24 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, test_params->bonded_port_id, (unsigned int)port_stats.opackets, nb_tx_1 + nb_tx_2); - /* Verify slave ports tx stats */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + /* Verify member ports tx stats */ + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)nb_tx_1, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], (unsigned int)port_stats.opackets, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.opackets, nb_tx_1); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)nb_tx_2, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[1], (unsigned int)port_stats.opackets, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[1], (unsigned int)port_stats.opackets, nb_tx_2); - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ @@ -2963,8 +2985,8 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, test_params->bonded_port_id, 0, pkts_burst_1, burst_size_1), 0, "Expected zero packet"); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -3003,27 +3025,27 @@ test_balance_l34_tx_burst_ipv6_toggle_udp_port(void) return balance_l34_tx_burst(0, 0, 0, 0, 1); } -#define TEST_BAL_SLAVE_TX_FAIL_SLAVE_COUNT (2) -#define TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 (40) -#define TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2 (20) -#define TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT (25) -#define TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX (0) +#define TEST_BAL_MEMBER_TX_FAIL_MEMBER_COUNT (2) +#define TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 (40) +#define TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2 (20) +#define TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT (25) +#define TEST_BAL_MEMBER_TX_FAIL_FAILING_MEMBER_IDX (0) static int -test_balance_tx_burst_slave_tx_fail(void) +test_balance_tx_burst_member_tx_fail(void) { - struct rte_mbuf *pkts_burst_1[TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1]; - struct rte_mbuf *pkts_burst_2[TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2]; + struct rte_mbuf *pkts_burst_1[TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1]; + struct rte_mbuf *pkts_burst_2[TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2]; - struct rte_mbuf *expected_fail_pkts[TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT]; + struct rte_mbuf *expected_fail_pkts[TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT]; struct rte_eth_stats port_stats; int i, first_tx_fail_idx, tx_count_1, tx_count_2; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BALANCE, 0, - TEST_BAL_SLAVE_TX_FAIL_SLAVE_COUNT, 1), + TEST_BAL_MEMBER_TX_FAIL_MEMBER_COUNT, 1), "Failed to initialise bonded device"); TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set( @@ -3033,46 +3055,48 @@ test_balance_tx_burst_slave_tx_fail(void) /* Generate test bursts for transmission */ TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst_1, - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1, 0, 0, 0, 0, 0), - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1, + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1, 0, 0, 0, 0, 0), + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1, "Failed to generate test packet burst 1"); - first_tx_fail_idx = TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT; + first_tx_fail_idx = TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT; /* copy mbuf references for expected transmission failures */ - for (i = 0; i < TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT; i++) + for (i = 0; i < TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT; i++) expected_fail_pkts[i] = pkts_burst_1[i + first_tx_fail_idx]; TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst_2, - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2, 0, 0, 1, 0, 0), - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2, + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2, 0, 0, 1, 0, 0), + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2, "Failed to generate test packet burst 2"); - /* Set virtual slave TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX to only fail - * transmission of TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT packets of burst */ + /* + * Set virtual member TEST_BAL_MEMBER_TX_FAIL_FAILING_MEMBER_IDX to only fail + * transmission of TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT packets of burst. + */ virtual_ethdev_tx_burst_fn_set_success( - test_params->slave_port_ids[TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX], + test_params->member_port_ids[TEST_BAL_MEMBER_TX_FAIL_FAILING_MEMBER_IDX], 0); virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count( - test_params->slave_port_ids[TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX], - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT); + test_params->member_port_ids[TEST_BAL_MEMBER_TX_FAIL_FAILING_MEMBER_IDX], + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT); /* Transmit burst 1 */ tx_count_1 = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst_1, - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1); + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1); - TEST_ASSERT_EQUAL(tx_count_1, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, + TEST_ASSERT_EQUAL(tx_count_1, TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT, "Transmitted (%d) packets, expected to transmit (%d) packets", - tx_count_1, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT); + tx_count_1, TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT); /* Verify that failed packet are expected failed packets */ - for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) { + for (i = 0; i < TEST_RR_MEMBER_TX_FAIL_PACKETS_COUNT; i++) { TEST_ASSERT_EQUAL(expected_fail_pkts[i], pkts_burst_1[i + tx_count_1], "expected mbuf (%d) pointer %p not expected pointer %p", i, expected_fail_pkts[i], pkts_burst_1[i + tx_count_1]); @@ -3080,94 +3104,94 @@ test_balance_tx_burst_slave_tx_fail(void) /* Transmit burst 2 */ tx_count_2 = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst_2, - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2); + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2); - TEST_ASSERT_EQUAL(tx_count_2, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2, + TEST_ASSERT_EQUAL(tx_count_2, TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2, "Transmitted (%d) packets, expected to transmit (%d) packets", - tx_count_2, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2); + tx_count_2, TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2); /* Verify bonded port tx stats */ rte_eth_stats_get(test_params->bonded_port_id, &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)((TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT) + - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2), + (uint64_t)((TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT) + + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2), "Bonded Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - (TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT) + - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2); + (TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT) + + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2); - /* Verify slave ports tx stats */ + /* Verify member ports tx stats */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t) - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.opackets, - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 - - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT); + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_1 - + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2, - "Slave Port (%d) opackets value (%u) not as expected (%d)", - test_params->slave_port_ids[1], + (uint64_t)TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2, + "Member Port (%d) opackets value (%u) not as expected (%d)", + test_params->member_port_ids[1], (unsigned int)port_stats.opackets, - TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2); + TEST_BAL_MEMBER_TX_FAIL_BURST_SIZE_2); /* Verify that all mbufs have a ref value of zero */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst_1[tx_count_1], - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, 1), + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); free_mbufs(&pkts_burst_1[tx_count_1], - TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT); + TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_BALANCE_RX_BURST_SLAVE_COUNT (3) +#define TEST_BALANCE_RX_BURST_MEMBER_COUNT (3) static int test_balance_rx_burst(void) { - struct rte_mbuf *gen_pkt_burst[TEST_BALANCE_RX_BURST_SLAVE_COUNT][MAX_PKT_BURST]; + struct rte_mbuf *gen_pkt_burst[TEST_BALANCE_RX_BURST_MEMBER_COUNT][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - int burst_size[TEST_BALANCE_RX_BURST_SLAVE_COUNT] = { 10, 5, 30 }; + int burst_size[TEST_BALANCE_RX_BURST_MEMBER_COUNT] = { 10, 5, 30 }; int i, j; memset(gen_pkt_burst, 0, sizeof(gen_pkt_burst)); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BALANCE, 0, 3, 1), "Failed to initialise bonded device"); /* Generate test bursts of packets to transmit */ - for (i = 0; i < TEST_BALANCE_RX_BURST_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_BALANCE_RX_BURST_MEMBER_COUNT; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[i][0], burst_size[i], 0, 0, 1, 0, 0), burst_size[i], "failed to generate packet burst"); } - /* Add rx data to slaves */ - for (i = 0; i < TEST_BALANCE_RX_BURST_SLAVE_COUNT; i++) { - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + /* Add rx data to members */ + for (i = 0; i < TEST_BALANCE_RX_BURST_MEMBER_COUNT; i++) { + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[i][0], burst_size[i]); } @@ -3187,33 +3211,33 @@ test_balance_rx_burst(void) burst_size[0] + burst_size[1] + burst_size[2]); - /* Verify bonded slave devices rx counts */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + /* Verify bonded member devices rx counts */ + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[0], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.ipackets, burst_size[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[1], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[1], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[1], (unsigned int)port_stats.ipackets, burst_size[1]); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[2], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[2], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[2], (unsigned int)port_stats.ipackets, burst_size[2]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[3], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[3], (unsigned int)port_stats.ipackets, 0); /* free mbufs */ - for (i = 0; i < TEST_BALANCE_RX_BURST_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_BALANCE_RX_BURST_MEMBER_COUNT; i++) { for (j = 0; j < MAX_PKT_BURST; j++) { if (gen_pkt_burst[i][j] != NULL) { rte_pktmbuf_free(gen_pkt_burst[i][j]); @@ -3222,8 +3246,8 @@ test_balance_rx_burst(void) } } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -3232,8 +3256,8 @@ test_balance_verify_promiscuous_enable_disable(void) int i; int ret; - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BALANCE, 0, 4, 1), "Failed to initialise bonded device"); @@ -3246,11 +3270,11 @@ test_balance_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not enabled", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { TEST_ASSERT_EQUAL(rte_eth_promiscuous_get( - test_params->slave_port_ids[i]), 1, + test_params->member_port_ids[i]), 1, "Port (%d) promiscuous mode not enabled", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } ret = rte_eth_promiscuous_disable(test_params->bonded_port_id); @@ -3262,15 +3286,15 @@ test_balance_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not disabled", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { TEST_ASSERT_EQUAL(rte_eth_promiscuous_get( - test_params->slave_port_ids[i]), 0, + test_params->member_port_ids[i]), 0, "Port (%d) promiscuous mode not disabled", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -3279,19 +3303,21 @@ test_balance_verify_mac_assignment(void) struct rte_ether_addr read_mac_addr; struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], + &expected_mac_addr_0), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1), + test_params->member_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], + &expected_mac_addr_1), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - /* Initialize bonded device with 2 slaves in active backup mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 2 members in active backup mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BALANCE, 0, 2, 1), "Failed to initialise bonded device"); - /* Verify that bonded MACs is that of first slave and that the other slave + /* Verify that bonded MACs is that of first member and that the other member * MAC hasn't been changed */ TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), "Failed to get mac address (port %d)", @@ -3301,27 +3327,27 @@ test_balance_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[1]); /* change primary and verify that MAC addresses haven't changed */ TEST_ASSERT_SUCCESS(rte_eth_bond_primary_set(test_params->bonded_port_id, - test_params->slave_port_ids[1]), + test_params->member_port_ids[1]), "Failed to set bonded port (%d) primary port to (%d)\n", - test_params->bonded_port_id, test_params->slave_port_ids[1]); + test_params->bonded_port_id, test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), "Failed to get mac address (port %d)", @@ -3331,24 +3357,26 @@ test_balance_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[1]); - /* stop / start bonded device and verify that primary MAC address is - * propagated to bonded device and slaves */ + /* + * stop / start bonded device and verify that primary MAC address is + * propagated to bonded device and members. + */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), "Failed to stop bonded port %u", @@ -3365,21 +3393,21 @@ test_balance_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[1]); /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( @@ -3395,44 +3423,44 @@ test_balance_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of bonded port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected\n", - test_params->slave_port_ids[0]); + "member port (%d) mac address not as expected\n", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of bonded port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of bonded port", + test_params->member_port_ids[1]); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_BALANCE_LINK_STATUS_SLAVE_COUNT (4) +#define TEST_BALANCE_LINK_STATUS_MEMBER_COUNT (4) static int -test_balance_verify_slave_link_status_change_behaviour(void) +test_balance_verify_member_link_status_change_behaviour(void) { - struct rte_mbuf *pkt_burst[TEST_BALANCE_LINK_STATUS_SLAVE_COUNT][MAX_PKT_BURST]; + struct rte_mbuf *pkt_burst[TEST_BALANCE_LINK_STATUS_MEMBER_COUNT][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - int i, burst_size, slave_count; + int i, burst_size, member_count; memset(pkt_burst, 0, sizeof(pkt_burst)); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( - BONDING_MODE_BALANCE, 0, TEST_BALANCE_LINK_STATUS_SLAVE_COUNT, 1), + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( + BONDING_MODE_BALANCE, 0, TEST_BALANCE_LINK_STATUS_MEMBER_COUNT, 1), "Failed to initialise bonded device"); TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set( @@ -3440,32 +3468,34 @@ test_balance_verify_slave_link_status_change_behaviour(void) "Failed to set balance xmit policy."); - /* Verify Current Slaves Count /Active Slave Count is */ - slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, slaves, + /* Verify Current Members Count /Active Member Count is */ + member_count = rte_eth_bond_members_get(test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, TEST_BALANCE_LINK_STATUS_SLAVE_COUNT, - "Number of slaves (%d) is not as expected (%d).", - slave_count, TEST_BALANCE_LINK_STATUS_SLAVE_COUNT); + TEST_ASSERT_EQUAL(member_count, TEST_BALANCE_LINK_STATUS_MEMBER_COUNT, + "Number of members (%d) is not as expected (%d).", + member_count, TEST_BALANCE_LINK_STATUS_MEMBER_COUNT); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, TEST_BALANCE_LINK_STATUS_SLAVE_COUNT, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, TEST_BALANCE_LINK_STATUS_SLAVE_COUNT); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, TEST_BALANCE_LINK_STATUS_MEMBER_COUNT, + "Number of active members (%d) is not as expected (%d).", + member_count, TEST_BALANCE_LINK_STATUS_MEMBER_COUNT); - /* Set 2 slaves link status to down */ + /* Set 2 members link status to down */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 0); + test_params->member_port_ids[1], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 0); + test_params->member_port_ids[3], 0); - TEST_ASSERT_EQUAL(rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS), 2, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 2); + TEST_ASSERT_EQUAL(rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS), 2, + "Number of active members (%d) is not as expected (%d).", + member_count, 2); - /* Send to sets of packet burst and verify that they are balanced across - * slaves */ + /* + * Send to sets of packet burst and verify that they are balanced across + * members. + */ burst_size = 21; TEST_ASSERT_EQUAL(generate_test_burst( @@ -3491,27 +3521,27 @@ test_balance_verify_slave_link_status_change_behaviour(void) test_params->bonded_port_id, (int)port_stats.opackets, burst_size + burst_size); - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, "(%d) port_stats.opackets (%d) not as expected (%d).", - test_params->slave_port_ids[0], (int)port_stats.opackets, + test_params->member_port_ids[0], (int)port_stats.opackets, burst_size); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, "(%d) port_stats.opackets (%d) not as expected (%d).", - test_params->slave_port_ids[2], (int)port_stats.opackets, + test_params->member_port_ids[2], (int)port_stats.opackets, burst_size); - /* verify that all packets get send on primary slave when no other slaves + /* verify that all packets get send on primary member when no other members * are available */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[2], 0); + test_params->member_port_ids[2], 0); - TEST_ASSERT_EQUAL(rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS), 1, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 1); + TEST_ASSERT_EQUAL(rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS), 1, + "Number of active members (%d) is not as expected (%d).", + member_count, 1); TEST_ASSERT_EQUAL(generate_test_burst( &pkt_burst[1][0], burst_size, 0, 1, 1, 0, 0), burst_size, @@ -3528,31 +3558,31 @@ test_balance_verify_slave_link_status_change_behaviour(void) test_params->bonded_port_id, (int)port_stats.opackets, burst_size + burst_size + burst_size); - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)(burst_size + burst_size), "(%d) port_stats.opackets (%d) not as expected (%d).", - test_params->slave_port_ids[0], (int)port_stats.opackets, + test_params->member_port_ids[0], (int)port_stats.opackets, burst_size + burst_size); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[0], 0); + test_params->member_port_ids[0], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 1); + test_params->member_port_ids[1], 1); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[2], 1); + test_params->member_port_ids[2], 1); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 1); + test_params->member_port_ids[3], 1); - for (i = 0; i < TEST_BALANCE_LINK_STATUS_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_BALANCE_LINK_STATUS_MEMBER_COUNT; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &pkt_burst[i][0], burst_size, 0, 1, 0, 0, 0), burst_size, "Failed to generate packet burst"); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &pkt_burst[i][0], burst_size); } - /* Verify that pkts are not received on slaves with link status down */ + /* Verify that pkts are not received on members with link status down */ rte_eth_rx_burst(test_params->bonded_port_id, 0, rx_pkt_burst, MAX_PKT_BURST); @@ -3564,8 +3594,8 @@ test_balance_verify_slave_link_status_change_behaviour(void) test_params->bonded_port_id, (int)port_stats.ipackets, burst_size * 3); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -3576,7 +3606,7 @@ test_broadcast_tx_burst(void) struct rte_eth_stats port_stats; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BROADCAST, 0, 2, 1), "Failed to initialise bonded device"); @@ -3590,7 +3620,7 @@ test_broadcast_tx_burst(void) pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, dst_addr_0, pktlen); - burst_size = 20 * test_params->bonded_slave_count; + burst_size = 20 * test_params->bonded_member_count; TEST_ASSERT(burst_size < MAX_PKT_BURST, "Burst size specified is greater than supported."); @@ -3611,25 +3641,25 @@ test_broadcast_tx_burst(void) /* Verify bonded port tx stats */ rte_eth_stats_get(test_params->bonded_port_id, &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)burst_size * test_params->bonded_slave_count, + (uint64_t)burst_size * test_params->bonded_member_count, "Bonded Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, burst_size); - /* Verify slave ports tx stats */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats); + /* Verify member ports tx stats */ + for (i = 0; i < test_params->bonded_member_count; i++) { + rte_eth_stats_get(test_params->member_port_ids[i], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, - "Slave Port (%d) opackets value (%u) not as expected (%d)\n", + "Member Port (%d) opackets value (%u) not as expected (%d)\n", test_params->bonded_port_id, (unsigned int)port_stats.opackets, burst_size); } - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ @@ -3637,159 +3667,161 @@ test_broadcast_tx_burst(void) test_params->bonded_port_id, 0, pkts_burst, burst_size), 0, "transmitted an unexpected number of packets"); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT (3) -#define TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE (40) -#define TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT (15) -#define TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT (10) +#define TEST_BCAST_MEMBER_TX_FAIL_MEMBER_COUNT (3) +#define TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE (40) +#define TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT (15) +#define TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT (10) static int -test_broadcast_tx_burst_slave_tx_fail(void) +test_broadcast_tx_burst_member_tx_fail(void) { - struct rte_mbuf *pkts_burst[TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE]; - struct rte_mbuf *expected_fail_pkts[TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT]; + struct rte_mbuf *pkts_burst[TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE]; + struct rte_mbuf *expected_fail_pkts[TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT]; struct rte_eth_stats port_stats; int i, tx_count; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BROADCAST, 0, - TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT, 1), + TEST_BCAST_MEMBER_TX_FAIL_MEMBER_COUNT, 1), "Failed to initialise bonded device"); /* Generate test bursts for transmission */ TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst, - TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE, 0, 0, 0, 0, 0), - TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE, + TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE, 0, 0, 0, 0, 0), + TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE, "Failed to generate test packet burst"); - for (i = 0; i < TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT; i++) { - expected_fail_pkts[i] = pkts_burst[TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT + i]; + for (i = 0; i < TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT; i++) { + expected_fail_pkts[i] = pkts_burst[TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT + i]; } - /* Set virtual slave TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX to only fail - * transmission of TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT packets of burst */ + /* + * Set virtual member TEST_BAL_MEMBER_TX_FAIL_FAILING_MEMBER_IDX to only fail + * transmission of TEST_BAL_MEMBER_TX_FAIL_PACKETS_COUNT packets of burst. + */ virtual_ethdev_tx_burst_fn_set_success( - test_params->slave_port_ids[0], + test_params->member_port_ids[0], 0); virtual_ethdev_tx_burst_fn_set_success( - test_params->slave_port_ids[1], + test_params->member_port_ids[1], 0); virtual_ethdev_tx_burst_fn_set_success( - test_params->slave_port_ids[2], + test_params->member_port_ids[2], 0); virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count( - test_params->slave_port_ids[0], - TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT); + test_params->member_port_ids[0], + TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT); virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count( - test_params->slave_port_ids[1], - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT); + test_params->member_port_ids[1], + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT); virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count( - test_params->slave_port_ids[2], - TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT); + test_params->member_port_ids[2], + TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT); /* Transmit burst */ tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst, - TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE); + TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE); - TEST_ASSERT_EQUAL(tx_count, TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT, + TEST_ASSERT_EQUAL(tx_count, TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT, "Transmitted (%d) packets, expected to transmit (%d) packets", - tx_count, TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT); + tx_count, TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT); /* Verify that failed packet are expected failed packets */ - for (i = 0; i < TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT; i++) { + for (i = 0; i < TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT; i++) { TEST_ASSERT_EQUAL(expected_fail_pkts[i], pkts_burst[i + tx_count], "expected mbuf (%d) pointer %p not expected pointer %p", i, expected_fail_pkts[i], pkts_burst[i + tx_count]); } - /* Verify slave ports tx stats */ + /* Verify member ports tx stats */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT, + (uint64_t)TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT, "Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT); + TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT, + (uint64_t)TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT, "Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT); + TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, - (uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT, + (uint64_t)TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT, "Port (%d) opackets value (%u) not as expected (%d)", test_params->bonded_port_id, (unsigned int)port_stats.opackets, - TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE - - TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT); + TEST_BCAST_MEMBER_TX_FAIL_BURST_SIZE - + TEST_BCAST_MEMBER_TX_FAIL_MAX_PACKETS_COUNT); /* Verify that all mbufs who transmission failed have a ref value of one */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst[tx_count], - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT, 1), + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); free_mbufs(&pkts_burst[tx_count], - TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT); + TEST_BCAST_MEMBER_TX_FAIL_MIN_PACKETS_COUNT); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define BROADCAST_RX_BURST_NUM_OF_SLAVES (3) +#define BROADCAST_RX_BURST_NUM_OF_MEMBERS (3) static int test_broadcast_rx_burst(void) { - struct rte_mbuf *gen_pkt_burst[BROADCAST_RX_BURST_NUM_OF_SLAVES][MAX_PKT_BURST]; + struct rte_mbuf *gen_pkt_burst[BROADCAST_RX_BURST_NUM_OF_MEMBERS][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - int burst_size[BROADCAST_RX_BURST_NUM_OF_SLAVES] = { 10, 5, 30 }; + int burst_size[BROADCAST_RX_BURST_NUM_OF_MEMBERS] = { 10, 5, 30 }; int i, j; memset(gen_pkt_burst, 0, sizeof(gen_pkt_burst)); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BROADCAST, 0, 3, 1), "Failed to initialise bonded device"); /* Generate test bursts of packets to transmit */ - for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_SLAVES; i++) { + for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_MEMBERS; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[i][0], burst_size[i], 0, 0, 1, 0, 0), burst_size[i], "failed to generate packet burst"); } - /* Add rx data to slave 0 */ - for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_SLAVES; i++) { - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + /* Add rx data to member 0 */ + for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_MEMBERS; i++) { + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[i][0], burst_size[i]); } @@ -3810,33 +3842,33 @@ test_broadcast_rx_burst(void) burst_size[0] + burst_size[1] + burst_size[2]); - /* Verify bonded slave devices rx counts */ - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + /* Verify bonded member devices rx counts */ + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[0], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.ipackets, burst_size[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[1], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[0], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[0], (unsigned int)port_stats.ipackets, burst_size[1]); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size[2], - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[2], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[2], (unsigned int)port_stats.ipackets, burst_size[2]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as expected (%d)", - test_params->slave_port_ids[3], (unsigned int)port_stats.ipackets, + "Member Port (%d) ipackets value (%u) not as expected (%d)", + test_params->member_port_ids[3], (unsigned int)port_stats.ipackets, 0); /* free mbufs allocate for rx testing */ - for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_SLAVES; i++) { + for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_MEMBERS; i++) { for (j = 0; j < MAX_PKT_BURST; j++) { if (gen_pkt_burst[i][j] != NULL) { rte_pktmbuf_free(gen_pkt_burst[i][j]); @@ -3845,8 +3877,8 @@ test_broadcast_rx_burst(void) } } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -3855,8 +3887,8 @@ test_broadcast_verify_promiscuous_enable_disable(void) int i; int ret; - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BROADCAST, 0, 4, 1), "Failed to initialise bonded device"); @@ -3870,11 +3902,11 @@ test_broadcast_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not enabled", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { TEST_ASSERT_EQUAL(rte_eth_promiscuous_get( - test_params->slave_port_ids[i]), 1, + test_params->member_port_ids[i]), 1, "Port (%d) promiscuous mode not enabled", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } ret = rte_eth_promiscuous_disable(test_params->bonded_port_id); @@ -3886,15 +3918,15 @@ test_broadcast_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not disabled", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { TEST_ASSERT_EQUAL(rte_eth_promiscuous_get( - test_params->slave_port_ids[i]), 0, + test_params->member_port_ids[i]), 0, "Port (%d) promiscuous mode not disabled", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -3905,49 +3937,55 @@ test_broadcast_verify_mac_assignment(void) int i; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], + &expected_mac_addr_0), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_1), + test_params->member_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[2], + &expected_mac_addr_1), "Failed to get mac address (port %d)", - test_params->slave_port_ids[2]); + test_params->member_port_ids[2]); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_BROADCAST, 0, 4, 1), "Failed to initialise bonded device"); - /* Verify that all MACs are the same as first slave added to bonded + /* Verify that all MACs are the same as first member added to bonded * device */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[i]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[i]); } /* change primary and verify that MAC addresses haven't changed */ TEST_ASSERT_SUCCESS(rte_eth_bond_primary_set(test_params->bonded_port_id, - test_params->slave_port_ids[2]), + test_params->member_port_ids[2]), "Failed to set bonded port (%d) primary port to (%d)", - test_params->bonded_port_id, test_params->slave_port_ids[i]); + test_params->bonded_port_id, test_params->member_port_ids[i]); - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address has changed to that of primary " + "member port (%d) mac address has changed to that of primary " "port without stop/start toggle of bonded device", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); } - /* stop / start bonded device and verify that primary MAC address is - * propagated to bonded device and slaves */ + /* + * stop / start bonded device and verify that primary MAC address is + * propagated to bonded device and members. + */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), "Failed to stop bonded port %u", @@ -3962,16 +4000,17 @@ test_broadcast_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of new primary " - "port", test_params->slave_port_ids[i]); + "member port (%d) mac address not set to that of new primary " + "port", test_params->member_port_ids[i]); } /* Set explicit MAC address */ @@ -3986,71 +4025,72 @@ test_broadcast_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); - for (i = 0; i < test_params->bonded_slave_count; i++) { - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + for (i = 0; i < test_params->bonded_member_count; i++) { + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[i], + &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of new primary " - "port", test_params->slave_port_ids[i]); + "member port (%d) mac address not set to that of new primary " + "port", test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define BROADCAST_LINK_STATUS_NUM_OF_SLAVES (4) +#define BROADCAST_LINK_STATUS_NUM_OF_MEMBERS (4) static int -test_broadcast_verify_slave_link_status_change_behaviour(void) +test_broadcast_verify_member_link_status_change_behaviour(void) { - struct rte_mbuf *pkt_burst[BROADCAST_LINK_STATUS_NUM_OF_SLAVES][MAX_PKT_BURST]; + struct rte_mbuf *pkt_burst[BROADCAST_LINK_STATUS_NUM_OF_MEMBERS][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - int i, burst_size, slave_count; + int i, burst_size, member_count; memset(pkt_burst, 0, sizeof(pkt_burst)); - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( - BONDING_MODE_BROADCAST, 0, BROADCAST_LINK_STATUS_NUM_OF_SLAVES, + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( + BONDING_MODE_BROADCAST, 0, BROADCAST_LINK_STATUS_NUM_OF_MEMBERS, 1), "Failed to initialise bonded device"); - /* Verify Current Slaves Count /Active Slave Count is */ - slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, slaves, + /* Verify Current Members Count /Active Member Count is */ + member_count = rte_eth_bond_members_get(test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 4, - "Number of slaves (%d) is not as expected (%d).", - slave_count, 4); + TEST_ASSERT_EQUAL(member_count, 4, + "Number of members (%d) is not as expected (%d).", + member_count, 4); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 4, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 4); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, 4, + "Number of active members (%d) is not as expected (%d).", + member_count, 4); - /* Set 2 slaves link status to down */ + /* Set 2 members link status to down */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 0); + test_params->member_port_ids[1], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 0); + test_params->member_port_ids[3], 0); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 2, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 2); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, 2, + "Number of active members (%d) is not as expected (%d).", + member_count, 2); - for (i = 0; i < test_params->bonded_slave_count; i++) - rte_eth_stats_reset(test_params->slave_port_ids[i]); + for (i = 0; i < test_params->bonded_member_count; i++) + rte_eth_stats_reset(test_params->member_port_ids[i]); - /* Verify that pkts are not sent on slaves with link status down */ + /* Verify that pkts are not sent on members with link status down */ burst_size = 21; TEST_ASSERT_EQUAL(generate_test_burst( @@ -4062,43 +4102,43 @@ test_broadcast_verify_slave_link_status_change_behaviour(void) "rte_eth_tx_burst failed\n"); rte_eth_stats_get(test_params->bonded_port_id, &port_stats); - TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)(burst_size * slave_count), + TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)(burst_size * member_count), "(%d) port_stats.opackets (%d) not as expected (%d)\n", test_params->bonded_port_id, (int)port_stats.opackets, - burst_size * slave_count); + burst_size * member_count); - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[2]); + test_params->member_port_ids[2]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, 0, "(%d) port_stats.opackets not as expected", - test_params->slave_port_ids[3]); + test_params->member_port_ids[3]); - for (i = 0; i < BROADCAST_LINK_STATUS_NUM_OF_SLAVES; i++) { + for (i = 0; i < BROADCAST_LINK_STATUS_NUM_OF_MEMBERS; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &pkt_burst[i][0], burst_size, 0, 0, 1, 0, 0), burst_size, "failed to generate packet burst"); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &pkt_burst[i][0], burst_size); } - /* Verify that pkts are not received on slaves with link status down */ + /* Verify that pkts are not received on members with link status down */ TEST_ASSERT_EQUAL(rte_eth_rx_burst( test_params->bonded_port_id, 0, rx_pkt_burst, MAX_PKT_BURST), burst_size + burst_size, "rte_eth_rx_burst failed"); @@ -4110,8 +4150,8 @@ test_broadcast_verify_slave_link_status_change_behaviour(void) "(%d) port_stats.ipackets not as expected\n", test_params->bonded_port_id); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -4146,21 +4186,21 @@ testsuite_teardown(void) free(test_params->pkt_eth_hdr); test_params->pkt_eth_hdr = NULL; - /* Clean up and remove slaves from bonded device */ - remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + remove_members_and_stop_bonded_device(); } static void free_virtualpmd_tx_queue(void) { - int i, slave_port, to_free_cnt; + int i, member_port, to_free_cnt; struct rte_mbuf *pkts_to_free[MAX_PKT_BURST]; /* Free tx queue of virtual pmd */ - for (slave_port = 0; slave_port < test_params->bonded_slave_count; - slave_port++) { + for (member_port = 0; member_port < test_params->bonded_member_count; + member_port++) { to_free_cnt = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_port], + test_params->member_port_ids[member_port], pkts_to_free, MAX_PKT_BURST); for (i = 0; i < to_free_cnt; i++) rte_pktmbuf_free(pkts_to_free[i]); @@ -4177,11 +4217,11 @@ test_tlb_tx_burst(void) uint64_t sum_ports_opackets = 0, all_bond_opackets = 0, all_bond_obytes = 0; uint16_t pktlen; - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members (BONDING_MODE_TLB, 1, 3, 1), "Failed to initialise bonded device"); - burst_size = 20 * test_params->bonded_slave_count; + burst_size = 20 * test_params->bonded_member_count; TEST_ASSERT(burst_size < MAX_PKT_BURST, "Burst size specified is greater than supported.\n"); @@ -4197,7 +4237,7 @@ test_tlb_tx_burst(void) RTE_ETHER_TYPE_IPV4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, - (struct rte_ether_addr *)test_params->default_slave_mac, + (struct rte_ether_addr *)test_params->default_member_mac, (struct rte_ether_addr *)dst_mac_0, RTE_ETHER_TYPE_IPV4, 0, 0); } @@ -4234,26 +4274,26 @@ test_tlb_tx_burst(void) burst_size); - /* Verify slave ports tx stats */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats[i]); + /* Verify member ports tx stats */ + for (i = 0; i < test_params->bonded_member_count; i++) { + rte_eth_stats_get(test_params->member_port_ids[i], &port_stats[i]); sum_ports_opackets += port_stats[i].opackets; } TEST_ASSERT_EQUAL(sum_ports_opackets, (uint64_t)all_bond_opackets, - "Total packets sent by slaves is not equal to packets sent by bond interface"); + "Total packets sent by members is not equal to packets sent by bond interface"); - /* checking if distribution of packets is balanced over slaves */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* checking if distribution of packets is balanced over members */ + for (i = 0; i < test_params->bonded_member_count; i++) { TEST_ASSERT(port_stats[i].obytes > 0 && port_stats[i].obytes < all_bond_obytes, - "Packets are not balanced over slaves"); + "Packets are not balanced over members"); } - /* Put all slaves down and try and transmit */ - for (i = 0; i < test_params->bonded_slave_count; i++) { + /* Put all members down and try and transmit */ + for (i = 0; i < test_params->bonded_member_count; i++) { virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[i], 0); + test_params->member_port_ids[i], 0); } /* Send burst on bonded port */ @@ -4261,11 +4301,11 @@ test_tlb_tx_burst(void) burst_size); TEST_ASSERT_EQUAL(nb_tx, 0, " bad number of packet in burst"); - /* Clean ugit checkout masterp and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean ugit checkout masterp and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT (4) +#define TEST_ADAPTIVE_TLB_RX_BURST_MEMBER_COUNT (4) static int test_tlb_rx_burst(void) @@ -4279,26 +4319,26 @@ test_tlb_rx_burst(void) uint16_t i, j, nb_rx, burst_size = 17; - /* Initialize bonded device with 4 slaves in transmit load balancing mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in transmit load balancing mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_TLB, - TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT, 1, 1), + TEST_ADAPTIVE_TLB_RX_BURST_MEMBER_COUNT, 1, 1), "Failed to initialize bonded device"); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); TEST_ASSERT(primary_port >= 0, - "failed to get primary slave for bonded port (%d)", + "failed to get primary member for bonded port (%d)", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { /* Generate test bursts of packets to transmit */ TEST_ASSERT_EQUAL(generate_test_burst( &gen_pkt_burst[0], burst_size, 0, 1, 0, 0, 0), burst_size, "burst generation failed"); - /* Add rx data to slave */ - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], + /* Add rx data to member */ + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i], &gen_pkt_burst[0], burst_size); /* Call rx burst on bonded device */ @@ -4307,7 +4347,7 @@ test_tlb_rx_burst(void) TEST_ASSERT_EQUAL(nb_rx, burst_size, "rte_eth_rx_burst failed\n"); - if (test_params->slave_port_ids[i] == primary_port) { + if (test_params->member_port_ids[i] == primary_port) { /* Verify bonded device rx count */ rte_eth_stats_get(test_params->bonded_port_id, &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, @@ -4315,27 +4355,27 @@ test_tlb_rx_burst(void) test_params->bonded_port_id, (unsigned int)port_stats.ipackets, burst_size); - /* Verify bonded slave devices rx count */ - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); + /* Verify bonded member devices rx count */ + for (j = 0; j < test_params->bonded_member_count; j++) { + rte_eth_stats_get(test_params->member_port_ids[j], &port_stats); if (i == j) { TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, - "Slave Port (%d) ipackets value (%u) not as expected (%d)\n", - test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as expected (%d)\n", + test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, burst_size); } else { TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)0, - "Slave Port (%d) ipackets value (%u) not as expected (%d)\n", - test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as expected (%d)\n", + test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, 0); } } } else { - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); + for (j = 0; j < test_params->bonded_member_count; j++) { + rte_eth_stats_get(test_params->member_port_ids[j], &port_stats); TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)0, - "Slave Port (%d) ipackets value (%u) not as expected (%d)\n", - test_params->slave_port_ids[i], + "Member Port (%d) ipackets value (%u) not as expected (%d)\n", + test_params->member_port_ids[i], (unsigned int)port_stats.ipackets, 0); } } @@ -4348,8 +4388,8 @@ test_tlb_rx_burst(void) rte_eth_stats_reset(test_params->bonded_port_id); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -4358,14 +4398,14 @@ test_tlb_verify_promiscuous_enable_disable(void) int i, primary_port, promiscuous_en; int ret; - /* Initialize bonded device with 4 slaves in transmit load balancing mode */ - TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in transmit load balancing mode */ + TEST_ASSERT_SUCCESS( initialize_bonded_device_with_members( BONDING_MODE_TLB, 0, 4, 1), "Failed to initialize bonded device"); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); TEST_ASSERT(primary_port >= 0, - "failed to get primary slave for bonded port (%d)", + "failed to get primary member for bonded port (%d)", test_params->bonded_port_id); ret = rte_eth_promiscuous_enable(test_params->bonded_port_id); @@ -4377,10 +4417,10 @@ test_tlb_verify_promiscuous_enable_disable(void) TEST_ASSERT_EQUAL(promiscuous_en, (int)1, "Port (%d) promiscuous mode not enabled\n", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { promiscuous_en = rte_eth_promiscuous_get( - test_params->slave_port_ids[i]); - if (primary_port == test_params->slave_port_ids[i]) { + test_params->member_port_ids[i]); + if (primary_port == test_params->member_port_ids[i]) { TEST_ASSERT_EQUAL(promiscuous_en, (int)1, "Port (%d) promiscuous mode not enabled\n", test_params->bonded_port_id); @@ -4402,16 +4442,16 @@ test_tlb_verify_promiscuous_enable_disable(void) "Port (%d) promiscuous mode not disabled\n", test_params->bonded_port_id); - for (i = 0; i < test_params->bonded_slave_count; i++) { + for (i = 0; i < test_params->bonded_member_count; i++) { promiscuous_en = rte_eth_promiscuous_get( - test_params->slave_port_ids[i]); + test_params->member_port_ids[i]); TEST_ASSERT_EQUAL(promiscuous_en, (int)0, - "slave port (%d) promiscuous mode not disabled\n", - test_params->slave_port_ids[i]); + "member port (%d) promiscuous mode not disabled\n", + test_params->member_port_ids[i]); } - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int @@ -4420,20 +4460,24 @@ test_tlb_verify_mac_assignment(void) struct rte_ether_addr read_mac_addr; struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], + &expected_mac_addr_0), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1), + test_params->member_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], + &expected_mac_addr_1), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - /* Initialize bonded device with 2 slaves in active backup mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 2 members in active backup mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_TLB, 0, 2, 1), "Failed to initialize bonded device"); - /* Verify that bonded MACs is that of first slave and that the other slave - * MAC hasn't been changed */ + /* + * Verify that bonded MACs is that of first member and that the other member + * MAC hasn't been changed. + */ TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), "Failed to get mac address (port %d)", test_params->bonded_port_id); @@ -4442,27 +4486,27 @@ test_tlb_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[1]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[1]); /* change primary and verify that MAC addresses haven't changed */ TEST_ASSERT_EQUAL(rte_eth_bond_primary_set(test_params->bonded_port_id, - test_params->slave_port_ids[1]), 0, + test_params->member_port_ids[1]), 0, "Failed to set bonded port (%d) primary port to (%d)", - test_params->bonded_port_id, test_params->slave_port_ids[1]); + test_params->bonded_port_id, test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), "Failed to get mac address (port %d)", @@ -4472,24 +4516,26 @@ test_tlb_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[0]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[1]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[1]); - /* stop / start bonded device and verify that primary MAC address is - * propagated to bonded device and slaves */ + /* + * stop / start bonded device and verify that primary MAC address is + * propagated to bonded device and members. + */ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id), "Failed to stop bonded port %u", @@ -4506,21 +4552,21 @@ test_tlb_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[0]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of primary port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of primary port", + test_params->member_port_ids[1]); /* Set explicit MAC address */ @@ -4537,36 +4583,36 @@ test_tlb_verify_mac_assignment(void) "bonded port (%d) mac address not set to that of bonded port", test_params->bonded_port_id); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[0], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not as expected", - test_params->slave_port_ids[0]); + "member port (%d) mac address not as expected", + test_params->member_port_ids[0]); - TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->member_port_ids[1], &read_mac_addr), "Failed to get mac address (port %d)", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), - "slave port (%d) mac address not set to that of bonded port", - test_params->slave_port_ids[1]); + "member port (%d) mac address not set to that of bonded port", + test_params->member_port_ids[1]); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } static int -test_tlb_verify_slave_link_status_change_failover(void) +test_tlb_verify_member_link_status_change_failover(void) { - struct rte_mbuf *pkt_burst[TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT][MAX_PKT_BURST]; + struct rte_mbuf *pkt_burst[TEST_ADAPTIVE_TLB_RX_BURST_MEMBER_COUNT][MAX_PKT_BURST]; struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; - int i, burst_size, slave_count, primary_port; + int i, burst_size, member_count, primary_port; burst_size = 21; @@ -4574,61 +4620,63 @@ test_tlb_verify_slave_link_status_change_failover(void) - /* Initialize bonded device with 4 slaves in round robin mode */ - TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( + /* Initialize bonded device with 4 members in round robin mode */ + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_members( BONDING_MODE_TLB, 0, - TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT, 1), - "Failed to initialize bonded device with slaves"); + TEST_ADAPTIVE_TLB_RX_BURST_MEMBER_COUNT, 1), + "Failed to initialize bonded device with members"); - /* Verify Current Slaves Count /Active Slave Count is */ - slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, slaves, + /* Verify Current Members Count /Active Member Count is */ + member_count = rte_eth_bond_members_get(test_params->bonded_port_id, members, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, 4, - "Number of slaves (%d) is not as expected (%d).\n", - slave_count, 4); + TEST_ASSERT_EQUAL(member_count, 4, + "Number of members (%d) is not as expected (%d).\n", + member_count, 4); - slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id, - slaves, RTE_MAX_ETHPORTS); - TEST_ASSERT_EQUAL(slave_count, (int)4, - "Number of slaves (%d) is not as expected (%d).\n", - slave_count, 4); + member_count = rte_eth_bond_active_members_get(test_params->bonded_port_id, + members, RTE_MAX_ETHPORTS); + TEST_ASSERT_EQUAL(member_count, 4, + "Number of members (%d) is not as expected (%d).\n", + member_count, 4); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); - TEST_ASSERT_EQUAL(primary_port, test_params->slave_port_ids[0], + TEST_ASSERT_EQUAL(primary_port, test_params->member_port_ids[0], "Primary port not as expected"); - /* Bring 2 slaves down and verify active slave count */ + /* Bring 2 members down and verify active member count */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 0); + test_params->member_port_ids[1], 0); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 0); + test_params->member_port_ids[3], 0); - TEST_ASSERT_EQUAL(rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS), 2, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 2); + TEST_ASSERT_EQUAL(rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS), 2, + "Number of active members (%d) is not as expected (%d).", + member_count, 2); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[1], 1); + test_params->member_port_ids[1], 1); virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[3], 1); + test_params->member_port_ids[3], 1); - /* Bring primary port down, verify that active slave count is 3 and primary - * has changed */ + /* + * Bring primary port down, verify that active member count is 3 and primary + * has changed. + */ virtual_ethdev_simulate_link_status_interrupt( - test_params->slave_port_ids[0], 0); + test_params->member_port_ids[0], 0); - TEST_ASSERT_EQUAL(rte_eth_bond_active_slaves_get( - test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS), 3, - "Number of active slaves (%d) is not as expected (%d).", - slave_count, 3); + TEST_ASSERT_EQUAL(rte_eth_bond_active_members_get( + test_params->bonded_port_id, members, RTE_MAX_ETHPORTS), 3, + "Number of active members (%d) is not as expected (%d).", + member_count, 3); primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id); - TEST_ASSERT_EQUAL(primary_port, test_params->slave_port_ids[2], + TEST_ASSERT_EQUAL(primary_port, test_params->member_port_ids[2], "Primary port not as expected"); rte_delay_us(500000); - /* Verify that pkts are sent on new primary slave */ + /* Verify that pkts are sent on new primary member */ for (i = 0; i < 4; i++) { TEST_ASSERT_EQUAL(generate_test_burst( &pkt_burst[0][0], burst_size, 0, 1, 0, 0, 0), burst_size, @@ -4639,36 +4687,36 @@ test_tlb_verify_slave_link_status_change_failover(void) rte_delay_us(11000); } - rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[0], &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (int8_t)0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[0]); + test_params->member_port_ids[0]); - rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[1], &port_stats); TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[1]); + test_params->member_port_ids[1]); - rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[2], &port_stats); TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[2]); + test_params->member_port_ids[2]); - rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats); + rte_eth_stats_get(test_params->member_port_ids[3], &port_stats); TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0, "(%d) port_stats.opackets not as expected\n", - test_params->slave_port_ids[3]); + test_params->member_port_ids[3]); /* Generate packet burst for testing */ - for (i = 0; i < TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT; i++) { + for (i = 0; i < TEST_ADAPTIVE_TLB_RX_BURST_MEMBER_COUNT; i++) { if (generate_test_burst(&pkt_burst[i][0], burst_size, 0, 1, 0, 0, 0) != burst_size) return -1; virtual_ethdev_add_mbufs_to_rx_queue( - test_params->slave_port_ids[i], &pkt_burst[i][0], burst_size); + test_params->member_port_ids[i], &pkt_burst[i][0], burst_size); } if (rte_eth_rx_burst(test_params->bonded_port_id, 0, rx_pkt_burst, @@ -4684,11 +4732,11 @@ test_tlb_verify_slave_link_status_change_failover(void) "(%d) port_stats.ipackets not as expected\n", test_params->bonded_port_id); - /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + /* Clean up and remove members from bonded device */ + return remove_members_and_stop_bonded_device(); } -#define TEST_ALB_SLAVE_COUNT 2 +#define TEST_ALB_MEMBER_COUNT 2 static uint8_t mac_client1[] = {0x00, 0xAA, 0x55, 0xFF, 0xCC, 1}; static uint8_t mac_client2[] = {0x00, 0xAA, 0x55, 0xFF, 0xCC, 2}; @@ -4710,23 +4758,23 @@ test_alb_change_mac_in_reply_sent(void) struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; - int slave_idx, nb_pkts, pkt_idx; + int member_idx, nb_pkts, pkt_idx; int retval = 0; struct rte_ether_addr bond_mac, client_mac; - struct rte_ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr *member_mac1, *member_mac2; TEST_ASSERT_SUCCESS( - initialize_bonded_device_with_slaves(BONDING_MODE_ALB, - 0, TEST_ALB_SLAVE_COUNT, 1), - "Failed to initialize_bonded_device_with_slaves."); + initialize_bonded_device_with_members(BONDING_MODE_ALB, + 0, TEST_ALB_MEMBER_COUNT, 1), + "Failed to initialize_bonded_device_with_members."); /* Flush tx queue */ rte_eth_tx_burst(test_params->bonded_port_id, 0, NULL, 0); - for (slave_idx = 0; slave_idx < test_params->bonded_slave_count; - slave_idx++) { + for (member_idx = 0; member_idx < test_params->bonded_member_count; + member_idx++) { nb_pkts = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_idx], pkts_sent, + test_params->member_port_ids[member_idx], pkts_sent, MAX_PKT_BURST); } @@ -4782,18 +4830,18 @@ test_alb_change_mac_in_reply_sent(void) RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); - slave_mac1 = - rte_eth_devices[test_params->slave_port_ids[0]].data->mac_addrs; - slave_mac2 = - rte_eth_devices[test_params->slave_port_ids[1]].data->mac_addrs; + member_mac1 = + rte_eth_devices[test_params->member_port_ids[0]].data->mac_addrs; + member_mac2 = + rte_eth_devices[test_params->member_port_ids[1]].data->mac_addrs; /* * Checking if packets are properly distributed on bonding ports. Packets * 0 and 2 should be sent on port 0 and packets 1 and 3 on port 1. */ - for (slave_idx = 0; slave_idx < test_params->bonded_slave_count; slave_idx++) { + for (member_idx = 0; member_idx < test_params->bonded_member_count; member_idx++) { nb_pkts = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_idx], pkts_sent, + test_params->member_port_ids[member_idx], pkts_sent, MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { @@ -4802,14 +4850,14 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); - if (slave_idx%2 == 0) { - if (!rte_is_same_ether_addr(slave_mac1, + if (member_idx%2 == 0) { + if (!rte_is_same_ether_addr(member_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!rte_is_same_ether_addr(slave_mac2, + if (!rte_is_same_ether_addr(member_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; @@ -4819,7 +4867,7 @@ test_alb_change_mac_in_reply_sent(void) } test_end: - retval += remove_slaves_and_stop_bonded_device(); + retval += remove_members_and_stop_bonded_device(); return retval; } @@ -4832,22 +4880,22 @@ test_alb_reply_from_client(void) struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; - int slave_idx, nb_pkts, pkt_idx, nb_pkts_sum = 0; + int member_idx, nb_pkts, pkt_idx, nb_pkts_sum = 0; int retval = 0; struct rte_ether_addr bond_mac, client_mac; - struct rte_ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr *member_mac1, *member_mac2; TEST_ASSERT_SUCCESS( - initialize_bonded_device_with_slaves(BONDING_MODE_ALB, - 0, TEST_ALB_SLAVE_COUNT, 1), - "Failed to initialize_bonded_device_with_slaves."); + initialize_bonded_device_with_members(BONDING_MODE_ALB, + 0, TEST_ALB_MEMBER_COUNT, 1), + "Failed to initialize_bonded_device_with_members."); /* Flush tx queue */ rte_eth_tx_burst(test_params->bonded_port_id, 0, NULL, 0); - for (slave_idx = 0; slave_idx < test_params->bonded_slave_count; slave_idx++) { + for (member_idx = 0; member_idx < test_params->bonded_member_count; member_idx++) { nb_pkts = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_idx], pkts_sent, + test_params->member_port_ids[member_idx], pkts_sent, MAX_PKT_BURST); } @@ -4868,7 +4916,7 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, RTE_ARP_OP_REPLY); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[0], &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4880,7 +4928,7 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, RTE_ARP_OP_REPLY); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[0], &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4892,7 +4940,7 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, RTE_ARP_OP_REPLY); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[0], &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4904,7 +4952,7 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, RTE_ARP_OP_REPLY); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[0], &pkt, 1); /* @@ -4914,15 +4962,15 @@ test_alb_reply_from_client(void) rte_eth_rx_burst(test_params->bonded_port_id, 0, pkts_sent, MAX_PKT_BURST); rte_eth_tx_burst(test_params->bonded_port_id, 0, NULL, 0); - slave_mac1 = rte_eth_devices[test_params->slave_port_ids[0]].data->mac_addrs; - slave_mac2 = rte_eth_devices[test_params->slave_port_ids[1]].data->mac_addrs; + member_mac1 = rte_eth_devices[test_params->member_port_ids[0]].data->mac_addrs; + member_mac2 = rte_eth_devices[test_params->member_port_ids[1]].data->mac_addrs; /* - * Checking if update ARP packets were properly send on slave ports. + * Checking if update ARP packets were properly send on member ports. */ - for (slave_idx = 0; slave_idx < test_params->bonded_slave_count; slave_idx++) { + for (member_idx = 0; member_idx < test_params->bonded_member_count; member_idx++) { nb_pkts = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_idx], pkts_sent, MAX_PKT_BURST); + test_params->member_port_ids[member_idx], pkts_sent, MAX_PKT_BURST); nb_pkts_sum += nb_pkts; for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { @@ -4931,14 +4979,14 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); - if (slave_idx%2 == 0) { - if (!rte_is_same_ether_addr(slave_mac1, + if (member_idx%2 == 0) { + if (!rte_is_same_ether_addr(member_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!rte_is_same_ether_addr(slave_mac2, + if (!rte_is_same_ether_addr(member_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; @@ -4954,7 +5002,7 @@ test_alb_reply_from_client(void) } test_end: - retval += remove_slaves_and_stop_bonded_device(); + retval += remove_members_and_stop_bonded_device(); return retval; } @@ -4968,21 +5016,21 @@ test_alb_receive_vlan_reply(void) struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; - int slave_idx, nb_pkts, pkt_idx; + int member_idx, nb_pkts, pkt_idx; int retval = 0; struct rte_ether_addr bond_mac, client_mac; TEST_ASSERT_SUCCESS( - initialize_bonded_device_with_slaves(BONDING_MODE_ALB, - 0, TEST_ALB_SLAVE_COUNT, 1), - "Failed to initialize_bonded_device_with_slaves."); + initialize_bonded_device_with_members(BONDING_MODE_ALB, + 0, TEST_ALB_MEMBER_COUNT, 1), + "Failed to initialize_bonded_device_with_members."); /* Flush tx queue */ rte_eth_tx_burst(test_params->bonded_port_id, 0, NULL, 0); - for (slave_idx = 0; slave_idx < test_params->bonded_slave_count; slave_idx++) { + for (member_idx = 0; member_idx < test_params->bonded_member_count; member_idx++) { nb_pkts = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_idx], pkts_sent, + test_params->member_port_ids[member_idx], pkts_sent, MAX_PKT_BURST); } @@ -5007,7 +5055,7 @@ test_alb_receive_vlan_reply(void) arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, RTE_ARP_OP_REPLY); - virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, + virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[0], &pkt, 1); rte_eth_rx_burst(test_params->bonded_port_id, 0, pkts_sent, MAX_PKT_BURST); @@ -5016,9 +5064,9 @@ test_alb_receive_vlan_reply(void) /* * Checking if VLAN headers in generated ARP Update packet are correct. */ - for (slave_idx = 0; slave_idx < test_params->bonded_slave_count; slave_idx++) { + for (member_idx = 0; member_idx < test_params->bonded_member_count; member_idx++) { nb_pkts = virtual_ethdev_get_mbufs_from_tx_queue( - test_params->slave_port_ids[slave_idx], pkts_sent, + test_params->member_port_ids[member_idx], pkts_sent, MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { @@ -5049,7 +5097,7 @@ test_alb_receive_vlan_reply(void) } test_end: - retval += remove_slaves_and_stop_bonded_device(); + retval += remove_members_and_stop_bonded_device(); return retval; } @@ -5062,9 +5110,9 @@ test_alb_ipv4_tx(void) retval = 0; TEST_ASSERT_SUCCESS( - initialize_bonded_device_with_slaves(BONDING_MODE_ALB, - 0, TEST_ALB_SLAVE_COUNT, 1), - "Failed to initialize_bonded_device_with_slaves."); + initialize_bonded_device_with_members(BONDING_MODE_ALB, + 0, TEST_ALB_MEMBER_COUNT, 1), + "Failed to initialize_bonded_device_with_members."); burst_size = 32; @@ -5085,7 +5133,7 @@ test_alb_ipv4_tx(void) } test_end: - retval += remove_slaves_and_stop_bonded_device(); + retval += remove_members_and_stop_bonded_device(); return retval; } @@ -5096,34 +5144,34 @@ static struct unit_test_suite link_bonding_test_suite = { .unit_test_cases = { TEST_CASE(test_create_bonded_device), TEST_CASE(test_create_bonded_device_with_invalid_params), - TEST_CASE(test_add_slave_to_bonded_device), - TEST_CASE(test_add_slave_to_invalid_bonded_device), - TEST_CASE(test_remove_slave_from_bonded_device), - TEST_CASE(test_remove_slave_from_invalid_bonded_device), - TEST_CASE(test_get_slaves_from_bonded_device), - TEST_CASE(test_add_already_bonded_slave_to_bonded_device), - TEST_CASE(test_add_remove_multiple_slaves_to_from_bonded_device), + TEST_CASE(test_add_member_to_bonded_device), + TEST_CASE(test_add_member_to_invalid_bonded_device), + TEST_CASE(test_remove_member_from_bonded_device), + TEST_CASE(test_remove_member_from_invalid_bonded_device), + TEST_CASE(test_get_members_from_bonded_device), + TEST_CASE(test_add_already_bonded_member_to_bonded_device), + TEST_CASE(test_add_remove_multiple_members_to_from_bonded_device), TEST_CASE(test_start_bonded_device), TEST_CASE(test_stop_bonded_device), TEST_CASE(test_set_bonding_mode), - TEST_CASE(test_set_primary_slave), + TEST_CASE(test_set_primary_member), TEST_CASE(test_set_explicit_bonded_mac), TEST_CASE(test_set_bonded_port_initialization_mac_assignment), TEST_CASE(test_status_interrupt), - TEST_CASE(test_adding_slave_after_bonded_device_started), + TEST_CASE(test_adding_member_after_bonded_device_started), TEST_CASE(test_roundrobin_tx_burst), - TEST_CASE(test_roundrobin_tx_burst_slave_tx_fail), - TEST_CASE(test_roundrobin_rx_burst_on_single_slave), - TEST_CASE(test_roundrobin_rx_burst_on_multiple_slaves), + TEST_CASE(test_roundrobin_tx_burst_member_tx_fail), + TEST_CASE(test_roundrobin_rx_burst_on_single_member), + TEST_CASE(test_roundrobin_rx_burst_on_multiple_members), TEST_CASE(test_roundrobin_verify_promiscuous_enable_disable), TEST_CASE(test_roundrobin_verify_mac_assignment), - TEST_CASE(test_roundrobin_verify_slave_link_status_change_behaviour), - TEST_CASE(test_roundrobin_verfiy_polling_slave_link_status_change), + TEST_CASE(test_roundrobin_verify_member_link_status_change_behaviour), + TEST_CASE(test_roundrobin_verify_polling_member_link_status_change), TEST_CASE(test_activebackup_tx_burst), TEST_CASE(test_activebackup_rx_burst), TEST_CASE(test_activebackup_verify_promiscuous_enable_disable), TEST_CASE(test_activebackup_verify_mac_assignment), - TEST_CASE(test_activebackup_verify_slave_link_status_change_failover), + TEST_CASE(test_activebackup_verify_member_link_status_change_failover), TEST_CASE(test_balance_xmit_policy_configuration), TEST_CASE(test_balance_l2_tx_burst), TEST_CASE(test_balance_l23_tx_burst_ipv4_toggle_ip_addr), @@ -5137,26 +5185,26 @@ static struct unit_test_suite link_bonding_test_suite = { TEST_CASE(test_balance_l34_tx_burst_ipv6_toggle_ip_addr), TEST_CASE(test_balance_l34_tx_burst_vlan_ipv6_toggle_ip_addr), TEST_CASE(test_balance_l34_tx_burst_ipv6_toggle_udp_port), - TEST_CASE(test_balance_tx_burst_slave_tx_fail), + TEST_CASE(test_balance_tx_burst_member_tx_fail), TEST_CASE(test_balance_rx_burst), TEST_CASE(test_balance_verify_promiscuous_enable_disable), TEST_CASE(test_balance_verify_mac_assignment), - TEST_CASE(test_balance_verify_slave_link_status_change_behaviour), + TEST_CASE(test_balance_verify_member_link_status_change_behaviour), TEST_CASE(test_tlb_tx_burst), TEST_CASE(test_tlb_rx_burst), TEST_CASE(test_tlb_verify_mac_assignment), TEST_CASE(test_tlb_verify_promiscuous_enable_disable), - TEST_CASE(test_tlb_verify_slave_link_status_change_failover), + TEST_CASE(test_tlb_verify_member_link_status_change_failover), TEST_CASE(test_alb_change_mac_in_reply_sent), TEST_CASE(test_alb_reply_from_client), TEST_CASE(test_alb_receive_vlan_reply), TEST_CASE(test_alb_ipv4_tx), TEST_CASE(test_broadcast_tx_burst), - TEST_CASE(test_broadcast_tx_burst_slave_tx_fail), + TEST_CASE(test_broadcast_tx_burst_member_tx_fail), TEST_CASE(test_broadcast_rx_burst), TEST_CASE(test_broadcast_verify_promiscuous_enable_disable), TEST_CASE(test_broadcast_verify_mac_assignment), - TEST_CASE(test_broadcast_verify_slave_link_status_change_behaviour), + TEST_CASE(test_broadcast_verify_member_link_status_change_behaviour), TEST_CASE(test_reconfigure_bonded_device), TEST_CASE(test_close_bonded_device), diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 21c512c94b..2de907e7f3 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -31,7 +31,7 @@ #include "test.h" -#define SLAVE_COUNT (4) +#define MEMBER_COUNT (4) #define RX_RING_SIZE 1024 #define TX_RING_SIZE 1024 @@ -46,15 +46,15 @@ #define BONDED_DEV_NAME ("net_bonding_m4_bond_dev") -#define SLAVE_DEV_NAME_FMT ("net_virt_%d") -#define SLAVE_RX_QUEUE_FMT ("net_virt_%d_rx") -#define SLAVE_TX_QUEUE_FMT ("net_virt_%d_tx") +#define MEMBER_DEV_NAME_FMT ("net_virt_%d") +#define MEMBER_RX_QUEUE_FMT ("net_virt_%d_rx") +#define MEMBER_TX_QUEUE_FMT ("net_virt_%d_tx") #define INVALID_SOCKET_ID (-1) #define INVALID_PORT_ID (0xFF) #define INVALID_BONDING_MODE (-1) -static const struct rte_ether_addr slave_mac_default = { +static const struct rte_ether_addr member_mac_default = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; @@ -70,7 +70,7 @@ static const struct rte_ether_addr slow_protocol_mac_addr = { { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; -struct slave_conf { +struct member_conf { struct rte_ring *rx_queue; struct rte_ring *tx_queue; uint16_t port_id; @@ -86,21 +86,21 @@ struct ether_vlan_hdr { struct link_bonding_unittest_params { uint8_t bonded_port_id; - struct slave_conf slave_ports[SLAVE_COUNT]; + struct member_conf member_ports[MEMBER_COUNT]; struct rte_mempool *mbuf_pool; }; -#define TEST_DEFAULT_SLAVE_COUNT RTE_DIM(test_params.slave_ports) -#define TEST_RX_SLAVE_COUT TEST_DEFAULT_SLAVE_COUNT -#define TEST_TX_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT -#define TEST_MARKER_SLAVE_COUT TEST_DEFAULT_SLAVE_COUNT -#define TEST_EXPIRED_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT -#define TEST_PROMISC_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT +#define TEST_DEFAULT_MEMBER_COUNT RTE_DIM(test_params.member_ports) +#define TEST_RX_MEMBER_COUT TEST_DEFAULT_MEMBER_COUNT +#define TEST_TX_MEMBER_COUNT TEST_DEFAULT_MEMBER_COUNT +#define TEST_MARKER_MEMBER_COUT TEST_DEFAULT_MEMBER_COUNT +#define TEST_EXPIRED_MEMBER_COUNT TEST_DEFAULT_MEMBER_COUNT +#define TEST_PROMISC_MEMBER_COUNT TEST_DEFAULT_MEMBER_COUNT static struct link_bonding_unittest_params test_params = { .bonded_port_id = INVALID_PORT_ID, - .slave_ports = { [0 ... SLAVE_COUNT - 1] = { .port_id = INVALID_PORT_ID} }, + .member_ports = { [0 ... MEMBER_COUNT - 1] = { .port_id = INVALID_PORT_ID} }, .mbuf_pool = NULL, }; @@ -120,58 +120,58 @@ static uint8_t lacpdu_rx_count[RTE_MAX_ETHPORTS] = {0, }; #define FOR_EACH(_i, _item, _array, _size) \ for (_i = 0, _item = &_array[0]; _i < _size && (_item = &_array[_i]); _i++) -/* Macro for iterating over every port that can be used as a slave +/* Macro for iterating over every port that can be used as a member * in this test. - * _i variable used as an index in test_params->slave_ports - * _slave pointer to &test_params->slave_ports[_idx] + * _i variable used as an index in test_params->member_ports + * _member pointer to &test_params->member_ports[_idx] */ #define FOR_EACH_PORT(_i, _port) \ - FOR_EACH(_i, _port, test_params.slave_ports, \ - RTE_DIM(test_params.slave_ports)) + FOR_EACH(_i, _port, test_params.member_ports, \ + RTE_DIM(test_params.member_ports)) -/* Macro for iterating over every port that can be used as a slave +/* Macro for iterating over every port that can be used as a member * in this test and satisfy given condition. * - * _i variable used as an index in test_params->slave_ports - * _slave pointer to &test_params->slave_ports[_idx] + * _i variable used as an index in test_params->member_ports + * _member pointer to &test_params->member_ports[_idx] * _condition condition that need to be checked */ #define FOR_EACH_PORT_IF(_i, _port, _condition) FOR_EACH_PORT((_i), (_port)) \ if (!!(_condition)) -/* Macro for iterating over every port that is currently a slave of a bonded +/* Macro for iterating over every port that is currently a member of a bonded * device. - * _i variable used as an index in test_params->slave_ports - * _slave pointer to &test_params->slave_ports[_idx] + * _i variable used as an index in test_params->member_ports + * _member pointer to &test_params->member_ports[_idx] * */ -#define FOR_EACH_SLAVE(_i, _slave) \ - FOR_EACH_PORT_IF(_i, _slave, (_slave)->bonded != 0) +#define FOR_EACH_MEMBER(_i, _member) \ + FOR_EACH_PORT_IF(_i, _member, (_member)->bonded != 0) /* - * Returns packets from slaves TX queue. - * slave slave port + * Returns packets from members TX queue. + * member port * buffer for packets * size size of buffer * return number of packets or negative error number */ static int -slave_get_pkts(struct slave_conf *slave, struct rte_mbuf **buf, uint16_t size) +member_get_pkts(struct member_conf *member, struct rte_mbuf **buf, uint16_t size) { - return rte_ring_dequeue_burst(slave->tx_queue, (void **)buf, + return rte_ring_dequeue_burst(member->tx_queue, (void **)buf, size, NULL); } /* - * Injects given packets into slaves RX queue. - * slave slave port + * Injects given packets into members RX queue. + * member port * buffer for packets * size number of packets to be injected * return number of queued packets or negative error number */ static int -slave_put_pkts(struct slave_conf *slave, struct rte_mbuf **buf, uint16_t size) +member_put_pkts(struct member_conf *member, struct rte_mbuf **buf, uint16_t size) { - return rte_ring_enqueue_burst(slave->rx_queue, (void **)buf, + return rte_ring_enqueue_burst(member->rx_queue, (void **)buf, size, NULL); } @@ -219,79 +219,79 @@ configure_ethdev(uint16_t port_id, uint8_t start) } static int -add_slave(struct slave_conf *slave, uint8_t start) +add_member(struct member_conf *member, uint8_t start) { struct rte_ether_addr addr, addr_check; int retval; /* Some sanity check */ - RTE_VERIFY(test_params.slave_ports <= slave && - slave - test_params.slave_ports < (int)RTE_DIM(test_params.slave_ports)); - RTE_VERIFY(slave->bonded == 0); - RTE_VERIFY(slave->port_id != INVALID_PORT_ID); + RTE_VERIFY(test_params.member_ports <= member && + member - test_params.member_ports < (int)RTE_DIM(test_params.member_ports)); + RTE_VERIFY(member->bonded == 0); + RTE_VERIFY(member->port_id != INVALID_PORT_ID); - rte_ether_addr_copy(&slave_mac_default, &addr); - addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; + rte_ether_addr_copy(&member_mac_default, &addr); + addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = member->port_id; - rte_eth_dev_mac_addr_remove(slave->port_id, &addr); + rte_eth_dev_mac_addr_remove(member->port_id, &addr); - TEST_ASSERT_SUCCESS(rte_eth_dev_mac_addr_add(slave->port_id, &addr, 0), - "Failed to set slave MAC address"); + TEST_ASSERT_SUCCESS(rte_eth_dev_mac_addr_add(member->port_id, &addr, 0), + "Failed to set member MAC address"); - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bonded_port_id, - slave->port_id), - "Failed to add slave (idx=%u, id=%u) to bonding (id=%u)", - (uint8_t)(slave - test_params.slave_ports), slave->port_id, + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(test_params.bonded_port_id, + member->port_id), + "Failed to add member (idx=%u, id=%u) to bonding (id=%u)", + (uint8_t)(member - test_params.member_ports), member->port_id, test_params.bonded_port_id); - slave->bonded = 1; + member->bonded = 1; if (start) { - TEST_ASSERT_SUCCESS(rte_eth_dev_start(slave->port_id), - "Failed to start slave %u", slave->port_id); + TEST_ASSERT_SUCCESS(rte_eth_dev_start(member->port_id), + "Failed to start member %u", member->port_id); } - retval = rte_eth_macaddr_get(slave->port_id, &addr_check); - TEST_ASSERT_SUCCESS(retval, "Failed to get slave mac address: %s", + retval = rte_eth_macaddr_get(member->port_id, &addr_check); + TEST_ASSERT_SUCCESS(retval, "Failed to get member mac address: %s", strerror(-retval)); TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1, - "Slave MAC address is not as expected"); + "Member MAC address is not as expected"); - RTE_VERIFY(slave->lacp_parnter_state == 0); + RTE_VERIFY(member->lacp_parnter_state == 0); return 0; } static int -remove_slave(struct slave_conf *slave) +remove_member(struct member_conf *member) { - ptrdiff_t slave_idx = slave - test_params.slave_ports; + ptrdiff_t member_idx = member - test_params.member_ports; - RTE_VERIFY(test_params.slave_ports <= slave && - slave_idx < (ptrdiff_t)RTE_DIM(test_params.slave_ports)); + RTE_VERIFY(test_params.member_ports <= member && + member_idx < (ptrdiff_t)RTE_DIM(test_params.member_ports)); - RTE_VERIFY(slave->bonded == 1); - RTE_VERIFY(slave->port_id != INVALID_PORT_ID); + RTE_VERIFY(member->bonded == 1); + RTE_VERIFY(member->port_id != INVALID_PORT_ID); - TEST_ASSERT_EQUAL(rte_ring_count(slave->rx_queue), 0, - "Slave %u tx queue not empty while removing from bonding.", - slave->port_id); + TEST_ASSERT_EQUAL(rte_ring_count(member->rx_queue), 0, + "Member %u tx queue not empty while removing from bonding.", + member->port_id); - TEST_ASSERT_EQUAL(rte_ring_count(slave->rx_queue), 0, - "Slave %u tx queue not empty while removing from bonding.", - slave->port_id); + TEST_ASSERT_EQUAL(rte_ring_count(member->rx_queue), 0, + "Member %u tx queue not empty while removing from bonding.", + member->port_id); - TEST_ASSERT_EQUAL(rte_eth_bond_slave_remove(test_params.bonded_port_id, - slave->port_id), 0, - "Failed to remove slave (idx=%u, id=%u) from bonding (id=%u)", - (uint8_t)slave_idx, slave->port_id, + TEST_ASSERT_EQUAL(rte_eth_bond_member_remove(test_params.bonded_port_id, + member->port_id), 0, + "Failed to remove member (idx=%u, id=%u) from bonding (id=%u)", + (uint8_t)member_idx, member->port_id, test_params.bonded_port_id); - slave->bonded = 0; - slave->lacp_parnter_state = 0; + member->bonded = 0; + member->lacp_parnter_state = 0; return 0; } static void -lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) +lacp_recv_cb(uint16_t member_id, struct rte_mbuf *lacp_pkt) { struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; @@ -304,22 +304,22 @@ lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); RTE_VERIFY(slow_hdr->slow_protocol.subtype == SLOW_SUBTYPE_LACP); - lacpdu_rx_count[slave_id]++; + lacpdu_rx_count[member_id]++; rte_pktmbuf_free(lacp_pkt); } static int -initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm) +initialize_bonded_device_with_members(uint16_t member_count, uint8_t external_sm) { uint8_t i; int ret; RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID); - for (i = 0; i < slave_count; i++) { - TEST_ASSERT_SUCCESS(add_slave(&test_params.slave_ports[i], 1), + for (i = 0; i < member_count; i++) { + TEST_ASSERT_SUCCESS(add_member(&test_params.member_ports[i], 1), "Failed to add port %u to bonded device.\n", - test_params.slave_ports[i].port_id); + test_params.member_ports[i].port_id); } /* Reset mode 4 configuration */ @@ -345,34 +345,34 @@ initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm) } static int -remove_slaves_and_stop_bonded_device(void) +remove_members_and_stop_bonded_device(void) { - struct slave_conf *slave; + struct member_conf *member; int retval; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; uint16_t i; TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params.bonded_port_id), "Failed to stop bonded port %u", test_params.bonded_port_id); - FOR_EACH_SLAVE(i, slave) - remove_slave(slave); + FOR_EACH_MEMBER(i, member) + remove_member(member); - retval = rte_eth_bond_slaves_get(test_params.bonded_port_id, slaves, - RTE_DIM(slaves)); + retval = rte_eth_bond_members_get(test_params.bonded_port_id, members, + RTE_DIM(members)); TEST_ASSERT_EQUAL(retval, 0, - "Expected bonded device %u have 0 slaves but returned %d.", + "Expected bonded device %u have 0 members but returned %d.", test_params.bonded_port_id, retval); - FOR_EACH_PORT(i, slave) { - TEST_ASSERT_SUCCESS(rte_eth_dev_stop(slave->port_id), + FOR_EACH_PORT(i, member) { + TEST_ASSERT_SUCCESS(rte_eth_dev_stop(member->port_id), "Failed to stop bonded port %u", - slave->port_id); + member->port_id); - TEST_ASSERT(slave->bonded == 0, - "Port id=%u is still marked as enslaved.", slave->port_id); + TEST_ASSERT(member->bonded == 0, + "Port id=%u is still marked as enmemberd.", member->port_id); } return TEST_SUCCESS; @@ -383,7 +383,7 @@ test_setup(void) { int retval, nb_mbuf_per_pool; char name[RTE_ETH_NAME_MAX_LEN]; - struct slave_conf *port; + struct member_conf *port; const uint8_t socket_id = rte_socket_id(); uint16_t i; @@ -400,10 +400,10 @@ test_setup(void) /* Create / initialize ring eth devs. */ FOR_EACH_PORT(i, port) { - port = &test_params.slave_ports[i]; + port = &test_params.member_ports[i]; if (port->rx_queue == NULL) { - retval = snprintf(name, RTE_DIM(name), SLAVE_RX_QUEUE_FMT, i); + retval = snprintf(name, RTE_DIM(name), MEMBER_RX_QUEUE_FMT, i); TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long"); port->rx_queue = rte_ring_create(name, RX_RING_SIZE, socket_id, 0); TEST_ASSERT(port->rx_queue != NULL, @@ -412,7 +412,7 @@ test_setup(void) } if (port->tx_queue == NULL) { - retval = snprintf(name, RTE_DIM(name), SLAVE_TX_QUEUE_FMT, i); + retval = snprintf(name, RTE_DIM(name), MEMBER_TX_QUEUE_FMT, i); TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long"); port->tx_queue = rte_ring_create(name, TX_RING_SIZE, socket_id, 0); TEST_ASSERT_NOT_NULL(port->tx_queue, @@ -421,7 +421,7 @@ test_setup(void) } if (port->port_id == INVALID_PORT_ID) { - retval = snprintf(name, RTE_DIM(name), SLAVE_DEV_NAME_FMT, i); + retval = snprintf(name, RTE_DIM(name), MEMBER_DEV_NAME_FMT, i); TEST_ASSERT(retval < (int)RTE_DIM(name) - 1, "Name too long"); retval = rte_eth_from_rings(name, &port->rx_queue, 1, &port->tx_queue, 1, socket_id); @@ -460,7 +460,7 @@ test_setup(void) static void testsuite_teardown(void) { - struct slave_conf *port; + struct member_conf *port; uint8_t i; /* Only stop ports. @@ -480,7 +480,7 @@ testsuite_teardown(void) * frame but not LACP */ static int -make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) +make_lacp_reply(struct member_conf *member, struct rte_mbuf *pkt) { struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; @@ -501,11 +501,11 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) /* Change source address to partner address */ rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.src_addr); slow_hdr->eth_hdr.src_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = - slave->port_id; + member->port_id; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; /* Save last received state */ - slave->lacp_parnter_state = lacp->actor.state; + member->lacp_parnter_state = lacp->actor.state; /* Change it into LACP replay by matching parameters. */ memcpy(&lacp->partner.port_params, &lacp->actor.port_params, sizeof(struct port_params)); @@ -523,27 +523,27 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) } /* - * Reads packets from given slave, search for LACP packet and reply them. + * Reads packets from given member, search for LACP packet and reply them. * - * Receives burst of packets from slave. Looks for LACP packet. Drops + * Receives burst of packets from member. Looks for LACP packet. Drops * all other packets. Prepares response LACP and sends it back. * * return number of LACP received and replied, -1 on error. */ static int -bond_handshake_reply(struct slave_conf *slave) +bond_handshake_reply(struct member_conf *member) { int retval; struct rte_mbuf *rx_buf[MAX_PKT_BURST]; struct rte_mbuf *lacp_tx_buf[MAX_PKT_BURST]; uint16_t lacp_tx_buf_cnt = 0, i; - retval = slave_get_pkts(slave, rx_buf, RTE_DIM(rx_buf)); - TEST_ASSERT(retval >= 0, "Getting slave %u packets failed.", - slave->port_id); + retval = member_get_pkts(member, rx_buf, RTE_DIM(rx_buf)); + TEST_ASSERT(retval >= 0, "Getting member %u packets failed.", + member->port_id); for (i = 0; i < (uint16_t)retval; i++) { - if (make_lacp_reply(slave, rx_buf[i]) == 0) { + if (make_lacp_reply(member, rx_buf[i]) == 0) { /* reply with actor's LACP */ lacp_tx_buf[lacp_tx_buf_cnt++] = rx_buf[i]; } else @@ -553,7 +553,7 @@ bond_handshake_reply(struct slave_conf *slave) if (lacp_tx_buf_cnt == 0) return 0; - retval = slave_put_pkts(slave, lacp_tx_buf, lacp_tx_buf_cnt); + retval = member_put_pkts(member, lacp_tx_buf, lacp_tx_buf_cnt); if (retval <= lacp_tx_buf_cnt) { /* retval might be negative */ for (i = RTE_MAX(0, retval); retval < lacp_tx_buf_cnt; retval++) @@ -561,24 +561,24 @@ bond_handshake_reply(struct slave_conf *slave) } TEST_ASSERT_EQUAL(retval, lacp_tx_buf_cnt, - "Failed to equeue lacp packets into slave %u tx queue.", - slave->port_id); + "Failed to equeue lacp packets into member %u tx queue.", + member->port_id); return lacp_tx_buf_cnt; } /* - * Function check if given slave tx queue contains packets that make mode 4 - * handshake complete. It will drain slave queue. + * Function check if given member tx queue contains packets that make mode 4 + * handshake complete. It will drain member queue. * return 0 if handshake not completed, 1 if handshake was complete, */ static int -bond_handshake_done(struct slave_conf *slave) +bond_handshake_done(struct member_conf *member) { const uint8_t expected_state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION | STATE_AGGREGATION | STATE_COLLECTING | STATE_DISTRIBUTING; - return slave->lacp_parnter_state == expected_state; + return member->lacp_parnter_state == expected_state; } static unsigned @@ -603,32 +603,32 @@ bond_get_update_timeout_ms(void) static int bond_handshake(void) { - struct slave_conf *slave; + struct member_conf *member; struct rte_mbuf *buf[MAX_PKT_BURST]; uint16_t nb_pkts; - uint8_t all_slaves_done, i, j; - uint8_t status[RTE_DIM(test_params.slave_ports)] = { 0 }; + uint8_t all_members_done, i, j; + uint8_t status[RTE_DIM(test_params.member_ports)] = { 0 }; const unsigned delay = bond_get_update_timeout_ms(); /* Exchange LACP frames */ - all_slaves_done = 0; - for (i = 0; i < 30 && all_slaves_done == 0; ++i) { + all_members_done = 0; + for (i = 0; i < 30 && all_members_done == 0; ++i) { rte_delay_ms(delay); - all_slaves_done = 1; - FOR_EACH_SLAVE(j, slave) { - /* If response already send, skip slave */ + all_members_done = 1; + FOR_EACH_MEMBER(j, member) { + /* If response already send, skip member */ if (status[j] != 0) continue; - if (bond_handshake_reply(slave) < 0) { - all_slaves_done = 0; + if (bond_handshake_reply(member) < 0) { + all_members_done = 0; break; } - status[j] = bond_handshake_done(slave); + status[j] = bond_handshake_done(member); if (status[j] == 0) - all_slaves_done = 0; + all_members_done = 0; } nb_pkts = bond_tx(NULL, 0); @@ -639,26 +639,26 @@ bond_handshake(void) TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets received unexpectedly"); } /* If response didn't send - report failure */ - TEST_ASSERT_EQUAL(all_slaves_done, 1, "Bond handshake failed\n"); + TEST_ASSERT_EQUAL(all_members_done, 1, "Bond handshake failed\n"); /* If flags doesn't match - report failure */ - return all_slaves_done == 1 ? TEST_SUCCESS : TEST_FAILED; + return all_members_done == 1 ? TEST_SUCCESS : TEST_FAILED; } -#define TEST_LACP_SLAVE_COUT RTE_DIM(test_params.slave_ports) +#define TEST_LACP_MEMBER_COUT RTE_DIM(test_params.member_ports) static int test_mode4_lacp(void) { int retval; - retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0); + retval = initialize_bonded_device_with_members(TEST_LACP_MEMBER_COUT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); /* Test LACP handshake function */ retval = bond_handshake(); TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); return TEST_SUCCESS; @@ -668,7 +668,7 @@ test_mode4_agg_mode_selection(void) { int retval; /* Test and verify for Stable mode */ - retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0); + retval = initialize_bonded_device_with_members(TEST_LACP_MEMBER_COUT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -684,12 +684,12 @@ test_mode4_agg_mode_selection(void) TEST_ASSERT_EQUAL(retval, AGG_STABLE, "Wrong agg mode received from bonding device"); - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); /* test and verify for Bandwidth mode */ - retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0); + retval = initialize_bonded_device_with_members(TEST_LACP_MEMBER_COUT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -706,11 +706,11 @@ test_mode4_agg_mode_selection(void) TEST_ASSERT_EQUAL(retval, AGG_BANDWIDTH, "Wrong agg mode received from bonding device"); - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); /* test and verify selection for count mode */ - retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0); + retval = initialize_bonded_device_with_members(TEST_LACP_MEMBER_COUT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -726,7 +726,7 @@ test_mode4_agg_mode_selection(void) TEST_ASSERT_EQUAL(retval, AGG_COUNT, "Wrong agg mode received from bonding device"); - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); return TEST_SUCCESS; @@ -780,7 +780,7 @@ generate_packets(struct rte_ether_addr *src_mac, } static int -generate_and_put_packets(struct slave_conf *slave, +generate_and_put_packets(struct member_conf *member, struct rte_ether_addr *src_mac, struct rte_ether_addr *dst_mac, uint16_t count) { @@ -791,12 +791,12 @@ generate_and_put_packets(struct slave_conf *slave, if (retval != (int)count) return retval; - retval = slave_put_pkts(slave, pkts, count); + retval = member_put_pkts(member, pkts, count); if (retval > 0 && retval != count) free_pkts(&pkts[retval], count - retval); TEST_ASSERT_EQUAL(retval, count, - "Failed to enqueue packets into slave %u RX queue", slave->port_id); + "Failed to enqueue packets into member %u RX queue", member->port_id); return TEST_SUCCESS; } @@ -804,7 +804,7 @@ generate_and_put_packets(struct slave_conf *slave, static int test_mode4_rx(void) { - struct slave_conf *slave; + struct member_conf *member; uint16_t i, j; uint16_t expected_pkts_cnt; @@ -819,7 +819,7 @@ test_mode4_rx(void) struct rte_ether_addr dst_mac; struct rte_ether_addr bonded_mac; - retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, + retval = initialize_bonded_device_with_members(TEST_PROMISC_MEMBER_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -838,7 +838,7 @@ test_mode4_rx(void) dst_mac.addr_bytes[0] += 2; /* First try with promiscuous mode enabled. - * Add 2 packets to each slave. First with bonding MAC address, second with + * Add 2 packets to each member. First with bonding MAC address, second with * different. Check if we received all of them. */ retval = rte_eth_promiscuous_enable(test_params.bonded_port_id); TEST_ASSERT_SUCCESS(retval, @@ -846,16 +846,16 @@ test_mode4_rx(void) test_params.bonded_port_id, rte_strerror(-retval)); expected_pkts_cnt = 0; - FOR_EACH_SLAVE(i, slave) { - retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1); - TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u", - slave->port_id); + FOR_EACH_MEMBER(i, member) { + retval = generate_and_put_packets(member, &src_mac, &bonded_mac, 1); + TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to member %u", + member->port_id); - retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1); - TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u", - slave->port_id); + retval = generate_and_put_packets(member, &src_mac, &dst_mac, 1); + TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to member %u", + member->port_id); - /* Expect 2 packets per slave */ + /* Expect 2 packets per member */ expected_pkts_cnt += 2; } @@ -894,16 +894,16 @@ test_mode4_rx(void) test_params.bonded_port_id, rte_strerror(-retval)); expected_pkts_cnt = 0; - FOR_EACH_SLAVE(i, slave) { - retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1); - TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u", - slave->port_id); + FOR_EACH_MEMBER(i, member) { + retval = generate_and_put_packets(member, &src_mac, &bonded_mac, 1); + TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to member %u", + member->port_id); - retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1); - TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u", - slave->port_id); + retval = generate_and_put_packets(member, &src_mac, &dst_mac, 1); + TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to member %u", + member->port_id); - /* Expect only one packet per slave */ + /* Expect only one packet per member */ expected_pkts_cnt += 1; } @@ -927,19 +927,19 @@ test_mode4_rx(void) TEST_ASSERT_EQUAL(retval, expected_pkts_cnt, "Expected %u packets but received only %d", expected_pkts_cnt, retval); - /* Link down test: simulate link down for first slave. */ + /* Link down test: simulate link down for first member. */ delay = bond_get_update_timeout_ms(); - uint8_t slave_down_id = INVALID_PORT_ID; + uint8_t member_down_id = INVALID_PORT_ID; - /* Find first slave and make link down on it*/ - FOR_EACH_SLAVE(i, slave) { - rte_eth_dev_set_link_down(slave->port_id); - slave_down_id = slave->port_id; + /* Find first member and make link down on it*/ + FOR_EACH_MEMBER(i, member) { + rte_eth_dev_set_link_down(member->port_id); + member_down_id = member->port_id; break; } - RTE_VERIFY(slave_down_id != INVALID_PORT_ID); + RTE_VERIFY(member_down_id != INVALID_PORT_ID); /* Give some time to rearrange bonding */ for (i = 0; i < 3; i++) { @@ -949,16 +949,16 @@ test_mode4_rx(void) TEST_ASSERT_SUCCESS(bond_handshake(), "Handshake after link down failed"); - /* Put packet to each slave */ - FOR_EACH_SLAVE(i, slave) { + /* Put packet to each member */ + FOR_EACH_MEMBER(i, member) { void *pkt = NULL; - dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; - retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1); + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = member->port_id; + retval = generate_and_put_packets(member, &src_mac, &dst_mac, 1); TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst."); - src_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; - retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1); + src_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = member->port_id; + retval = generate_and_put_packets(member, &src_mac, &bonded_mac, 1); TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst."); retval = bond_rx(pkts, RTE_DIM(pkts)); @@ -967,36 +967,36 @@ test_mode4_rx(void) if (retval > 0) free_pkts(pkts, retval); - while (rte_ring_dequeue(slave->rx_queue, (void **)&pkt) == 0) + while (rte_ring_dequeue(member->rx_queue, (void **)&pkt) == 0) rte_pktmbuf_free(pkt); - if (slave_down_id == slave->port_id) + if (member_down_id == member->port_id) TEST_ASSERT_EQUAL(retval, 0, "Packets received unexpectedly."); else TEST_ASSERT_NOT_EQUAL(retval, 0, - "Expected to receive some packets on slave %u.", - slave->port_id); - rte_eth_dev_start(slave->port_id); + "Expected to receive some packets on member %u.", + member->port_id); + rte_eth_dev_start(member->port_id); for (j = 0; j < 5; j++) { - TEST_ASSERT(bond_handshake_reply(slave) >= 0, + TEST_ASSERT(bond_handshake_reply(member) >= 0, "Handshake after link up"); - if (bond_handshake_done(slave) == 1) + if (bond_handshake_done(member) == 1) break; } - TEST_ASSERT(j < 5, "Failed to aggregate slave after link up"); + TEST_ASSERT(j < 5, "Failed to aggregate member after link up"); } - remove_slaves_and_stop_bonded_device(); + remove_members_and_stop_bonded_device(); return TEST_SUCCESS; } static int test_mode4_tx_burst(void) { - struct slave_conf *slave; + struct member_conf *member; uint16_t i, j; uint16_t exp_pkts_cnt, pkts_cnt = 0; @@ -1008,7 +1008,7 @@ test_mode4_tx_burst(void) { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; struct rte_ether_addr bonded_mac; - retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0); + retval = initialize_bonded_device_with_members(TEST_TX_MEMBER_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); retval = bond_handshake(); @@ -1036,19 +1036,19 @@ test_mode4_tx_burst(void) TEST_ASSERT_EQUAL(retval, pkts_cnt, "TX on bonded device failed"); - /* Check if packets were transmitted properly. Every slave should have + /* Check if packets were transmitted properly. Every member should have * at least one packet, and sum must match. Under normal operation * there should be no LACP nor MARKER frames. */ pkts_cnt = 0; - FOR_EACH_SLAVE(i, slave) { + FOR_EACH_MEMBER(i, member) { uint16_t normal_cnt, slow_cnt; - retval = slave_get_pkts(slave, pkts, RTE_DIM(pkts)); + retval = member_get_pkts(member, pkts, RTE_DIM(pkts)); normal_cnt = 0; slow_cnt = 0; for (j = 0; j < retval; j++) { - if (make_lacp_reply(slave, pkts[j]) == 1) + if (make_lacp_reply(member, pkts[j]) == 1) normal_cnt++; else slow_cnt++; @@ -1056,11 +1056,11 @@ test_mode4_tx_burst(void) free_pkts(pkts, normal_cnt + slow_cnt); TEST_ASSERT_EQUAL(slow_cnt, 0, - "slave %u unexpectedly transmitted %d SLOW packets", slave->port_id, + "member %u unexpectedly transmitted %d SLOW packets", member->port_id, slow_cnt); TEST_ASSERT_NOT_EQUAL(normal_cnt, 0, - "slave %u did not transmitted any packets", slave->port_id); + "member %u did not transmitted any packets", member->port_id); pkts_cnt += normal_cnt; } @@ -1068,19 +1068,21 @@ test_mode4_tx_burst(void) TEST_ASSERT_EQUAL(exp_pkts_cnt, pkts_cnt, "Expected %u packets but transmitted only %d", exp_pkts_cnt, pkts_cnt); - /* Link down test: - * simulate link down for first slave. */ + /* + * Link down test: + * simulate link down for first member. + */ delay = bond_get_update_timeout_ms(); - uint8_t slave_down_id = INVALID_PORT_ID; + uint8_t member_down_id = INVALID_PORT_ID; - FOR_EACH_SLAVE(i, slave) { - rte_eth_dev_set_link_down(slave->port_id); - slave_down_id = slave->port_id; + FOR_EACH_MEMBER(i, member) { + rte_eth_dev_set_link_down(member->port_id); + member_down_id = member->port_id; break; } - RTE_VERIFY(slave_down_id != INVALID_PORT_ID); + RTE_VERIFY(member_down_id != INVALID_PORT_ID); /* Give some time to rearrange bonding. */ for (i = 0; i < 3; i++) { @@ -1110,19 +1112,19 @@ test_mode4_tx_burst(void) TEST_ASSERT_EQUAL(retval, pkts_cnt, "TX on bonded device failed"); - /* Check if packets was transmitted properly. Every slave should have + /* Check if packets was transmitted properly. Every member should have * at least one packet, and sum must match. Under normal operation * there should be no LACP nor MARKER frames. */ pkts_cnt = 0; - FOR_EACH_SLAVE(i, slave) { + FOR_EACH_MEMBER(i, member) { uint16_t normal_cnt, slow_cnt; - retval = slave_get_pkts(slave, pkts, RTE_DIM(pkts)); + retval = member_get_pkts(member, pkts, RTE_DIM(pkts)); normal_cnt = 0; slow_cnt = 0; for (j = 0; j < retval; j++) { - if (make_lacp_reply(slave, pkts[j]) == 1) + if (make_lacp_reply(member, pkts[j]) == 1) normal_cnt++; else slow_cnt++; @@ -1130,17 +1132,17 @@ test_mode4_tx_burst(void) free_pkts(pkts, normal_cnt + slow_cnt); - if (slave_down_id == slave->port_id) { + if (member_down_id == member->port_id) { TEST_ASSERT_EQUAL(normal_cnt + slow_cnt, 0, - "slave %u enexpectedly transmitted %u packets", - normal_cnt + slow_cnt, slave->port_id); + "member %u enexpectedly transmitted %u packets", + normal_cnt + slow_cnt, member->port_id); } else { TEST_ASSERT_EQUAL(slow_cnt, 0, - "slave %u unexpectedly transmitted %d SLOW packets", - slave->port_id, slow_cnt); + "member %u unexpectedly transmitted %d SLOW packets", + member->port_id, slow_cnt); TEST_ASSERT_NOT_EQUAL(normal_cnt, 0, - "slave %u did not transmitted any packets", slave->port_id); + "member %u did not transmitted any packets", member->port_id); } pkts_cnt += normal_cnt; @@ -1149,11 +1151,11 @@ test_mode4_tx_burst(void) TEST_ASSERT_EQUAL(exp_pkts_cnt, pkts_cnt, "Expected %u packets but transmitted only %d", exp_pkts_cnt, pkts_cnt); - return remove_slaves_and_stop_bonded_device(); + return remove_members_and_stop_bonded_device(); } static void -init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) +init_marker(struct rte_mbuf *pkt, struct member_conf *member) { struct marker_header *marker_hdr = rte_pktmbuf_mtod(pkt, struct marker_header *); @@ -1166,7 +1168,7 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) rte_ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.src_addr); marker_hdr->eth_hdr.src_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = - slave->port_id; + member->port_id; marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW); @@ -1177,7 +1179,7 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) offsetof(struct marker, reserved_90) - offsetof(struct marker, requester_port); RTE_VERIFY(marker_hdr->marker.info_length == 16); - marker_hdr->marker.requester_port = slave->port_id + 1; + marker_hdr->marker.requester_port = member->port_id + 1; marker_hdr->marker.tlv_type_terminator = TLV_TYPE_TERMINATOR_INFORMATION; marker_hdr->marker.terminator_length = 0; } @@ -1185,7 +1187,7 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) static int test_mode4_marker(void) { - struct slave_conf *slave; + struct member_conf *member; struct rte_mbuf *pkts[MAX_PKT_BURST]; struct rte_mbuf *marker_pkt; struct marker_header *marker_hdr; @@ -1196,7 +1198,7 @@ test_mode4_marker(void) uint8_t i, j; const uint16_t ethtype_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); - retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, + retval = initialize_bonded_device_with_members(TEST_MARKER_MEMBER_COUT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -1205,17 +1207,17 @@ test_mode4_marker(void) TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); delay = bond_get_update_timeout_ms(); - FOR_EACH_SLAVE(i, slave) { + FOR_EACH_MEMBER(i, member) { marker_pkt = rte_pktmbuf_alloc(test_params.mbuf_pool); TEST_ASSERT_NOT_NULL(marker_pkt, "Failed to allocate marker packet"); - init_marker(marker_pkt, slave); + init_marker(marker_pkt, member); - retval = slave_put_pkts(slave, &marker_pkt, 1); + retval = member_put_pkts(member, &marker_pkt, 1); if (retval != 1) rte_pktmbuf_free(marker_pkt); TEST_ASSERT_EQUAL(retval, 1, - "Failed to send marker packet to slave %u", slave->port_id); + "Failed to send marker packet to member %u", member->port_id); for (j = 0; j < 20; ++j) { rte_delay_ms(delay); @@ -1233,13 +1235,13 @@ test_mode4_marker(void) /* Check if LACP packet was send by state machines First and only packet must be a maker response */ - retval = slave_get_pkts(slave, pkts, MAX_PKT_BURST); + retval = member_get_pkts(member, pkts, MAX_PKT_BURST); if (retval == 0) continue; if (retval > 1) free_pkts(pkts, retval); - TEST_ASSERT_EQUAL(retval, 1, "failed to get slave packets"); + TEST_ASSERT_EQUAL(retval, 1, "failed to get member packets"); nb_pkts = retval; marker_hdr = rte_pktmbuf_mtod(pkts[0], struct marker_header *); @@ -1263,7 +1265,7 @@ test_mode4_marker(void) TEST_ASSERT(j < 20, "Marker response not found"); } - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); return TEST_SUCCESS; @@ -1272,7 +1274,7 @@ test_mode4_marker(void) static int test_mode4_expired(void) { - struct slave_conf *slave, *exp_slave = NULL; + struct member_conf *member, *exp_member = NULL; struct rte_mbuf *pkts[MAX_PKT_BURST]; int retval; uint32_t old_delay; @@ -1282,7 +1284,7 @@ test_mode4_expired(void) struct rte_eth_bond_8023ad_conf conf; - retval = initialize_bonded_device_with_slaves(TEST_EXPIRED_SLAVE_COUNT, + retval = initialize_bonded_device_with_members(TEST_EXPIRED_MEMBER_COUNT, 0); /* Set custom timeouts to make test last shorter. */ rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf); @@ -1298,8 +1300,8 @@ test_mode4_expired(void) /* Wait for new settings to be applied. */ for (i = 0; i < old_delay/conf.update_timeout_ms * 2; i++) { - FOR_EACH_SLAVE(j, slave) - bond_handshake_reply(slave); + FOR_EACH_MEMBER(j, member) + bond_handshake_reply(member); rte_delay_ms(conf.update_timeout_ms); } @@ -1307,13 +1309,13 @@ test_mode4_expired(void) retval = bond_handshake(); TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); - /* Find first slave */ - FOR_EACH_SLAVE(i, slave) { - exp_slave = slave; + /* Find first member */ + FOR_EACH_MEMBER(i, member) { + exp_member = member; break; } - RTE_VERIFY(exp_slave != NULL); + RTE_VERIFY(exp_member != NULL); /* When one of partners do not send or respond to LACP frame in * conf.long_timeout_ms time, internal state machines should detect this @@ -1325,16 +1327,16 @@ test_mode4_expired(void) TEST_ASSERT_EQUAL(retval, 0, "Unexpectedly received %d packets", retval); - FOR_EACH_SLAVE(i, slave) { - retval = bond_handshake_reply(slave); + FOR_EACH_MEMBER(i, member) { + retval = bond_handshake_reply(member); TEST_ASSERT(retval >= 0, "Handshake failed"); - /* Remove replay for slave that suppose to be expired. */ - if (slave == exp_slave) { - while (rte_ring_count(slave->rx_queue) > 0) { + /* Remove replay for member that suppose to be expired. */ + if (member == exp_member) { + while (rte_ring_count(member->rx_queue) > 0) { void *pkt = NULL; - rte_ring_dequeue(slave->rx_queue, &pkt); + rte_ring_dequeue(member->rx_queue, &pkt); rte_pktmbuf_free(pkt); } } @@ -1348,17 +1350,17 @@ test_mode4_expired(void) retval); } - /* After test only expected slave should be in EXPIRED state */ - FOR_EACH_SLAVE(i, slave) { - if (slave == exp_slave) - TEST_ASSERT(slave->lacp_parnter_state & STATE_EXPIRED, - "Slave %u should be in expired.", slave->port_id); + /* After test only expected member should be in EXPIRED state */ + FOR_EACH_MEMBER(i, member) { + if (member == exp_member) + TEST_ASSERT(member->lacp_parnter_state & STATE_EXPIRED, + "Member %u should be in expired.", member->port_id); else - TEST_ASSERT_EQUAL(bond_handshake_done(slave), 1, - "Slave %u should be operational.", slave->port_id); + TEST_ASSERT_EQUAL(bond_handshake_done(member), 1, + "Member %u should be operational.", member->port_id); } - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); return TEST_SUCCESS; @@ -1372,17 +1374,17 @@ test_mode4_ext_ctrl(void) * . try to transmit lacpdu (should fail) * . try to set collecting and distributing flags (should fail) * reconfigure w/external sm - * . transmit one lacpdu on each slave using new api - * . make sure each slave receives one lacpdu using the callback api - * . transmit one data pdu on each slave (should fail) + * . transmit one lacpdu on each member using new api + * . make sure each member receives one lacpdu using the callback api + * . transmit one data pdu on each member (should fail) * . enable distribution and collection, send one data pdu each again */ int retval; - struct slave_conf *slave = NULL; + struct member_conf *member = NULL; uint8_t i; - struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; + struct rte_mbuf *lacp_tx_buf[MEMBER_COUNT]; struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { @@ -1396,30 +1398,30 @@ test_mode4_ext_ctrl(void) initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac, RTE_ETHER_TYPE_SLOW, 0, 0); - for (i = 0; i < SLAVE_COUNT; i++) { + for (i = 0; i < MEMBER_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); rte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), &lacpdu, sizeof(lacpdu)); rte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu); } - retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0); + retval = initialize_bonded_device_with_members(TEST_TX_MEMBER_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); - FOR_EACH_SLAVE(i, slave) { + FOR_EACH_MEMBER(i, member) { TEST_ASSERT_FAIL(rte_eth_bond_8023ad_ext_slowtx( test_params.bonded_port_id, - slave->port_id, lacp_tx_buf[i]), - "Slave should not allow manual LACP xmit"); + member->port_id, lacp_tx_buf[i]), + "Member should not allow manual LACP xmit"); TEST_ASSERT_FAIL(rte_eth_bond_8023ad_ext_collect( test_params.bonded_port_id, - slave->port_id, 1), - "Slave should not allow external state controls"); + member->port_id, 1), + "Member should not allow external state controls"); } free_pkts(lacp_tx_buf, RTE_DIM(lacp_tx_buf)); - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Bonded device cleanup failed."); return TEST_SUCCESS; @@ -1430,13 +1432,13 @@ static int test_mode4_ext_lacp(void) { int retval; - struct slave_conf *slave = NULL; - uint8_t all_slaves_done = 0, i; + struct member_conf *member = NULL; + uint8_t all_members_done = 0, i; uint16_t nb_pkts; const unsigned int delay = bond_get_update_timeout_ms(); - struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; - struct rte_mbuf *buf[SLAVE_COUNT]; + struct rte_mbuf *lacp_tx_buf[MEMBER_COUNT]; + struct rte_mbuf *buf[MEMBER_COUNT]; struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { @@ -1450,14 +1452,14 @@ test_mode4_ext_lacp(void) initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac, RTE_ETHER_TYPE_SLOW, 0, 0); - for (i = 0; i < SLAVE_COUNT; i++) { + for (i = 0; i < MEMBER_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); rte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), &lacpdu, sizeof(lacpdu)); rte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu); } - retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 1); + retval = initialize_bonded_device_with_members(TEST_TX_MEMBER_COUNT, 1); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); memset(lacpdu_rx_count, 0, sizeof(lacpdu_rx_count)); @@ -1466,22 +1468,22 @@ test_mode4_ext_lacp(void) for (i = 0; i < 30; ++i) rte_delay_ms(delay); - FOR_EACH_SLAVE(i, slave) { + FOR_EACH_MEMBER(i, member) { retval = rte_eth_bond_8023ad_ext_slowtx( test_params.bonded_port_id, - slave->port_id, lacp_tx_buf[i]); + member->port_id, lacp_tx_buf[i]); TEST_ASSERT_SUCCESS(retval, - "Slave should allow manual LACP xmit"); + "Member should allow manual LACP xmit"); } nb_pkts = bond_tx(NULL, 0); TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets transmitted unexpectedly"); - FOR_EACH_SLAVE(i, slave) { - nb_pkts = slave_get_pkts(slave, buf, RTE_DIM(buf)); - TEST_ASSERT_EQUAL(nb_pkts, 1, "found %u packets on slave %d\n", + FOR_EACH_MEMBER(i, member) { + nb_pkts = member_get_pkts(member, buf, RTE_DIM(buf)); + TEST_ASSERT_EQUAL(nb_pkts, 1, "found %u packets on member %d\n", nb_pkts, i); - slave_put_pkts(slave, buf, nb_pkts); + member_put_pkts(member, buf, nb_pkts); } nb_pkts = bond_rx(buf, RTE_DIM(buf)); @@ -1489,26 +1491,26 @@ test_mode4_ext_lacp(void) TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets received unexpectedly"); /* wait for the periodic callback to run */ - for (i = 0; i < 30 && all_slaves_done == 0; ++i) { + for (i = 0; i < 30 && all_members_done == 0; ++i) { uint8_t s, total = 0; rte_delay_ms(delay); - FOR_EACH_SLAVE(s, slave) { - total += lacpdu_rx_count[slave->port_id]; + FOR_EACH_MEMBER(s, member) { + total += lacpdu_rx_count[member->port_id]; } - if (total >= SLAVE_COUNT) - all_slaves_done = 1; + if (total >= MEMBER_COUNT) + all_members_done = 1; } - FOR_EACH_SLAVE(i, slave) { - TEST_ASSERT_EQUAL(lacpdu_rx_count[slave->port_id], 1, - "Slave port %u should have received 1 lacpdu (count=%u)", - slave->port_id, - lacpdu_rx_count[slave->port_id]); + FOR_EACH_MEMBER(i, member) { + TEST_ASSERT_EQUAL(lacpdu_rx_count[member->port_id], 1, + "Member port %u should have received 1 lacpdu (count=%u)", + member->port_id, + lacpdu_rx_count[member->port_id]); } - retval = remove_slaves_and_stop_bonded_device(); + retval = remove_members_and_stop_bonded_device(); TEST_ASSERT_SUCCESS(retval, "Test cleanup failed."); return TEST_SUCCESS; @@ -1517,10 +1519,10 @@ test_mode4_ext_lacp(void) static int check_environment(void) { - struct slave_conf *port; + struct member_conf *port; uint8_t i, env_state; - uint16_t slaves[RTE_DIM(test_params.slave_ports)]; - int slaves_count; + uint16_t members[RTE_DIM(test_params.member_ports)]; + int members_count; env_state = 0; FOR_EACH_PORT(i, port) { @@ -1540,20 +1542,20 @@ check_environment(void) break; } - slaves_count = rte_eth_bond_slaves_get(test_params.bonded_port_id, - slaves, RTE_DIM(slaves)); + members_count = rte_eth_bond_members_get(test_params.bonded_port_id, + members, RTE_DIM(members)); - if (slaves_count != 0) + if (members_count != 0) env_state |= 0x10; TEST_ASSERT_EQUAL(env_state, 0, "Environment not clean (port %u):%s%s%s%s%s", port->port_id, - env_state & 0x01 ? " slave rx queue not clean" : "", - env_state & 0x02 ? " slave tx queue not clean" : "", - env_state & 0x04 ? " port marked as enslaved" : "", - env_state & 0x80 ? " slave state is not reset" : "", - env_state & 0x10 ? " slave count not equal 0" : "."); + env_state & 0x01 ? " member rx queue not clean" : "", + env_state & 0x02 ? " member tx queue not clean" : "", + env_state & 0x04 ? " port marked as enmemberd" : "", + env_state & 0x80 ? " member state is not reset" : "", + env_state & 0x10 ? " member count not equal 0" : "."); return TEST_SUCCESS; @@ -1562,7 +1564,7 @@ check_environment(void) static int test_mode4_executor(int (*test_func)(void)) { - struct slave_conf *port; + struct member_conf *port; int test_result; uint8_t i; void *pkt; @@ -1581,7 +1583,7 @@ test_mode4_executor(int (*test_func)(void)) /* Reset environment in case test failed to do that. */ if (test_result != TEST_SUCCESS) { - TEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(), + TEST_ASSERT_SUCCESS(remove_members_and_stop_bonded_device(), "Failed to stop bonded device"); FOR_EACH_PORT(i, port) { diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index 464fb2dbd0..1f888b4771 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -27,15 +27,15 @@ #include "test.h" -#define SLAVE_COUNT (4) +#define MEMBER_COUNT (4) #define RXTX_RING_SIZE 1024 #define RXTX_QUEUE_COUNT 4 #define BONDED_DEV_NAME ("net_bonding_rss") -#define SLAVE_DEV_NAME_FMT ("net_null%d") -#define SLAVE_RXTX_QUEUE_FMT ("rssconf_slave%d_q%d") +#define MEMBER_DEV_NAME_FMT ("net_null%d") +#define MEMBER_RXTX_QUEUE_FMT ("rssconf_member%d_q%d") #define NUM_MBUFS 8191 #define MBUF_SIZE (1600 + RTE_PKTMBUF_HEADROOM) @@ -46,7 +46,7 @@ #define INVALID_PORT_ID (0xFF) #define INVALID_BONDING_MODE (-1) -struct slave_conf { +struct member_conf { uint16_t port_id; struct rte_eth_dev_info dev_info; @@ -54,7 +54,7 @@ struct slave_conf { uint8_t rss_key[40]; struct rte_eth_rss_reta_entry64 reta_conf[512 / RTE_ETH_RETA_GROUP_SIZE]; - uint8_t is_slave; + uint8_t is_member; struct rte_ring *rxtx_queue[RXTX_QUEUE_COUNT]; }; @@ -62,15 +62,15 @@ struct link_bonding_rssconf_unittest_params { uint8_t bond_port_id; struct rte_eth_dev_info bond_dev_info; struct rte_eth_rss_reta_entry64 bond_reta_conf[512 / RTE_ETH_RETA_GROUP_SIZE]; - struct slave_conf slave_ports[SLAVE_COUNT]; + struct member_conf member_ports[MEMBER_COUNT]; struct rte_mempool *mbuf_pool; }; static struct link_bonding_rssconf_unittest_params test_params = { .bond_port_id = INVALID_PORT_ID, - .slave_ports = { - [0 ... SLAVE_COUNT - 1] = { .port_id = INVALID_PORT_ID, .is_slave = 0} + .member_ports = { + [0 ... MEMBER_COUNT - 1] = { .port_id = INVALID_PORT_ID, .is_member = 0} }, .mbuf_pool = NULL, }; @@ -107,14 +107,14 @@ static struct rte_eth_conf rss_pmd_conf = { #define FOR_EACH(_i, _item, _array, _size) \ for (_i = 0, _item = &_array[0]; _i < _size && (_item = &_array[_i]); _i++) -/* Macro for iterating over every port that can be used as a slave +/* Macro for iterating over every port that can be used as a member * in this test. - * _i variable used as an index in test_params->slave_ports - * _slave pointer to &test_params->slave_ports[_idx] + * _i variable used as an index in test_params->member_ports + * _member pointer to &test_params->member_ports[_idx] */ #define FOR_EACH_PORT(_i, _port) \ - FOR_EACH(_i, _port, test_params.slave_ports, \ - RTE_DIM(test_params.slave_ports)) + FOR_EACH(_i, _port, test_params.member_ports, \ + RTE_DIM(test_params.member_ports)) static int configure_ethdev(uint16_t port_id, struct rte_eth_conf *eth_conf, @@ -151,21 +151,21 @@ configure_ethdev(uint16_t port_id, struct rte_eth_conf *eth_conf, } /** - * Remove all slaves from bonding + * Remove all members from bonding */ static int -remove_slaves(void) +remove_members(void) { unsigned n; - struct slave_conf *port; + struct member_conf *port; FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; - if (port->is_slave) { - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove( + port = &test_params.member_ports[n]; + if (port->is_member) { + TEST_ASSERT_SUCCESS(rte_eth_bond_member_remove( test_params.bond_port_id, port->port_id), - "Cannot remove slave %d from bonding", port->port_id); - port->is_slave = 0; + "Cannot remove member %d from bonding", port->port_id); + port->is_member = 0; } } @@ -173,30 +173,30 @@ remove_slaves(void) } static int -remove_slaves_and_stop_bonded_device(void) +remove_members_and_stop_bonded_device(void) { - TEST_ASSERT_SUCCESS(remove_slaves(), "Removing slaves"); + TEST_ASSERT_SUCCESS(remove_members(), "Removing members"); TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params.bond_port_id), "Failed to stop port %u", test_params.bond_port_id); return TEST_SUCCESS; } /** - * Add all slaves to bonding + * Add all members to bonding */ static int -bond_slaves(void) +bond_members(void) { unsigned n; - struct slave_conf *port; + struct member_conf *port; FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; - if (!port->is_slave) { - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bond_port_id, - port->port_id), "Cannot attach slave %d to the bonding", + port = &test_params.member_ports[n]; + if (!port->is_member) { + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(test_params.bond_port_id, + port->port_id), "Cannot attach member %d to the bonding", port->port_id); - port->is_slave = 1; + port->is_member = 1; } } @@ -223,11 +223,11 @@ reta_set(uint16_t port_id, uint8_t value, int reta_size) } /** - * Check if slaves RETA is synchronized with bonding port. Returns 1 if slave + * Check if members RETA is synchronized with bonding port. Returns 1 if member * port is synced with bonding port. */ static int -reta_check_synced(struct slave_conf *port) +reta_check_synced(struct member_conf *port) { unsigned i; @@ -264,10 +264,10 @@ bond_reta_fetch(void) { } /** - * Fetch slaves RETA + * Fetch members RETA */ static int -slave_reta_fetch(struct slave_conf *port) { +member_reta_fetch(struct member_conf *port) { unsigned j; for (j = 0; j < port->dev_info.reta_size / RTE_ETH_RETA_GROUP_SIZE; j++) @@ -280,49 +280,49 @@ slave_reta_fetch(struct slave_conf *port) { } /** - * Remove and add slave to check if slaves configuration is synced with - * the bonding ports values after adding new slave. + * Remove and add member to check if members configuration is synced with + * the bonding ports values after adding new member. */ static int -slave_remove_and_add(void) +member_remove_and_add(void) { - struct slave_conf *port = &(test_params.slave_ports[0]); + struct member_conf *port = &(test_params.member_ports[0]); - /* 1. Remove first slave from bonding */ - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params.bond_port_id, - port->port_id), "Cannot remove slave #d from bonding"); + /* 1. Remove first member from bonding */ + TEST_ASSERT_SUCCESS(rte_eth_bond_member_remove(test_params.bond_port_id, + port->port_id), "Cannot remove member #d from bonding"); - /* 2. Change removed (ex-)slave and bonding configuration to different + /* 2. Change removed (ex-)member and bonding configuration to different * values */ reta_set(test_params.bond_port_id, 1, test_params.bond_dev_info.reta_size); bond_reta_fetch(); reta_set(port->port_id, 2, port->dev_info.reta_size); - slave_reta_fetch(port); + member_reta_fetch(port); TEST_ASSERT(reta_check_synced(port) == 0, - "Removed slave didn't should be synchronized with bonding port"); + "Removed member didn't should be synchronized with bonding port"); - /* 3. Add (ex-)slave and check if configuration changed*/ - TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bond_port_id, - port->port_id), "Cannot add slave"); + /* 3. Add (ex-)member and check if configuration changed*/ + TEST_ASSERT_SUCCESS(rte_eth_bond_member_add(test_params.bond_port_id, + port->port_id), "Cannot add member"); bond_reta_fetch(); - slave_reta_fetch(port); + member_reta_fetch(port); return reta_check_synced(port); } /** - * Test configuration propagation over slaves. + * Test configuration propagation over members. */ static int test_propagate(void) { unsigned i; uint8_t n; - struct slave_conf *port; + struct member_conf *port; uint8_t bond_rss_key[40]; struct rte_eth_rss_conf bond_rss_conf; @@ -349,18 +349,18 @@ test_propagate(void) retval = rte_eth_dev_rss_hash_update(test_params.bond_port_id, &bond_rss_conf); - TEST_ASSERT_SUCCESS(retval, "Cannot set slaves hash function"); + TEST_ASSERT_SUCCESS(retval, "Cannot set members hash function"); FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; retval = rte_eth_dev_rss_hash_conf_get(port->port_id, &port->rss_conf); TEST_ASSERT_SUCCESS(retval, - "Cannot take slaves RSS configuration"); + "Cannot take members RSS configuration"); TEST_ASSERT(port->rss_conf.rss_hf == rss_hf, - "Hash function not propagated for slave %d", + "Hash function not propagated for member %d", port->port_id); } @@ -376,11 +376,11 @@ test_propagate(void) /* Set all keys to zero */ FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; memset(port->rss_conf.rss_key, 0, 40); retval = rte_eth_dev_rss_hash_update(port->port_id, &port->rss_conf); - TEST_ASSERT_SUCCESS(retval, "Cannot set slaves RSS keys"); + TEST_ASSERT_SUCCESS(retval, "Cannot set members RSS keys"); } memset(bond_rss_key, i, sizeof(bond_rss_key)); @@ -393,18 +393,18 @@ test_propagate(void) TEST_ASSERT_SUCCESS(retval, "Cannot set bonded port RSS keys"); FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; retval = rte_eth_dev_rss_hash_conf_get(port->port_id, &(port->rss_conf)); TEST_ASSERT_SUCCESS(retval, - "Cannot take slaves RSS configuration"); + "Cannot take members RSS configuration"); /* compare keys */ retval = memcmp(port->rss_conf.rss_key, bond_rss_key, sizeof(bond_rss_key)); - TEST_ASSERT(retval == 0, "Key value not propagated for slave %d", + TEST_ASSERT(retval == 0, "Key value not propagated for member %d", port->port_id); } } @@ -416,10 +416,10 @@ test_propagate(void) /* Set all keys to zero */ FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; retval = reta_set(port->port_id, (i + 1) % RXTX_QUEUE_COUNT, port->dev_info.reta_size); - TEST_ASSERT_SUCCESS(retval, "Cannot set slaves RETA"); + TEST_ASSERT_SUCCESS(retval, "Cannot set members RETA"); } TEST_ASSERT_SUCCESS(reta_set(test_params.bond_port_id, @@ -429,9 +429,9 @@ test_propagate(void) bond_reta_fetch(); FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; - slave_reta_fetch(port); + member_reta_fetch(port); TEST_ASSERT(reta_check_synced(port) == 1, "RETAs inconsistent"); } } @@ -459,29 +459,29 @@ test_rss(void) "Error during getting device (port %u) info: %s\n", test_params.bond_port_id, strerror(-ret)); - TEST_ASSERT_SUCCESS(bond_slaves(), "Bonding slaves failed"); + TEST_ASSERT_SUCCESS(bond_members(), "Bonding members failed"); TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bond_port_id), "Failed to start bonding port (%d).", test_params.bond_port_id); TEST_ASSERT_SUCCESS(test_propagate(), "Propagation test failed"); - TEST_ASSERT(slave_remove_and_add() == 1, "remove and add slaves success."); + TEST_ASSERT(member_remove_and_add() == 1, "remove and add members success."); - remove_slaves_and_stop_bonded_device(); + remove_members_and_stop_bonded_device(); return TEST_SUCCESS; } /** - * Test RSS configuration over bonded and slaves. + * Test RSS configuration over bonded and members. */ static int test_rss_config_lazy(void) { struct rte_eth_rss_conf bond_rss_conf = {0}; - struct slave_conf *port; + struct member_conf *port; uint8_t rss_key[40]; uint64_t rss_hf; int retval; @@ -502,18 +502,18 @@ test_rss_config_lazy(void) TEST_ASSERT(retval != 0, "Succeeded in setting bonded port hash function"); } - /* Set all keys to zero for all slaves */ + /* Set all keys to zero for all members */ FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; retval = rte_eth_dev_rss_hash_conf_get(port->port_id, &port->rss_conf); - TEST_ASSERT_SUCCESS(retval, "Cannot get slaves RSS configuration"); + TEST_ASSERT_SUCCESS(retval, "Cannot get members RSS configuration"); memset(port->rss_key, 0, sizeof(port->rss_key)); port->rss_conf.rss_key = port->rss_key; port->rss_conf.rss_key_len = sizeof(port->rss_key); retval = rte_eth_dev_rss_hash_update(port->port_id, &port->rss_conf); - TEST_ASSERT(retval != 0, "Succeeded in setting slaves RSS keys"); + TEST_ASSERT(retval != 0, "Succeeded in setting members RSS keys"); } /* Set RSS keys for bonded port */ @@ -529,10 +529,10 @@ test_rss_config_lazy(void) /* Test RETA propagation */ for (i = 0; i < RXTX_QUEUE_COUNT; i++) { FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; retval = reta_set(port->port_id, (i + 1) % RXTX_QUEUE_COUNT, port->dev_info.reta_size); - TEST_ASSERT(retval != 0, "Succeeded in setting slaves RETA"); + TEST_ASSERT(retval != 0, "Succeeded in setting members RETA"); } retval = reta_set(test_params.bond_port_id, i % RXTX_QUEUE_COUNT, @@ -560,14 +560,14 @@ test_rss_lazy(void) "Error during getting device (port %u) info: %s\n", test_params.bond_port_id, strerror(-ret)); - TEST_ASSERT_SUCCESS(bond_slaves(), "Bonding slaves failed"); + TEST_ASSERT_SUCCESS(bond_members(), "Bonding members failed"); TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bond_port_id), "Failed to start bonding port (%d).", test_params.bond_port_id); TEST_ASSERT_SUCCESS(test_rss_config_lazy(), "Succeeded in setting RSS hash when RX_RSS mq_mode is turned off"); - remove_slaves_and_stop_bonded_device(); + remove_members_and_stop_bonded_device(); return TEST_SUCCESS; } @@ -579,13 +579,13 @@ test_setup(void) int retval; int port_id; char name[256]; - struct slave_conf *port; + struct member_conf *port; struct rte_ether_addr mac_addr = { .addr_bytes = {0} }; if (test_params.mbuf_pool == NULL) { test_params.mbuf_pool = rte_pktmbuf_pool_create( - "RSS_MBUF_POOL", NUM_MBUFS * SLAVE_COUNT, + "RSS_MBUF_POOL", NUM_MBUFS * MEMBER_COUNT, MBUF_CACHE_SIZE, 0, MBUF_SIZE, rte_socket_id()); TEST_ASSERT(test_params.mbuf_pool != NULL, @@ -594,10 +594,10 @@ test_setup(void) /* Create / initialize ring eth devs. */ FOR_EACH_PORT(n, port) { - port = &test_params.slave_ports[n]; + port = &test_params.member_ports[n]; port_id = rte_eth_dev_count_avail(); - snprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id); + snprintf(name, sizeof(name), MEMBER_DEV_NAME_FMT, port_id); retval = rte_vdev_init(name, "size=64,copy=0"); TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n", @@ -647,7 +647,7 @@ test_setup(void) static void testsuite_teardown(void) { - struct slave_conf *port; + struct member_conf *port; uint8_t i; /* Only stop ports. @@ -685,7 +685,7 @@ test_rssconf_executor(int (*test_func)(void)) /* Reset environment in case test failed to do that. */ if (test_result != TEST_SUCCESS) { - TEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(), + TEST_ASSERT_SUCCESS(remove_members_and_stop_bonded_device(), "Failed to stop bonded device"); } diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst b/doc/guides/howto/lm_bond_virtio_sriov.rst index e854ae214e..c06d1bc43c 100644 --- a/doc/guides/howto/lm_bond_virtio_sriov.rst +++ b/doc/guides/howto/lm_bond_virtio_sriov.rst @@ -17,8 +17,8 @@ Test Setup ---------- A bonded device is created in the VM. -The virtio and VF PMD's are added as slaves to the bonded device. -The VF is set as the primary slave of the bonded device. +The virtio and VF PMD's are added as members to the bonded device. +The VF is set as the primary member of the bonded device. A bridge must be set up on the Host connecting the tap device, which is the backend of the Virtio device and the Physical Function (PF) device. @@ -116,13 +116,13 @@ Bonding is port 2 (P2). testpmd> create bonded device 1 0 Created new bonded device net_bond_testpmd_0 on (port 2). - testpmd> add bonding slave 0 2 - testpmd> add bonding slave 1 2 + testpmd> add bonding member 0 2 + testpmd> add bonding member 1 2 testpmd> show bonding config 2 The syntax of the ``testpmd`` command is: -set bonding primary (slave id) (port id) +set bonding primary (member id) (port id) Set primary to P1 before starting bonding port. @@ -139,7 +139,7 @@ Set primary to P1 before starting bonding port. testpmd> show bonding config 2 -Primary is now P1. There are 2 active slaves. +Primary is now P1. There are 2 active members. Use P2 only for forwarding. @@ -151,7 +151,7 @@ Use P2 only for forwarding. testpmd> start testpmd> show bonding config 2 -Primary is now P1. There are 2 active slaves. +Primary is now P1. There are 2 active members. .. code-block:: console @@ -163,10 +163,10 @@ VF traffic is seen at P1 and P2. testpmd> clear port stats all testpmd> set bonding primary 0 2 - testpmd> remove bonding slave 1 2 + testpmd> remove bonding member 1 2 testpmd> show bonding config 2 -Primary is now P0. There is 1 active slave. +Primary is now P0. There is 1 active member. .. code-block:: console @@ -210,7 +210,7 @@ On host_server_1: Terminal 1 testpmd> show bonding config 2 -Primary is now P0. There is 1 active slave. +Primary is now P0. There is 1 active member. .. code-block:: console @@ -346,7 +346,7 @@ The ``mac_addr`` command only works with the Kernel PF for Niantic. testpmd> show port stats all. testpmd> show config fwd testpmd> show bonding config 2 - testpmd> add bonding slave 1 2 + testpmd> add bonding member 1 2 testpmd> set bonding primary 1 2 testpmd> show bonding config 2 testpmd> show port stats all @@ -355,7 +355,7 @@ VF traffic is seen at P1 (VF) and P2 (Bonded device). .. code-block:: console - testpmd> remove bonding slave 0 2 + testpmd> remove bonding member 0 2 testpmd> show bonding config 2 testpmd> port stop 0 testpmd> port close 0 diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst index 0b09b0c50a..43b2622022 100644 --- a/doc/guides/nics/bnxt.rst +++ b/doc/guides/nics/bnxt.rst @@ -781,8 +781,8 @@ DPDK implements a light-weight library to allow PMDs to be bonded together and p .. code-block:: console -   dpdk-testpmd -l 0-3 -n4 --vdev 'net_bonding0,mode=0,slave=,slave=,mac=XX:XX:XX:XX:XX:XX’ – --socket_num=1 – -i --port-topology=chained - (ex) dpdk-testpmd -l 1,3,5,7,9 -n4 --vdev 'net_bonding0,mode=0,slave=0000:82:00.0,slave=0000:82:00.1,mac=00:1e:67:1d:fd:1d' – --socket-num=1 – -i --port-topology=chained +   dpdk-testpmd -l 0-3 -n4 --vdev 'net_bonding0,mode=0,member=,member=,mac=XX:XX:XX:XX:XX:XX’ – --socket_num=1 – -i --port-topology=chained + (ex) dpdk-testpmd -l 1,3,5,7,9 -n4 --vdev 'net_bonding0,mode=0,member=0000:82:00.0,member=0000:82:00.1,mac=00:1e:67:1d:fd:1d' – --socket-num=1 – -i --port-topology=chained Vector Processing ----------------- diff --git a/doc/guides/prog_guide/img/bond-mode-1.svg b/doc/guides/prog_guide/img/bond-mode-1.svg index 7c81b856b7..5a9271facf 100644 --- a/doc/guides/prog_guide/img/bond-mode-1.svg +++ b/doc/guides/prog_guide/img/bond-mode-1.svg @@ -53,7 +53,7 @@ v:langID="1033" v:metric="true" v:viewMarkup="false">/app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=0,slave=0000:0a:00.01,slave=0000:04:00.00' -- --port-topology=chained + .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=0,member=0000:0a:00.01,member=0000:04:00.00' -- --port-topology=chained -Create a bonded device in round robin mode with two slaves specified by their PCI address and an overriding MAC address: +Create a bonded device in round robin mode with two members specified by their PCI address and an overriding MAC address: .. code-block:: console - .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=0,slave=0000:0a:00.01,slave=0000:04:00.00,mac=00:1e:67:1d:fd:1d' -- --port-topology=chained + .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=0,member=0000:0a:00.01,member=0000:04:00.00,mac=00:1e:67:1d:fd:1d' -- --port-topology=chained -Create a bonded device in active backup mode with two slaves specified, and a primary slave specified by their PCI addresses: +Create a bonded device in active backup mode with two members specified, and a primary member specified by their PCI addresses: .. code-block:: console - .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=1,slave=0000:0a:00.01,slave=0000:04:00.00,primary=0000:0a:00.01' -- --port-topology=chained + .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=1,member=0000:0a:00.01,member=0000:04:00.00,primary=0000:0a:00.01' -- --port-topology=chained -Create a bonded device in balance mode with two slaves specified by their PCI addresses, and a transmission policy of layer 3 + 4 forwarding: +Create a bonded device in balance mode with two members specified by their PCI addresses, and a transmission policy of layer 3 + 4 forwarding: .. code-block:: console - .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=2,slave=0000:0a:00.01,slave=0000:04:00.00,xmit_policy=l34' -- --port-topology=chained + .//app/dpdk-testpmd -l 0-3 -n 4 --vdev 'net_bonding0,mode=2,member=0000:0a:00.01,member=0000:04:00.00,xmit_policy=l34' -- --port-topology=chained .. _bonding_testpmd_commands: @@ -517,28 +517,28 @@ For example, to create a bonded device in mode 1 on socket 0:: testpmd> create bonded device 1 0 created new bonded device (port X) -add bonding slave +add bonding member ~~~~~~~~~~~~~~~~~ Adds Ethernet device to a Link Bonding device:: - testpmd> add bonding slave (slave id) (port id) + testpmd> add bonding member (member id) (port id) For example, to add Ethernet device (port 6) to a Link Bonding device (port 10):: - testpmd> add bonding slave 6 10 + testpmd> add bonding member 6 10 -remove bonding slave +remove bonding member ~~~~~~~~~~~~~~~~~~~~ -Removes an Ethernet slave device from a Link Bonding device:: +Removes an Ethernet member device from a Link Bonding device:: - testpmd> remove bonding slave (slave id) (port id) + testpmd> remove bonding member (member id) (port id) -For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10):: +For example, to remove Ethernet member device (port 6) to a Link Bonding device (port 10):: - testpmd> remove bonding slave 6 10 + testpmd> remove bonding member 6 10 set bonding mode ~~~~~~~~~~~~~~~~ @@ -554,11 +554,11 @@ For example, to set the bonding mode of a Link Bonding device (port 10) to broad set bonding primary ~~~~~~~~~~~~~~~~~~~ -Set an Ethernet slave device as the primary device on a Link Bonding device:: +Set an Ethernet member device as the primary device on a Link Bonding device:: - testpmd> set bonding primary (slave id) (port id) + testpmd> set bonding primary (member id) (port id) -For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10):: +For example, to set the Ethernet member device (port 6) as the primary port of a Link Bonding device (port 10):: testpmd> set bonding primary 6 10 @@ -590,7 +590,7 @@ set bonding mon_period Set the link status monitoring polling period in milliseconds for a bonding device. -This adds support for PMD slave devices which do not support link status interrupts. +This adds support for PMD member devices which do not support link status interrupts. When the mon_period is set to a value greater than 0 then all PMD's which do not support link status ISR will be queried every polling interval to check if their link status has changed:: @@ -604,7 +604,7 @@ For example, to set the link status monitoring polling period of bonded device ( set bonding lacp dedicated_queue ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic +Enable dedicated tx/rx queues on bonding devices members to handle LACP control plane traffic when in mode 4 (link-aggregation-802.3ad):: testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable) @@ -627,13 +627,13 @@ it also shows link-aggregation-802.3ad information if the link mode is mode 4:: testpmd> show bonding config (port id) For example, -to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4) +to show the configuration a Link Bonding device (port 9) with 3 member devices (1, 3, 4) in balance mode with a transmission policy of layer 2+3:: testpmd> show bonding config 9 - Dev basic: Bonding mode: BALANCE(2) Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23 - Slaves (3): [1 3 4] - Active Slaves (3): [1 3 4] + Members (3): [1 3 4] + Active Members (3): [1 3 4] Primary: [3] diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c index b3c12cada0..1fe85839ed 100644 --- a/drivers/net/bonding/bonding_testpmd.c +++ b/drivers/net/bonding/bonding_testpmd.c @@ -279,7 +279,7 @@ struct cmd_set_bonding_primary_result { cmdline_fixed_string_t set; cmdline_fixed_string_t bonding; cmdline_fixed_string_t primary; - portid_t slave_id; + portid_t member_id; portid_t port_id; }; @@ -287,13 +287,13 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { struct cmd_set_bonding_primary_result *res = parsed_result; - portid_t master_port_id = res->port_id; - portid_t slave_port_id = res->slave_id; + portid_t main_port_id = res->port_id; + portid_t member_port_id = res->member_id; - /* Set the primary slave for a bonded device. */ - if (rte_eth_bond_primary_set(master_port_id, slave_port_id) != 0) { - fprintf(stderr, "\t Failed to set primary slave for port = %d.\n", - master_port_id); + /* Set the primary member for a bonded device. */ + if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) { + fprintf(stderr, "\t Failed to set primary member for port = %d.\n", + main_port_id); return; } init_port_config(); @@ -308,141 +308,141 @@ static cmdline_parse_token_string_t cmd_setbonding_primary_bonding = static cmdline_parse_token_string_t cmd_setbonding_primary_primary = TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_primary_result, primary, "primary"); -static cmdline_parse_token_num_t cmd_setbonding_primary_slave = +static cmdline_parse_token_num_t cmd_setbonding_primary_member = TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_primary_result, - slave_id, RTE_UINT16); + member_id, RTE_UINT16); static cmdline_parse_token_num_t cmd_setbonding_primary_port = TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_primary_result, port_id, RTE_UINT16); static cmdline_parse_inst_t cmd_set_bonding_primary = { .f = cmd_set_bonding_primary_parsed, - .help_str = "set bonding primary : " - "Set the primary slave for port_id", + .help_str = "set bonding primary : " + "Set the primary member for port_id", .data = NULL, .tokens = { (void *)&cmd_setbonding_primary_set, (void *)&cmd_setbonding_primary_bonding, (void *)&cmd_setbonding_primary_primary, - (void *)&cmd_setbonding_primary_slave, + (void *)&cmd_setbonding_primary_member, (void *)&cmd_setbonding_primary_port, NULL } }; -/* *** ADD SLAVE *** */ -struct cmd_add_bonding_slave_result { +/* *** ADD Member *** */ +struct cmd_add_bonding_member_result { cmdline_fixed_string_t add; cmdline_fixed_string_t bonding; - cmdline_fixed_string_t slave; - portid_t slave_id; + cmdline_fixed_string_t member; + portid_t member_id; portid_t port_id; }; -static void cmd_add_bonding_slave_parsed(void *parsed_result, +static void cmd_add_bonding_member_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { - struct cmd_add_bonding_slave_result *res = parsed_result; - portid_t master_port_id = res->port_id; - portid_t slave_port_id = res->slave_id; + struct cmd_add_bonding_member_result *res = parsed_result; + portid_t main_port_id = res->port_id; + portid_t member_port_id = res->member_id; - /* add the slave for a bonded device. */ - if (rte_eth_bond_slave_add(master_port_id, slave_port_id) != 0) { + /* add the member for a bonded device. */ + if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0) { fprintf(stderr, - "\t Failed to add slave %d to master port = %d.\n", - slave_port_id, master_port_id); + "\t Failed to add member %d to main port = %d.\n", + member_port_id, main_port_id); return; } - ports[master_port_id].update_conf = 1; + ports[main_port_id].update_conf = 1; init_port_config(); - set_port_slave_flag(slave_port_id); + set_port_member_flag(member_port_id); } -static cmdline_parse_token_string_t cmd_addbonding_slave_add = - TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_slave_result, +static cmdline_parse_token_string_t cmd_addbonding_member_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_member_result, add, "add"); -static cmdline_parse_token_string_t cmd_addbonding_slave_bonding = - TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_slave_result, +static cmdline_parse_token_string_t cmd_addbonding_member_bonding = + TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_member_result, bonding, "bonding"); -static cmdline_parse_token_string_t cmd_addbonding_slave_slave = - TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_slave_result, - slave, "slave"); -static cmdline_parse_token_num_t cmd_addbonding_slave_slaveid = - TOKEN_NUM_INITIALIZER(struct cmd_add_bonding_slave_result, - slave_id, RTE_UINT16); -static cmdline_parse_token_num_t cmd_addbonding_slave_port = - TOKEN_NUM_INITIALIZER(struct cmd_add_bonding_slave_result, +static cmdline_parse_token_string_t cmd_addbonding_member_member = + TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_member_result, + member, "member"); +static cmdline_parse_token_num_t cmd_addbonding_member_memberid = + TOKEN_NUM_INITIALIZER(struct cmd_add_bonding_member_result, + member_id, RTE_UINT16); +static cmdline_parse_token_num_t cmd_addbonding_member_port = + TOKEN_NUM_INITIALIZER(struct cmd_add_bonding_member_result, port_id, RTE_UINT16); -static cmdline_parse_inst_t cmd_add_bonding_slave = { - .f = cmd_add_bonding_slave_parsed, - .help_str = "add bonding slave : " - "Add a slave device to a bonded device", +static cmdline_parse_inst_t cmd_add_bonding_member = { + .f = cmd_add_bonding_member_parsed, + .help_str = "add bonding member : " + "Add a member device to a bonded device", .data = NULL, .tokens = { - (void *)&cmd_addbonding_slave_add, - (void *)&cmd_addbonding_slave_bonding, - (void *)&cmd_addbonding_slave_slave, - (void *)&cmd_addbonding_slave_slaveid, - (void *)&cmd_addbonding_slave_port, + (void *)&cmd_addbonding_member_add, + (void *)&cmd_addbonding_member_bonding, + (void *)&cmd_addbonding_member_member, + (void *)&cmd_addbonding_member_memberid, + (void *)&cmd_addbonding_member_port, NULL } }; -/* *** REMOVE SLAVE *** */ -struct cmd_remove_bonding_slave_result { +/* *** REMOVE Member *** */ +struct cmd_remove_bonding_member_result { cmdline_fixed_string_t remove; cmdline_fixed_string_t bonding; - cmdline_fixed_string_t slave; - portid_t slave_id; + cmdline_fixed_string_t member; + portid_t member_id; portid_t port_id; }; -static void cmd_remove_bonding_slave_parsed(void *parsed_result, +static void cmd_remove_bonding_member_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { - struct cmd_remove_bonding_slave_result *res = parsed_result; - portid_t master_port_id = res->port_id; - portid_t slave_port_id = res->slave_id; + struct cmd_remove_bonding_member_result *res = parsed_result; + portid_t main_port_id = res->port_id; + portid_t member_port_id = res->member_id; - /* remove the slave from a bonded device. */ - if (rte_eth_bond_slave_remove(master_port_id, slave_port_id) != 0) { + /* remove the member from a bonded device. */ + if (rte_eth_bond_member_remove(main_port_id, member_port_id) != 0) { fprintf(stderr, - "\t Failed to remove slave %d from master port = %d.\n", - slave_port_id, master_port_id); + "\t Failed to remove member %d from main port = %d.\n", + member_port_id, main_port_id); return; } init_port_config(); - clear_port_slave_flag(slave_port_id); + clear_port_member_flag(member_port_id); } -static cmdline_parse_token_string_t cmd_removebonding_slave_remove = - TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_slave_result, +static cmdline_parse_token_string_t cmd_removebonding_member_remove = + TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_member_result, remove, "remove"); -static cmdline_parse_token_string_t cmd_removebonding_slave_bonding = - TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_slave_result, +static cmdline_parse_token_string_t cmd_removebonding_member_bonding = + TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_member_result, bonding, "bonding"); -static cmdline_parse_token_string_t cmd_removebonding_slave_slave = - TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_slave_result, - slave, "slave"); -static cmdline_parse_token_num_t cmd_removebonding_slave_slaveid = - TOKEN_NUM_INITIALIZER(struct cmd_remove_bonding_slave_result, - slave_id, RTE_UINT16); -static cmdline_parse_token_num_t cmd_removebonding_slave_port = - TOKEN_NUM_INITIALIZER(struct cmd_remove_bonding_slave_result, +static cmdline_parse_token_string_t cmd_removebonding_member_member = + TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_member_result, + member, "member"); +static cmdline_parse_token_num_t cmd_removebonding_member_memberid = + TOKEN_NUM_INITIALIZER(struct cmd_remove_bonding_member_result, + member_id, RTE_UINT16); +static cmdline_parse_token_num_t cmd_removebonding_member_port = + TOKEN_NUM_INITIALIZER(struct cmd_remove_bonding_member_result, port_id, RTE_UINT16); -static cmdline_parse_inst_t cmd_remove_bonding_slave = { - .f = cmd_remove_bonding_slave_parsed, - .help_str = "remove bonding slave : " - "Remove a slave device from a bonded device", +static cmdline_parse_inst_t cmd_remove_bonding_member = { + .f = cmd_remove_bonding_member_parsed, + .help_str = "remove bonding member : " + "Remove a member device from a bonded device", .data = NULL, .tokens = { - (void *)&cmd_removebonding_slave_remove, - (void *)&cmd_removebonding_slave_bonding, - (void *)&cmd_removebonding_slave_slave, - (void *)&cmd_removebonding_slave_slaveid, - (void *)&cmd_removebonding_slave_port, + (void *)&cmd_removebonding_member_remove, + (void *)&cmd_removebonding_member_bonding, + (void *)&cmd_removebonding_member_member, + (void *)&cmd_removebonding_member_memberid, + (void *)&cmd_removebonding_member_port, NULL } }; @@ -706,18 +706,18 @@ static struct testpmd_driver_commands bonding_cmds = { }, { &cmd_set_bonding_primary, - "set bonding primary (slave_id) (port_id)\n" - " Set the primary slave for a bonded device.\n", + "set bonding primary (member_id) (port_id)\n" + " Set the primary member for a bonded device.\n", }, { - &cmd_add_bonding_slave, - "add bonding slave (slave_id) (port_id)\n" - " Add a slave device to a bonded device.\n", + &cmd_add_bonding_member, + "add bonding member (member_id) (port_id)\n" + " Add a member device to a bonded device.\n", }, { - &cmd_remove_bonding_slave, - "remove bonding slave (slave_id) (port_id)\n" - " Remove a slave device from a bonded device.\n", + &cmd_remove_bonding_member, + "remove bonding member (member_id) (port_id)\n" + " Remove a member device from a bonded device.\n", }, { &cmd_create_bonded_device, diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h index a5e1fffea1..9d35d8aa47 100644 --- a/drivers/net/bonding/eth_bond_8023ad_private.h +++ b/drivers/net/bonding/eth_bond_8023ad_private.h @@ -15,10 +15,10 @@ #include "rte_eth_bond_8023ad.h" #define BOND_MODE_8023AX_UPDATE_TIMEOUT_MS 100 -/** Maximum number of packets to one slave queued in TX ring. */ -#define BOND_MODE_8023AX_SLAVE_RX_PKTS 3 -/** Maximum number of LACP packets from one slave queued in TX ring. */ -#define BOND_MODE_8023AX_SLAVE_TX_PKTS 1 +/** Maximum number of packets to one member queued in TX ring. */ +#define BOND_MODE_8023AX_Member_RX_PKTS 3 +/** Maximum number of LACP packets from one member queued in TX ring. */ +#define BOND_MODE_8023AX_Member_TX_PKTS 1 /** * Timeouts definitions (5.4.4 in 802.1AX documentation). */ @@ -113,7 +113,7 @@ struct port { enum rte_bond_8023ad_selection selected; /** Indicates if either allmulti or promisc has been enforced on the - * slave so that we can receive lacp packets + * member so that we can receive lacp packets */ #define BOND_8023AD_FORCED_ALLMULTI (1 << 0) #define BOND_8023AD_FORCED_PROMISC (1 << 1) @@ -162,8 +162,8 @@ struct mode8023ad_private { uint8_t external_sm; struct rte_ether_addr mac_addr; - struct rte_eth_link slave_link; - /***< slave link properties */ + struct rte_eth_link member_link; + /***< member link properties */ /** * Configuration of dedicated hardware queues for control plane @@ -208,7 +208,7 @@ bond_mode_8023ad_setup(struct rte_eth_dev *dev, /** * @internal * - * Enables 802.1AX mode and all active slaves on bonded interface. + * Enables 802.1AX mode and all active members on bonded interface. * * @param dev Bonded interface * @return @@ -220,7 +220,7 @@ bond_mode_8023ad_enable(struct rte_eth_dev *dev); /** * @internal * - * Disables 802.1AX mode of the bonded interface and slaves. + * Disables 802.1AX mode of the bonded interface and members. * * @param dev Bonded interface * @return @@ -256,43 +256,43 @@ bond_mode_8023ad_stop(struct rte_eth_dev *dev); * * Passes given slow packet to state machines management logic. * @param internals Bonded device private data. - * @param slave_id Slave port id. + * @param member_id Member port id. * @param slot_pkt Slow packet. */ void bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, - uint16_t slave_id, struct rte_mbuf *pkt); + uint16_t member_id, struct rte_mbuf *pkt); /** * @internal * - * Appends given slave used slave + * Appends given member used member * * @param dev Bonded interface. - * @param port_id Slave port ID to be added + * @param port_id Member port ID to be added * * @return * 0 on success, negative value otherwise. */ void -bond_mode_8023ad_activate_slave(struct rte_eth_dev *dev, uint16_t port_id); +bond_mode_8023ad_activate_member(struct rte_eth_dev *dev, uint16_t port_id); /** * @internal * - * Denitializes and removes given slave from 802.1AX mode. + * Denitializes and removes given member from 802.1AX mode. * * @param dev Bonded interface. - * @param slave_num Position of slave in active_slaves array + * @param member_num Position of member in active_members array * * @return * 0 on success, negative value otherwise. */ int -bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *dev, uint16_t slave_pos); +bond_mode_8023ad_deactivate_member(struct rte_eth_dev *dev, uint16_t member_pos); /** - * Updates state when MAC was changed on bonded device or one of its slaves. + * Updates state when MAC was changed on bonded device or one of its members. * @param bond_dev Bonded device */ void @@ -300,10 +300,10 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev); int bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, - uint16_t slave_port); + uint16_t member_port); int -bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port); +bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t member_port); int bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id); diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h index d4f1fb27d4..93d03b0a79 100644 --- a/drivers/net/bonding/eth_bond_private.h +++ b/drivers/net/bonding/eth_bond_private.h @@ -18,8 +18,8 @@ #include "eth_bond_8023ad_private.h" #include "rte_eth_bond_alb.h" -#define PMD_BOND_SLAVE_PORT_KVARG ("slave") -#define PMD_BOND_PRIMARY_SLAVE_KVARG ("primary") +#define PMD_BOND_MEMBER_PORT_KVARG ("member") +#define PMD_BOND_PRIMARY_MEMBER_KVARG ("primary") #define PMD_BOND_MODE_KVARG ("mode") #define PMD_BOND_AGG_MODE_KVARG ("agg_mode") #define PMD_BOND_XMIT_POLICY_KVARG ("xmit_policy") @@ -50,8 +50,8 @@ extern const struct rte_flow_ops bond_flow_ops; /** Port Queue Mapping Structure */ struct bond_rx_queue { uint16_t queue_id; - /**< Next active_slave to poll */ - uint16_t active_slave; + /**< Next active_member to poll */ + uint16_t active_member; /**< Queue Id */ struct bond_dev_private *dev_private; /**< Reference to eth_dev private structure */ @@ -74,19 +74,19 @@ struct bond_tx_queue { /**< Copy of TX configuration structure for queue */ }; -/** Bonded slave devices structure */ -struct bond_ethdev_slave_ports { - uint16_t slaves[RTE_MAX_ETHPORTS]; /**< Slave port id array */ - uint16_t slave_count; /**< Number of slaves */ +/** Bonded member devices structure */ +struct bond_ethdev_member_ports { + uint16_t members[RTE_MAX_ETHPORTS]; /**< Member port id array */ + uint16_t member_count; /**< Number of members */ }; -struct bond_slave_details { +struct bond_member_details { uint16_t port_id; uint8_t link_status_poll_enabled; uint8_t link_status_wait_to_complete; uint8_t last_link_status; - /**< Port Id of slave eth_dev */ + /**< Port Id of member eth_dev */ struct rte_ether_addr persisted_mac_addr; uint16_t reta_size; @@ -94,7 +94,7 @@ struct bond_slave_details { struct rte_flow { TAILQ_ENTRY(rte_flow) next; - /* Slaves flows */ + /* Members flows */ struct rte_flow *flows[RTE_MAX_ETHPORTS]; /* Flow description for synchronization */ struct rte_flow_conv_rule rule; @@ -102,7 +102,7 @@ struct rte_flow { }; typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves); + uint16_t member_count, uint16_t *members); /** Link Bonding PMD device private configuration Structure */ struct bond_dev_private { @@ -112,8 +112,8 @@ struct bond_dev_private { rte_spinlock_t lock; rte_spinlock_t lsc_lock; - uint16_t primary_port; /**< Primary Slave Port */ - uint16_t current_primary_port; /**< Primary Slave Port */ + uint16_t primary_port; /**< Primary Member Port */ + uint16_t current_primary_port; /**< Primary Member Port */ uint16_t user_defined_primary_port; /**< Flag for whether primary port is user defined or not */ @@ -137,16 +137,16 @@ struct bond_dev_private { uint16_t nb_rx_queues; /**< Total number of rx queues */ uint16_t nb_tx_queues; /**< Total number of tx queues*/ - uint16_t active_slave_count; /**< Number of active slaves */ - uint16_t active_slaves[RTE_MAX_ETHPORTS]; /**< Active slave list */ + uint16_t active_member_count; /**< Number of active members */ + uint16_t active_members[RTE_MAX_ETHPORTS]; /**< Active member list */ - uint16_t slave_count; /**< Number of bonded slaves */ - struct bond_slave_details slaves[RTE_MAX_ETHPORTS]; - /**< Array of bonded slaves details */ + uint16_t member_count; /**< Number of bonded members */ + struct bond_member_details members[RTE_MAX_ETHPORTS]; + /**< Array of bonded members details */ struct mode8023ad_private mode4; - uint16_t tlb_slaves_order[RTE_MAX_ETHPORTS]; - /**< TLB active slaves send order */ + uint16_t tlb_members_order[RTE_MAX_ETHPORTS]; + /**< TLB active members send order */ struct mode_alb_private mode6; uint64_t rx_offload_capa; /** Rx offload capability */ @@ -177,7 +177,7 @@ struct bond_dev_private { uint8_t rss_key_len; /**< hash key length in bytes. */ struct rte_kvargs *kvlist; - uint8_t slave_update_idx; + uint8_t member_update_idx; bool kvargs_processing_is_done; @@ -191,19 +191,21 @@ struct bond_dev_private { extern const struct eth_dev_ops default_dev_ops; int -check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev); +check_for_main_bonded_ethdev(const struct rte_eth_dev *eth_dev); int check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev); -/* Search given slave array to find position of given id. - * Return slave pos or slaves_count if not found. */ +/* + * Search given member array to find position of given id. + * Return member pos or members_count if not found. + */ static inline uint16_t -find_slave_by_id(uint16_t *slaves, uint16_t slaves_count, uint16_t slave_id) { +find_member_by_id(uint16_t *members, uint16_t members_count, uint16_t member_id) { uint16_t pos; - for (pos = 0; pos < slaves_count; pos++) { - if (slave_id == slaves[pos]) + for (pos = 0; pos < members_count; pos++) { + if (member_id == members[pos]) break; } @@ -217,13 +219,13 @@ int valid_bonded_port_id(uint16_t port_id); int -valid_slave_port_id(struct bond_dev_private *internals, uint16_t port_id); +valid_member_port_id(struct bond_dev_private *internals, uint16_t port_id); void -deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id); +deactivate_member(struct rte_eth_dev *eth_dev, uint16_t port_id); void -activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id); +activate_member(struct rte_eth_dev *eth_dev, uint16_t port_id); int mac_address_set(struct rte_eth_dev *eth_dev, @@ -234,66 +236,66 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr); int -mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev); +mac_address_members_update(struct rte_eth_dev *bonded_eth_dev); int -slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, - uint16_t slave_port_id); +member_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, + uint16_t member_port_id); int -slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, - uint16_t slave_port_id); +member_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, + uint16_t member_port_id); int bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, uint8_t mode); int -slave_configure(struct rte_eth_dev *bonded_eth_dev, - struct rte_eth_dev *slave_eth_dev); +member_configure(struct rte_eth_dev *bonded_eth_dev, + struct rte_eth_dev *member_eth_dev); int -slave_start(struct rte_eth_dev *bonded_eth_dev, - struct rte_eth_dev *slave_eth_dev); +member_start(struct rte_eth_dev *bonded_eth_dev, + struct rte_eth_dev *member_eth_dev); void -slave_remove(struct bond_dev_private *internals, - struct rte_eth_dev *slave_eth_dev); +member_remove(struct bond_dev_private *internals, + struct rte_eth_dev *member_eth_dev); void -slave_add(struct bond_dev_private *internals, - struct rte_eth_dev *slave_eth_dev); +member_add(struct bond_dev_private *internals, + struct rte_eth_dev *member_eth_dev); void burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves); + uint16_t member_count, uint16_t *members); void burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves); + uint16_t member_count, uint16_t *members); void burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves); + uint16_t member_count, uint16_t *members); void bond_ethdev_primary_set(struct bond_dev_private *internals, - uint16_t slave_port_id); + uint16_t member_port_id); int bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, void *ret_param); int -bond_ethdev_parse_slave_port_kvarg(const char *key, +bond_ethdev_parse_member_port_kvarg(const char *key, const char *value, void *extra_args); int -bond_ethdev_parse_slave_mode_kvarg(const char *key, +bond_ethdev_parse_member_mode_kvarg(const char *key, const char *value, void *extra_args); int -bond_ethdev_parse_slave_agg_mode_kvarg(const char *key __rte_unused, +bond_ethdev_parse_member_agg_mode_kvarg(const char *key __rte_unused, const char *value, void *extra_args); int @@ -301,7 +303,7 @@ bond_ethdev_parse_socket_id_kvarg(const char *key, const char *value, void *extra_args); int -bond_ethdev_parse_primary_slave_port_id_kvarg(const char *key, +bond_ethdev_parse_primary_member_port_id_kvarg(const char *key, const char *value, void *extra_args); int @@ -323,7 +325,7 @@ void bond_tlb_enable(struct bond_dev_private *internals); void -bond_tlb_activate_slave(struct bond_dev_private *internals); +bond_tlb_activate_member(struct bond_dev_private *internals); int bond_ethdev_stop(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index 874aa91a5f..b90242264d 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -10,7 +10,7 @@ * * RTE Link Bonding Ethernet Device * Link Bonding for 1GbE and 10GbE ports to allow the aggregation of multiple - * (slave) NICs into a single logical interface. The bonded device processes + * (member) NICs into a single logical interface. The bonded device processes * these interfaces based on the mode of operation specified and supported. * This implementation supports 4 modes of operation round robin, active backup * balance and broadcast. Providing redundant links, fault tolerance and/or @@ -28,24 +28,28 @@ extern "C" { #define BONDING_MODE_ROUND_ROBIN (0) /**< Round Robin (Mode 0). * In this mode all transmitted packets will be balanced equally across all - * active slaves of the bonded in a round robin fashion. */ + * active members of the bonded in a round robin fashion. + */ #define BONDING_MODE_ACTIVE_BACKUP (1) /**< Active Backup (Mode 1). * In this mode all packets transmitted will be transmitted on the primary - * slave until such point as the primary slave is no longer available and then - * transmitted packets will be sent on the next available slaves. The primary - * slave can be defined by the user but defaults to the first active slave - * available if not specified. */ + * member until such point as the primary member is no longer available and then + * transmitted packets will be sent on the next available members. The primary + * member can be defined by the user but defaults to the first active member + * available if not specified. + */ #define BONDING_MODE_BALANCE (2) /**< Balance (Mode 2). * In this mode all packets transmitted will be balanced across the available - * slaves using one of three available transmit policies - l2, l2+3 or l3+4. + * members using one of three available transmit policies - l2, l2+3 or l3+4. * See BALANCE_XMIT_POLICY macros definitions for further details on transmit - * policies. */ + * policies. + */ #define BONDING_MODE_BROADCAST (3) /**< Broadcast (Mode 3). * In this mode all transmitted packets will be transmitted on all available - * active slaves of the bonded. */ + * active members of the bonded. + */ #define BONDING_MODE_8023AD (4) /**< 802.3AD (Mode 4). * @@ -62,22 +66,22 @@ extern "C" { * be handled with the expected latency and this may cause the link status to be * incorrectly marked as down or failure to correctly negotiate with peers. * - For optimal performance during initial handshaking the array of mbufs provided - * to rx_burst should be at least 2 times the slave count size. - * + * to rx_burst should be at least 2 times the member count size. */ #define BONDING_MODE_TLB (5) /**< Adaptive TLB (Mode 5) * This mode provides an adaptive transmit load balancing. It dynamically - * changes the transmitting slave, according to the computed load. Statistics - * are collected in 100ms intervals and scheduled every 10ms */ + * changes the transmitting member, according to the computed load. Statistics + * are collected in 100ms intervals and scheduled every 10ms. + */ #define BONDING_MODE_ALB (6) /**< Adaptive Load Balancing (Mode 6) * This mode includes adaptive TLB and receive load balancing (RLB). In RLB the * bonding driver intercepts ARP replies send by local system and overwrites its * source MAC address, so that different peers send data to the server on - * different slave interfaces. When local system sends ARP request, it saves IP + * different member interfaces. When local system sends ARP request, it saves IP * information from it. When ARP reply from that peer is received, its MAC is - * stored, one of slave MACs assigned and ARP reply send to that peer. + * stored, one of member MACs assigned and ARP reply send to that peer. */ /* Balance Mode Transmit Policies */ @@ -113,28 +117,44 @@ int rte_eth_bond_free(const char *name); /** - * Add a rte_eth_dev device as a slave to the bonded device + * Add a rte_eth_dev device as a member to the bonded device * * @param bonded_port_id Port ID of bonded device. - * @param slave_port_id Port ID of slave device. + * @param member_port_id Port ID of member device. * * @return * 0 on success, negative value otherwise */ +__rte_experimental int -rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id); +rte_eth_bond_member_add(uint16_t bonded_port_id, uint16_t member_port_id); + +__rte_deprecated +static inline int +rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t member_port_id) +{ + return rte_eth_bond_member_add(bonded_port_id, member_port_id); +} /** - * Remove a slave rte_eth_dev device from the bonded device + * Remove a member rte_eth_dev device from the bonded device * * @param bonded_port_id Port ID of bonded device. - * @param slave_port_id Port ID of slave device. + * @param member_port_id Port ID of member device. * * @return * 0 on success, negative value otherwise */ +__rte_experimental int -rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t slave_port_id); +rte_eth_bond_member_remove(uint16_t bonded_port_id, uint16_t member_port_id); + +__rte_deprecated +static inline int +rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t member_port_id) +{ + return rte_eth_bond_member_remove(bonded_port_id, member_port_id); +} /** * Set link bonding mode of bonded device @@ -160,65 +180,83 @@ int rte_eth_bond_mode_get(uint16_t bonded_port_id); /** - * Set slave rte_eth_dev as primary slave of bonded device + * Set member rte_eth_dev as primary member of bonded device * * @param bonded_port_id Port ID of bonded device. - * @param slave_port_id Port ID of slave device. + * @param member_port_id Port ID of member device. * * @return * 0 on success, negative value otherwise */ int -rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id); +rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t member_port_id); /** - * Get primary slave of bonded device + * Get primary member of bonded device * * @param bonded_port_id Port ID of bonded device. * * @return - * Port Id of primary slave on success, -1 on failure + * Port Id of primary member on success, -1 on failure */ int rte_eth_bond_primary_get(uint16_t bonded_port_id); /** - * Populate an array with list of the slaves port id's of the bonded device + * Populate an array with list of the members port id's of the bonded device * * @param bonded_port_id Port ID of bonded eth_dev to interrogate - * @param slaves Array to be populated with the current active slaves - * @param len Length of slaves array + * @param members Array to be populated with the current active members + * @param len Length of members array * * @return - * Number of slaves associated with bonded device on success, + * Number of members associated with bonded device on success, * negative value otherwise */ +__rte_experimental int -rte_eth_bond_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], - uint16_t len); +rte_eth_bond_members_get(uint16_t bonded_port_id, uint16_t members[], + uint16_t len); + +__rte_deprecated +static inline int +rte_eth_bond_slaves_get(uint16_t bonded_port_id, uint16_t members[], + uint16_t len) +{ + return rte_eth_bond_members_get(bonded_port_id, members, len); +} /** - * Populate an array with list of the active slaves port id's of the bonded + * Populate an array with list of the active members port id's of the bonded * device. * * @param bonded_port_id Port ID of bonded eth_dev to interrogate - * @param slaves Array to be populated with the current active slaves - * @param len Length of slaves array + * @param members Array to be populated with the current active members + * @param len Length of members array * * @return - * Number of active slaves associated with bonded device on success, + * Number of active members associated with bonded device on success, * negative value otherwise */ +__rte_experimental int -rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], - uint16_t len); +rte_eth_bond_active_members_get(uint16_t bonded_port_id, uint16_t members[], + uint16_t len); + +__rte_deprecated +static inline int +rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t members[], + uint16_t len) +{ + return rte_eth_bond_active_members_get(bonded_port_id, members, len); +} /** - * Set explicit MAC address to use on bonded device and it's slaves. + * Set explicit MAC address to use on bonded device and it's members. * * @param bonded_port_id Port ID of bonded device. * @param mac_addr MAC Address to use on bonded device overriding - * slaves MAC addresses + * members MAC addresses * * @return * 0 on success, negative value otherwise @@ -228,8 +266,8 @@ rte_eth_bond_mac_address_set(uint16_t bonded_port_id, struct rte_ether_addr *mac_addr); /** - * Reset bonded device to use MAC from primary slave on bonded device and it's - * slaves. + * Reset bonded device to use MAC from primary member on bonded device and it's + * members. * * @param bonded_port_id Port ID of bonded device. * @@ -266,7 +304,7 @@ rte_eth_bond_xmit_policy_get(uint16_t bonded_port_id); /** * Set the link monitoring frequency (in ms) for monitoring the link status of - * slave devices + * member devices * * @param bonded_port_id Port ID of bonded device. * @param internal_ms Monitoring interval in milliseconds @@ -280,7 +318,7 @@ rte_eth_bond_link_monitoring_set(uint16_t bonded_port_id, uint32_t internal_ms); /** * Get the current link monitoring frequency (in ms) for monitoring of the link - * status of slave devices + * status of member devices * * @param bonded_port_id Port ID of bonded device. * diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 4a266bb2ca..7cf44d0595 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -19,7 +19,7 @@ static void bond_mode_8023ad_ext_periodic_cb(void *arg); #define MODE4_DEBUG(fmt, ...) \ rte_log(RTE_LOG_DEBUG, bond_logtype, \ "%6u [Port %u: %s] " fmt, \ - bond_dbg_get_time_diff_ms(), slave_id, \ + bond_dbg_get_time_diff_ms(), member_id, \ __func__, ##__VA_ARGS__) static uint64_t start_time; @@ -184,9 +184,9 @@ set_warning_flags(struct port *port, uint16_t flags) } static void -show_warnings(uint16_t slave_id) +show_warnings(uint16_t member_id) { - struct port *port = &bond_mode_8023ad_ports[slave_id]; + struct port *port = &bond_mode_8023ad_ports[member_id]; uint8_t warnings; do { @@ -205,36 +205,36 @@ show_warnings(uint16_t slave_id) if (warnings & WRN_RX_QUEUE_FULL) { RTE_BOND_LOG(DEBUG, - "Slave %u: failed to enqueue LACP packet into RX ring.\n" + "Member %u: failed to enqueue LACP packet into RX ring.\n" "Receive and transmit functions must be invoked on bonded" "interface at least 10 times per second or LACP will notwork correctly", - slave_id); + member_id); } if (warnings & WRN_TX_QUEUE_FULL) { RTE_BOND_LOG(DEBUG, - "Slave %u: failed to enqueue LACP packet into TX ring.\n" + "Member %u: failed to enqueue LACP packet into TX ring.\n" "Receive and transmit functions must be invoked on bonded" "interface at least 10 times per second or LACP will not work correctly", - slave_id); + member_id); } if (warnings & WRN_RX_MARKER_TO_FAST) - RTE_BOND_LOG(INFO, "Slave %u: marker to early - ignoring.", - slave_id); + RTE_BOND_LOG(INFO, "Member %u: marker to early - ignoring.", + member_id); if (warnings & WRN_UNKNOWN_SLOW_TYPE) { RTE_BOND_LOG(INFO, - "Slave %u: ignoring unknown slow protocol frame type", - slave_id); + "Member %u: ignoring unknown slow protocol frame type", + member_id); } if (warnings & WRN_UNKNOWN_MARKER_TYPE) - RTE_BOND_LOG(INFO, "Slave %u: ignoring unknown marker type", - slave_id); + RTE_BOND_LOG(INFO, "Member %u: ignoring unknown marker type", + member_id); if (warnings & WRN_NOT_LACP_CAPABLE) - MODE4_DEBUG("Port %u is not LACP capable!\n", slave_id); + MODE4_DEBUG("Port %u is not LACP capable!\n", member_id); } static void @@ -256,10 +256,10 @@ record_default(struct port *port) * @param port Port on which LACPDU was received. */ static void -rx_machine(struct bond_dev_private *internals, uint16_t slave_id, +rx_machine(struct bond_dev_private *internals, uint16_t member_id, struct lacpdu *lacp) { - struct port *agg, *port = &bond_mode_8023ad_ports[slave_id]; + struct port *agg, *port = &bond_mode_8023ad_ports[member_id]; uint64_t timeout; if (SM_FLAG(port, BEGIN)) { @@ -389,9 +389,9 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, * @param port Port to handle state machine. */ static void -periodic_machine(struct bond_dev_private *internals, uint16_t slave_id) +periodic_machine(struct bond_dev_private *internals, uint16_t member_id) { - struct port *port = &bond_mode_8023ad_ports[slave_id]; + struct port *port = &bond_mode_8023ad_ports[member_id]; /* Calculate if either site is LACP enabled */ uint64_t timeout; uint8_t active = ACTOR_STATE(port, LACP_ACTIVE) || @@ -451,9 +451,9 @@ periodic_machine(struct bond_dev_private *internals, uint16_t slave_id) * @param port Port to handle state machine. */ static void -mux_machine(struct bond_dev_private *internals, uint16_t slave_id) +mux_machine(struct bond_dev_private *internals, uint16_t member_id) { - struct port *port = &bond_mode_8023ad_ports[slave_id]; + struct port *port = &bond_mode_8023ad_ports[member_id]; /* Save current state for later use */ const uint8_t state_mask = STATE_SYNCHRONIZATION | STATE_DISTRIBUTING | @@ -527,8 +527,8 @@ mux_machine(struct bond_dev_private *internals, uint16_t slave_id) SM_FLAG_SET(port, NTT); MODE4_DEBUG("COLLECTING -> DISTRIBUTING\n"); RTE_BOND_LOG(INFO, - "Bond %u: slave id %u distributing started.", - internals->port_id, slave_id); + "Bond %u: member id %u distributing started.", + internals->port_id, member_id); } } else { if (!PARTNER_STATE(port, COLLECTING)) { @@ -538,8 +538,8 @@ mux_machine(struct bond_dev_private *internals, uint16_t slave_id) SM_FLAG_SET(port, NTT); MODE4_DEBUG("DISTRIBUTING -> COLLECTING\n"); RTE_BOND_LOG(INFO, - "Bond %u: slave id %u distributing stopped.", - internals->port_id, slave_id); + "Bond %u: member id %u distributing stopped.", + internals->port_id, member_id); } } } @@ -554,9 +554,9 @@ mux_machine(struct bond_dev_private *internals, uint16_t slave_id) * @param port */ static void -tx_machine(struct bond_dev_private *internals, uint16_t slave_id) +tx_machine(struct bond_dev_private *internals, uint16_t member_id) { - struct port *agg, *port = &bond_mode_8023ad_ports[slave_id]; + struct port *agg, *port = &bond_mode_8023ad_ports[member_id]; struct rte_mbuf *lacp_pkt = NULL; struct lacpdu_header *hdr; @@ -587,7 +587,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) /* Source and destination MAC */ rte_ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.dst_addr); - rte_eth_macaddr_get(slave_id, &hdr->eth_hdr.src_addr); + rte_eth_macaddr_get(member_id, &hdr->eth_hdr.src_addr); hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW); lacpdu = &hdr->lacpdu; @@ -635,10 +635,10 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) return; } } else { - uint16_t pkts_sent = rte_eth_tx_prepare(slave_id, + uint16_t pkts_sent = rte_eth_tx_prepare(member_id, internals->mode4.dedicated_queues.tx_qid, &lacp_pkt, 1); - pkts_sent = rte_eth_tx_burst(slave_id, + pkts_sent = rte_eth_tx_burst(member_id, internals->mode4.dedicated_queues.tx_qid, &lacp_pkt, pkts_sent); if (pkts_sent != 1) { @@ -679,40 +679,40 @@ max_index(uint64_t *a, int n) * @param port_pos Port to assign. */ static void -selection_logic(struct bond_dev_private *internals, uint16_t slave_id) +selection_logic(struct bond_dev_private *internals, uint16_t member_id) { struct port *agg, *port; - uint16_t slaves_count, new_agg_id, i, j = 0; - uint16_t *slaves; + uint16_t members_count, new_agg_id, i, j = 0; + uint16_t *members; uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0}; uint64_t agg_count[RTE_MAX_ETHPORTS] = {0}; - uint16_t default_slave = 0; + uint16_t default_member = 0; struct rte_eth_link link_info; uint16_t agg_new_idx = 0; int ret; - slaves = internals->active_slaves; - slaves_count = internals->active_slave_count; - port = &bond_mode_8023ad_ports[slave_id]; + members = internals->active_members; + members_count = internals->active_member_count; + port = &bond_mode_8023ad_ports[member_id]; /* Search for aggregator suitable for this port */ - for (i = 0; i < slaves_count; ++i) { - agg = &bond_mode_8023ad_ports[slaves[i]]; + for (i = 0; i < members_count; ++i) { + agg = &bond_mode_8023ad_ports[members[i]]; /* Skip ports that are not aggregators */ - if (agg->aggregator_port_id != slaves[i]) + if (agg->aggregator_port_id != members[i]) continue; - ret = rte_eth_link_get_nowait(slaves[i], &link_info); + ret = rte_eth_link_get_nowait(members[i], &link_info); if (ret < 0) { RTE_BOND_LOG(ERR, - "Slave (port %u) link get failed: %s\n", - slaves[i], rte_strerror(-ret)); + "Member (port %u) link get failed: %s\n", + members[i], rte_strerror(-ret)); continue; } agg_count[i] += 1; agg_bandwidth[i] += link_info.link_speed; - /* Actors system ID is not checked since all slave device have the same + /* Actors system ID is not checked since all member device have the same * ID (MAC address). */ if ((agg->actor.key == port->actor.key && agg->partner.system_priority == port->partner.system_priority && @@ -724,31 +724,31 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) != 0) { if (j == 0) - default_slave = i; + default_member = i; j++; } } switch (internals->mode4.agg_selection) { case AGG_COUNT: - agg_new_idx = max_index(agg_count, slaves_count); - new_agg_id = slaves[agg_new_idx]; + agg_new_idx = max_index(agg_count, members_count); + new_agg_id = members[agg_new_idx]; break; case AGG_BANDWIDTH: - agg_new_idx = max_index(agg_bandwidth, slaves_count); - new_agg_id = slaves[agg_new_idx]; + agg_new_idx = max_index(agg_bandwidth, members_count); + new_agg_id = members[agg_new_idx]; break; case AGG_STABLE: - if (default_slave == slaves_count) - new_agg_id = slaves[slave_id]; + if (default_member == members_count) + new_agg_id = members[member_id]; else - new_agg_id = slaves[default_slave]; + new_agg_id = members[default_member]; break; default: - if (default_slave == slaves_count) - new_agg_id = slaves[slave_id]; + if (default_member == members_count) + new_agg_id = members[member_id]; else - new_agg_id = slaves[default_slave]; + new_agg_id = members[default_member]; break; } @@ -758,7 +758,7 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) MODE4_DEBUG("-> SELECTED: ID=%3u\n" "\t%s aggregator ID=%3u\n", port->aggregator_port_id, - port->aggregator_port_id == slave_id ? + port->aggregator_port_id == member_id ? "aggregator not found, using default" : "aggregator found", port->aggregator_port_id); } @@ -802,7 +802,7 @@ link_speed_key(uint16_t speed) { } static void -rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, +rx_machine_update(struct bond_dev_private *internals, uint16_t member_id, struct rte_mbuf *lacp_pkt) { struct lacpdu_header *lacp; struct lacpdu_actor_partner_params *partner; @@ -813,7 +813,7 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, RTE_ASSERT(lacp->lacpdu.subtype == SLOW_SUBTYPE_LACP); partner = &lacp->lacpdu.partner; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; if (rte_is_zero_ether_addr(&partner->port_params.system) || @@ -822,7 +822,7 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, /* This LACP frame is sending to the bonding port * so pass it to rx_machine. */ - rx_machine(internals, slave_id, &lacp->lacpdu); + rx_machine(internals, member_id, &lacp->lacpdu); } else { char preferred_system_name[RTE_ETHER_ADDR_FMT_SIZE]; char self_system_name[RTE_ETHER_ADDR_FMT_SIZE]; @@ -837,16 +837,16 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, } rte_pktmbuf_free(lacp_pkt); } else - rx_machine(internals, slave_id, NULL); + rx_machine(internals, member_id, NULL); } static void bond_mode_8023ad_dedicated_rxq_process(struct bond_dev_private *internals, - uint16_t slave_id) + uint16_t member_id) { #define DEDICATED_QUEUE_BURST_SIZE 32 struct rte_mbuf *lacp_pkt[DEDICATED_QUEUE_BURST_SIZE]; - uint16_t rx_count = rte_eth_rx_burst(slave_id, + uint16_t rx_count = rte_eth_rx_burst(member_id, internals->mode4.dedicated_queues.rx_qid, lacp_pkt, DEDICATED_QUEUE_BURST_SIZE); @@ -854,10 +854,10 @@ bond_mode_8023ad_dedicated_rxq_process(struct bond_dev_private *internals, uint16_t i; for (i = 0; i < rx_count; i++) - bond_mode_8023ad_handle_slow_pkt(internals, slave_id, + bond_mode_8023ad_handle_slow_pkt(internals, member_id, lacp_pkt[i]); } else { - rx_machine_update(internals, slave_id, NULL); + rx_machine_update(internals, member_id, NULL); } } @@ -868,23 +868,23 @@ bond_mode_8023ad_periodic_cb(void *arg) struct bond_dev_private *internals = bond_dev->data->dev_private; struct port *port; struct rte_eth_link link_info; - struct rte_ether_addr slave_addr; + struct rte_ether_addr member_addr; struct rte_mbuf *lacp_pkt = NULL; - uint16_t slave_id; + uint16_t member_id; uint16_t i; /* Update link status on each port */ - for (i = 0; i < internals->active_slave_count; i++) { + for (i = 0; i < internals->active_member_count; i++) { uint16_t key; int ret; - slave_id = internals->active_slaves[i]; - ret = rte_eth_link_get_nowait(slave_id, &link_info); + member_id = internals->active_members[i]; + ret = rte_eth_link_get_nowait(member_id, &link_info); if (ret < 0) { RTE_BOND_LOG(ERR, - "Slave (port %u) link get failed: %s\n", - slave_id, rte_strerror(-ret)); + "Member (port %u) link get failed: %s\n", + member_id, rte_strerror(-ret)); } if (ret >= 0 && link_info.link_status != 0) { @@ -895,8 +895,8 @@ bond_mode_8023ad_periodic_cb(void *arg) key = 0; } - rte_eth_macaddr_get(slave_id, &slave_addr); - port = &bond_mode_8023ad_ports[slave_id]; + rte_eth_macaddr_get(member_id, &member_addr); + port = &bond_mode_8023ad_ports[member_id]; key = rte_cpu_to_be_16(key); if (key != port->actor.key) { @@ -907,16 +907,16 @@ bond_mode_8023ad_periodic_cb(void *arg) SM_FLAG_SET(port, NTT); } - if (!rte_is_same_ether_addr(&port->actor.system, &slave_addr)) { - rte_ether_addr_copy(&slave_addr, &port->actor.system); - if (port->aggregator_port_id == slave_id) + if (!rte_is_same_ether_addr(&port->actor.system, &member_addr)) { + rte_ether_addr_copy(&member_addr, &port->actor.system); + if (port->aggregator_port_id == member_id) SM_FLAG_SET(port, NTT); } } - for (i = 0; i < internals->active_slave_count; i++) { - slave_id = internals->active_slaves[i]; - port = &bond_mode_8023ad_ports[slave_id]; + for (i = 0; i < internals->active_member_count; i++) { + member_id = internals->active_members[i]; + port = &bond_mode_8023ad_ports[member_id]; if ((port->actor.key & rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) == 0) { @@ -947,19 +947,19 @@ bond_mode_8023ad_periodic_cb(void *arg) if (retval != 0) lacp_pkt = NULL; - rx_machine_update(internals, slave_id, lacp_pkt); + rx_machine_update(internals, member_id, lacp_pkt); } else { bond_mode_8023ad_dedicated_rxq_process(internals, - slave_id); + member_id); } - periodic_machine(internals, slave_id); - mux_machine(internals, slave_id); - tx_machine(internals, slave_id); - selection_logic(internals, slave_id); + periodic_machine(internals, member_id); + mux_machine(internals, member_id); + tx_machine(internals, member_id); + selection_logic(internals, member_id); SM_FLAG_CLR(port, BEGIN); - show_warnings(slave_id); + show_warnings(member_id); } rte_eal_alarm_set(internals->mode4.update_timeout_us, @@ -967,34 +967,34 @@ bond_mode_8023ad_periodic_cb(void *arg) } static int -bond_mode_8023ad_register_lacp_mac(uint16_t slave_id) +bond_mode_8023ad_register_lacp_mac(uint16_t member_id) { int ret; - ret = rte_eth_allmulticast_enable(slave_id); + ret = rte_eth_allmulticast_enable(member_id); if (ret != 0) { RTE_BOND_LOG(ERR, "failed to enable allmulti mode for port %u: %s", - slave_id, rte_strerror(-ret)); + member_id, rte_strerror(-ret)); } - if (rte_eth_allmulticast_get(slave_id)) { + if (rte_eth_allmulticast_get(member_id)) { RTE_BOND_LOG(DEBUG, "forced allmulti for port %u", - slave_id); - bond_mode_8023ad_ports[slave_id].forced_rx_flags = + member_id); + bond_mode_8023ad_ports[member_id].forced_rx_flags = BOND_8023AD_FORCED_ALLMULTI; return 0; } - ret = rte_eth_promiscuous_enable(slave_id); + ret = rte_eth_promiscuous_enable(member_id); if (ret != 0) { RTE_BOND_LOG(ERR, "failed to enable promiscuous mode for port %u: %s", - slave_id, rte_strerror(-ret)); + member_id, rte_strerror(-ret)); } - if (rte_eth_promiscuous_get(slave_id)) { + if (rte_eth_promiscuous_get(member_id)) { RTE_BOND_LOG(DEBUG, "forced promiscuous for port %u", - slave_id); - bond_mode_8023ad_ports[slave_id].forced_rx_flags = + member_id); + bond_mode_8023ad_ports[member_id].forced_rx_flags = BOND_8023AD_FORCED_PROMISC; return 0; } @@ -1003,27 +1003,27 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id) } static void -bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id) +bond_mode_8023ad_unregister_lacp_mac(uint16_t member_id) { int ret; - switch (bond_mode_8023ad_ports[slave_id].forced_rx_flags) { + switch (bond_mode_8023ad_ports[member_id].forced_rx_flags) { case BOND_8023AD_FORCED_ALLMULTI: - RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", slave_id); - ret = rte_eth_allmulticast_disable(slave_id); + RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", member_id); + ret = rte_eth_allmulticast_disable(member_id); if (ret != 0) RTE_BOND_LOG(ERR, "failed to disable allmulti mode for port %u: %s", - slave_id, rte_strerror(-ret)); + member_id, rte_strerror(-ret)); break; case BOND_8023AD_FORCED_PROMISC: - RTE_BOND_LOG(DEBUG, "unset promisc for port %u", slave_id); - ret = rte_eth_promiscuous_disable(slave_id); + RTE_BOND_LOG(DEBUG, "unset promisc for port %u", member_id); + ret = rte_eth_promiscuous_disable(member_id); if (ret != 0) RTE_BOND_LOG(ERR, "failed to disable promiscuous mode for port %u: %s", - slave_id, rte_strerror(-ret)); + member_id, rte_strerror(-ret)); break; default: @@ -1032,12 +1032,12 @@ bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id) } void -bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, - uint16_t slave_id) +bond_mode_8023ad_activate_member(struct rte_eth_dev *bond_dev, + uint16_t member_id) { struct bond_dev_private *internals = bond_dev->data->dev_private; - struct port *port = &bond_mode_8023ad_ports[slave_id]; + struct port *port = &bond_mode_8023ad_ports[member_id]; struct port_params initial = { .system = { { 0 } }, .system_priority = rte_cpu_to_be_16(0xFFFF), @@ -1053,15 +1053,15 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, struct bond_tx_queue *bd_tx_q; uint16_t q_id; - /* Given slave mus not be in active list */ - RTE_ASSERT(find_slave_by_id(internals->active_slaves, - internals->active_slave_count, slave_id) == internals->active_slave_count); + /* Given member mus not be in active list */ + RTE_ASSERT(find_member_by_id(internals->active_members, + internals->active_member_count, member_id) == internals->active_member_count); RTE_SET_USED(internals); /* used only for assert when enabled */ memcpy(&port->actor, &initial, sizeof(struct port_params)); /* Standard requires that port ID must be grater than 0. * Add 1 do get corresponding port_number */ - port->actor.port_number = rte_cpu_to_be_16(slave_id + 1); + port->actor.port_number = rte_cpu_to_be_16(member_id + 1); memcpy(&port->partner, &initial, sizeof(struct port_params)); memcpy(&port->partner_admin, &initial, sizeof(struct port_params)); @@ -1072,11 +1072,11 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, port->sm_flags = SM_FLAGS_BEGIN; /* use this port as aggregator */ - port->aggregator_port_id = slave_id; + port->aggregator_port_id = member_id; - if (bond_mode_8023ad_register_lacp_mac(slave_id) < 0) { - RTE_BOND_LOG(WARNING, "slave %u is most likely broken and won't receive LACP packets", - slave_id); + if (bond_mode_8023ad_register_lacp_mac(member_id) < 0) { + RTE_BOND_LOG(WARNING, "member %u is most likely broken and won't receive LACP packets", + member_id); } timer_cancel(&port->warning_timer); @@ -1087,22 +1087,24 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, RTE_ASSERT(port->rx_ring == NULL); RTE_ASSERT(port->tx_ring == NULL); - socket_id = rte_eth_dev_socket_id(slave_id); + socket_id = rte_eth_dev_socket_id(member_id); if (socket_id == -1) socket_id = rte_socket_id(); element_size = sizeof(struct slow_protocol_frame) + RTE_PKTMBUF_HEADROOM; - /* The size of the mempool should be at least: - * the sum of the TX descriptors + BOND_MODE_8023AX_SLAVE_TX_PKTS */ - total_tx_desc = BOND_MODE_8023AX_SLAVE_TX_PKTS; + /* + * The size of the mempool should be at least: + * the sum of the TX descriptors + BOND_MODE_8023AX_Member_TX_PKTS. + */ + total_tx_desc = BOND_MODE_8023AX_Member_TX_PKTS; for (q_id = 0; q_id < bond_dev->data->nb_tx_queues; q_id++) { bd_tx_q = (struct bond_tx_queue*)bond_dev->data->tx_queues[q_id]; total_tx_desc += bd_tx_q->nb_tx_desc; } - snprintf(mem_name, RTE_DIM(mem_name), "slave_port%u_pool", slave_id); + snprintf(mem_name, RTE_DIM(mem_name), "member_port%u_pool", member_id); port->mbuf_pool = rte_pktmbuf_pool_create(mem_name, total_tx_desc, RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ? 32 : RTE_MEMPOOL_CACHE_MAX_SIZE, @@ -1111,39 +1113,39 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, /* Any memory allocation failure in initialization is critical because * resources can't be free, so reinitialization is impossible. */ if (port->mbuf_pool == NULL) { - rte_panic("Slave %u: Failed to create memory pool '%s': %s\n", - slave_id, mem_name, rte_strerror(rte_errno)); + rte_panic("Member %u: Failed to create memory pool '%s': %s\n", + member_id, mem_name, rte_strerror(rte_errno)); } - snprintf(mem_name, RTE_DIM(mem_name), "slave_%u_rx", slave_id); + snprintf(mem_name, RTE_DIM(mem_name), "member_%u_rx", member_id); port->rx_ring = rte_ring_create(mem_name, - rte_align32pow2(BOND_MODE_8023AX_SLAVE_RX_PKTS), socket_id, 0); + rte_align32pow2(BOND_MODE_8023AX_Member_RX_PKTS), socket_id, 0); if (port->rx_ring == NULL) { - rte_panic("Slave %u: Failed to create rx ring '%s': %s\n", slave_id, + rte_panic("Member %u: Failed to create rx ring '%s': %s\n", member_id, mem_name, rte_strerror(rte_errno)); } /* TX ring is at least one pkt longer to make room for marker packet. */ - snprintf(mem_name, RTE_DIM(mem_name), "slave_%u_tx", slave_id); + snprintf(mem_name, RTE_DIM(mem_name), "member_%u_tx", member_id); port->tx_ring = rte_ring_create(mem_name, - rte_align32pow2(BOND_MODE_8023AX_SLAVE_TX_PKTS + 1), socket_id, 0); + rte_align32pow2(BOND_MODE_8023AX_Member_TX_PKTS + 1), socket_id, 0); if (port->tx_ring == NULL) { - rte_panic("Slave %u: Failed to create tx ring '%s': %s\n", slave_id, + rte_panic("Member %u: Failed to create tx ring '%s': %s\n", member_id, mem_name, rte_strerror(rte_errno)); } } int -bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *bond_dev __rte_unused, - uint16_t slave_id) +bond_mode_8023ad_deactivate_member(struct rte_eth_dev *bond_dev __rte_unused, + uint16_t member_id) { void *pkt = NULL; struct port *port = NULL; uint8_t old_partner_state; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; ACTOR_STATE_CLR(port, AGGREGATION); port->selected = UNSELECTED; @@ -1151,7 +1153,7 @@ bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *bond_dev __rte_unused, old_partner_state = port->partner_state; record_default(port); - bond_mode_8023ad_unregister_lacp_mac(slave_id); + bond_mode_8023ad_unregister_lacp_mac(member_id); /* If partner timeout state changes then disable timer */ if (!((old_partner_state ^ port->partner_state) & @@ -1174,30 +1176,30 @@ void bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) { struct bond_dev_private *internals = bond_dev->data->dev_private; - struct rte_ether_addr slave_addr; - struct port *slave, *agg_slave; - uint16_t slave_id, i, j; + struct rte_ether_addr member_addr; + struct port *member, *agg_member; + uint16_t member_id, i, j; bond_mode_8023ad_stop(bond_dev); - for (i = 0; i < internals->active_slave_count; i++) { - slave_id = internals->active_slaves[i]; - slave = &bond_mode_8023ad_ports[slave_id]; - rte_eth_macaddr_get(slave_id, &slave_addr); + for (i = 0; i < internals->active_member_count; i++) { + member_id = internals->active_members[i]; + member = &bond_mode_8023ad_ports[member_id]; + rte_eth_macaddr_get(member_id, &member_addr); - if (rte_is_same_ether_addr(&slave_addr, &slave->actor.system)) + if (rte_is_same_ether_addr(&member_addr, &member->actor.system)) continue; - rte_ether_addr_copy(&slave_addr, &slave->actor.system); + rte_ether_addr_copy(&member_addr, &member->actor.system); /* Do nothing if this port is not an aggregator. In other case * Set NTT flag on every port that use this aggregator. */ - if (slave->aggregator_port_id != slave_id) + if (member->aggregator_port_id != member_id) continue; - for (j = 0; j < internals->active_slave_count; j++) { - agg_slave = &bond_mode_8023ad_ports[internals->active_slaves[j]]; - if (agg_slave->aggregator_port_id == slave_id) - SM_FLAG_SET(agg_slave, NTT); + for (j = 0; j < internals->active_member_count; j++) { + agg_member = &bond_mode_8023ad_ports[internals->active_members[j]]; + if (agg_member->aggregator_port_id == member_id) + SM_FLAG_SET(agg_member, NTT); } } @@ -1288,9 +1290,9 @@ bond_mode_8023ad_enable(struct rte_eth_dev *bond_dev) struct bond_dev_private *internals = bond_dev->data->dev_private; uint16_t i; - for (i = 0; i < internals->active_slave_count; i++) - bond_mode_8023ad_activate_slave(bond_dev, - internals->active_slaves[i]); + for (i = 0; i < internals->active_member_count; i++) + bond_mode_8023ad_activate_member(bond_dev, + internals->active_members[i]); return 0; } @@ -1326,10 +1328,10 @@ bond_mode_8023ad_stop(struct rte_eth_dev *bond_dev) void bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, - uint16_t slave_id, struct rte_mbuf *pkt) + uint16_t member_id, struct rte_mbuf *pkt) { struct mode8023ad_private *mode4 = &internals->mode4; - struct port *port = &bond_mode_8023ad_ports[slave_id]; + struct port *port = &bond_mode_8023ad_ports[member_id]; struct marker_header *m_hdr; uint64_t marker_timer, old_marker_timer; int retval; @@ -1362,7 +1364,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, } while (unlikely(retval == 0)); m_hdr->marker.tlv_type_marker = MARKER_TLV_TYPE_RESP; - rte_eth_macaddr_get(slave_id, &m_hdr->eth_hdr.src_addr); + rte_eth_macaddr_get(member_id, &m_hdr->eth_hdr.src_addr); if (internals->mode4.dedicated_queues.enabled == 0) { if (rte_ring_enqueue(port->tx_ring, pkt) != 0) { @@ -1373,10 +1375,10 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, } } else { /* Send packet directly to the slow queue */ - uint16_t tx_count = rte_eth_tx_prepare(slave_id, + uint16_t tx_count = rte_eth_tx_prepare(member_id, internals->mode4.dedicated_queues.tx_qid, &pkt, 1); - tx_count = rte_eth_tx_burst(slave_id, + tx_count = rte_eth_tx_burst(member_id, internals->mode4.dedicated_queues.tx_qid, &pkt, tx_count); if (tx_count != 1) { @@ -1394,7 +1396,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, goto free_out; } } else - rx_machine_update(internals, slave_id, pkt); + rx_machine_update(internals, member_id, pkt); } else { wrn = WRN_UNKNOWN_SLOW_TYPE; goto free_out; @@ -1517,8 +1519,8 @@ rte_eth_bond_8023ad_setup(uint16_t port_id, int -rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t slave_id, - struct rte_eth_bond_8023ad_slave_info *info) +rte_eth_bond_8023ad_member_info(uint16_t port_id, uint16_t member_id, + struct rte_eth_bond_8023ad_member_info *info) { struct rte_eth_dev *bond_dev; struct bond_dev_private *internals; @@ -1531,12 +1533,12 @@ rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t slave_id, bond_dev = &rte_eth_devices[port_id]; internals = bond_dev->data->dev_private; - if (find_slave_by_id(internals->active_slaves, - internals->active_slave_count, slave_id) == - internals->active_slave_count) + if (find_member_by_id(internals->active_members, + internals->active_member_count, member_id) == + internals->active_member_count) return -EINVAL; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; info->selected = port->selected; info->actor_state = port->actor_state; @@ -1550,7 +1552,7 @@ rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t slave_id, } static int -bond_8023ad_ext_validate(uint16_t port_id, uint16_t slave_id) +bond_8023ad_ext_validate(uint16_t port_id, uint16_t member_id) { struct rte_eth_dev *bond_dev; struct bond_dev_private *internals; @@ -1565,9 +1567,9 @@ bond_8023ad_ext_validate(uint16_t port_id, uint16_t slave_id) return -EINVAL; internals = bond_dev->data->dev_private; - if (find_slave_by_id(internals->active_slaves, - internals->active_slave_count, slave_id) == - internals->active_slave_count) + if (find_member_by_id(internals->active_members, + internals->active_member_count, member_id) == + internals->active_member_count) return -EINVAL; mode4 = &internals->mode4; @@ -1578,17 +1580,17 @@ bond_8023ad_ext_validate(uint16_t port_id, uint16_t slave_id) } int -rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t slave_id, +rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t member_id, int enabled) { struct port *port; int res; - res = bond_8023ad_ext_validate(port_id, slave_id); + res = bond_8023ad_ext_validate(port_id, member_id); if (res != 0) return res; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; if (enabled) ACTOR_STATE_SET(port, COLLECTING); @@ -1599,17 +1601,17 @@ rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t slave_id, } int -rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t slave_id, +rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t member_id, int enabled) { struct port *port; int res; - res = bond_8023ad_ext_validate(port_id, slave_id); + res = bond_8023ad_ext_validate(port_id, member_id); if (res != 0) return res; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; if (enabled) ACTOR_STATE_SET(port, DISTRIBUTING); @@ -1620,45 +1622,45 @@ rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t slave_id, } int -rte_eth_bond_8023ad_ext_distrib_get(uint16_t port_id, uint16_t slave_id) +rte_eth_bond_8023ad_ext_distrib_get(uint16_t port_id, uint16_t member_id) { struct port *port; int err; - err = bond_8023ad_ext_validate(port_id, slave_id); + err = bond_8023ad_ext_validate(port_id, member_id); if (err != 0) return err; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; return ACTOR_STATE(port, DISTRIBUTING); } int -rte_eth_bond_8023ad_ext_collect_get(uint16_t port_id, uint16_t slave_id) +rte_eth_bond_8023ad_ext_collect_get(uint16_t port_id, uint16_t member_id) { struct port *port; int err; - err = bond_8023ad_ext_validate(port_id, slave_id); + err = bond_8023ad_ext_validate(port_id, member_id); if (err != 0) return err; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; return ACTOR_STATE(port, COLLECTING); } int -rte_eth_bond_8023ad_ext_slowtx(uint16_t port_id, uint16_t slave_id, +rte_eth_bond_8023ad_ext_slowtx(uint16_t port_id, uint16_t member_id, struct rte_mbuf *lacp_pkt) { struct port *port; int res; - res = bond_8023ad_ext_validate(port_id, slave_id); + res = bond_8023ad_ext_validate(port_id, member_id); if (res != 0) return res; - port = &bond_mode_8023ad_ports[slave_id]; + port = &bond_mode_8023ad_ports[member_id]; if (rte_pktmbuf_pkt_len(lacp_pkt) < sizeof(struct lacpdu_header)) return -EINVAL; @@ -1683,11 +1685,11 @@ bond_mode_8023ad_ext_periodic_cb(void *arg) struct mode8023ad_private *mode4 = &internals->mode4; struct port *port; void *pkt = NULL; - uint16_t i, slave_id; + uint16_t i, member_id; - for (i = 0; i < internals->active_slave_count; i++) { - slave_id = internals->active_slaves[i]; - port = &bond_mode_8023ad_ports[slave_id]; + for (i = 0; i < internals->active_member_count; i++) { + member_id = internals->active_members[i]; + port = &bond_mode_8023ad_ports[member_id]; if (rte_ring_dequeue(port->rx_ring, &pkt) == 0) { struct rte_mbuf *lacp_pkt = pkt; @@ -1700,7 +1702,7 @@ bond_mode_8023ad_ext_periodic_cb(void *arg) /* This is LACP frame so pass it to rx callback. * Callback is responsible for freeing mbuf. */ - mode4->slowrx_cb(slave_id, lacp_pkt); + mode4->slowrx_cb(member_id, lacp_pkt); } } diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index 7ad8d6d00b..3144ee378a 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -35,7 +35,7 @@ extern "C" { #define MARKER_TLV_TYPE_INFO 0x01 #define MARKER_TLV_TYPE_RESP 0x02 -typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t slave_id, +typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t member_id, struct rte_mbuf *lacp_pkt); enum rte_bond_8023ad_selection { @@ -66,13 +66,13 @@ struct port_params { uint16_t system_priority; /**< System priority (unused in current implementation) */ struct rte_ether_addr system; - /**< System ID - Slave MAC address, same as bonding MAC address */ + /**< System ID - Member MAC address, same as bonding MAC address */ uint16_t key; /**< Speed information (implementation dependent) and duplex. */ uint16_t port_priority; /**< Priority of this (unused in current implementation) */ uint16_t port_number; - /**< Port number. It corresponds to slave port id. */ + /**< Port number. It corresponds to member port id. */ } __rte_packed __rte_aligned(2); struct lacpdu_actor_partner_params { @@ -141,7 +141,7 @@ struct rte_eth_bond_8023ad_conf { enum rte_bond_8023ad_agg_selection agg_selection; }; -struct rte_eth_bond_8023ad_slave_info { +struct rte_eth_bond_8023ad_member_info { enum rte_bond_8023ad_selection selected; uint8_t actor_state; struct port_params actor; @@ -184,104 +184,113 @@ rte_eth_bond_8023ad_setup(uint16_t port_id, /** * @internal * - * Function returns current state of given slave device. + * Function returns current state of given member device. * - * @param slave_id Port id of valid slave. + * @param member_id Port id of valid member. * @param conf buffer for configuration * @return * 0 - if ok - * -EINVAL if conf is NULL or slave id is invalid (not a slave of given + * -EINVAL if conf is NULL or member id is invalid (not a member of given * bonded device or is not inactive). */ +__rte_experimental int -rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t slave_id, - struct rte_eth_bond_8023ad_slave_info *conf); +rte_eth_bond_8023ad_member_info(uint16_t port_id, uint16_t member_id, + struct rte_eth_bond_8023ad_member_info *conf); + +__rte_deprecated +static inline int +rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t member_id, + struct rte_eth_bond_8023ad_member_info *conf) +{ + return rte_eth_bond_8023ad_member_info(port_id, member_id, conf); +} #ifdef __cplusplus } #endif /** - * Configure a slave port to start collecting. + * Configure a member port to start collecting. * * @param port_id Bonding device id - * @param slave_id Port id of valid slave. + * @param member_id Port id of valid member. * @param enabled Non-zero when collection enabled. * @return * 0 - if ok - * -EINVAL if slave is not valid. + * -EINVAL if member is not valid. */ int -rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t slave_id, +rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t member_id, int enabled); /** - * Get COLLECTING flag from slave port actor state. + * Get COLLECTING flag from member port actor state. * * @param port_id Bonding device id - * @param slave_id Port id of valid slave. + * @param member_id Port id of valid member. * @return * 0 - if not set * 1 - if set - * -EINVAL if slave is not valid. + * -EINVAL if member is not valid. */ int -rte_eth_bond_8023ad_ext_collect_get(uint16_t port_id, uint16_t slave_id); +rte_eth_bond_8023ad_ext_collect_get(uint16_t port_id, uint16_t member_id); /** - * Configure a slave port to start distributing. + * Configure a member port to start distributing. * * @param port_id Bonding device id - * @param slave_id Port id of valid slave. + * @param member_id Port id of valid member. * @param enabled Non-zero when distribution enabled. * @return * 0 - if ok - * -EINVAL if slave is not valid. + * -EINVAL if member is not valid. */ int -rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t slave_id, +rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t member_id, int enabled); /** - * Get DISTRIBUTING flag from slave port actor state. + * Get DISTRIBUTING flag from member port actor state. * * @param port_id Bonding device id - * @param slave_id Port id of valid slave. + * @param member_id Port id of valid member. * @return * 0 - if not set * 1 - if set - * -EINVAL if slave is not valid. + * -EINVAL if member is not valid. */ int -rte_eth_bond_8023ad_ext_distrib_get(uint16_t port_id, uint16_t slave_id); +rte_eth_bond_8023ad_ext_distrib_get(uint16_t port_id, uint16_t member_id); /** * LACPDU transmit path for external 802.3ad state machine. Caller retains * ownership of the packet on failure. * * @param port_id Bonding device id - * @param slave_id Port ID of valid slave device. + * @param member_id Port ID of valid member device. * @param lacp_pkt mbuf containing LACPDU. * * @return * 0 on success, negative value otherwise. */ int -rte_eth_bond_8023ad_ext_slowtx(uint16_t port_id, uint16_t slave_id, +rte_eth_bond_8023ad_ext_slowtx(uint16_t port_id, uint16_t member_id, struct rte_mbuf *lacp_pkt); /** - * Enable dedicated hw queues for 802.3ad control plane traffic on slaves + * Enable dedicated hw queues for 802.3ad control plane traffic on members * - * This function creates an additional tx and rx queue on each slave for + * This function creates an additional tx and rx queue on each member for * dedicated 802.3ad control plane traffic . A flow filtering rule is - * programmed on each slave to redirect all LACP slow packets to that rx queue + * programmed on each member to redirect all LACP slow packets to that rx queue * for processing in the LACP state machine, this removes the need to filter * these packets in the bonded devices data path. The additional tx queue is * used to enable the LACP state machine to enqueue LACP packets directly to - * slave hw independently of the bonded devices data path. + * member hw independently of the bonded devices data path. * - * To use this feature all slaves must support the programming of the flow + * To use this feature all members must support the programming of the flow * filter rule required for rx and have enough queues that one rx and tx queue * can be reserved for the LACP state machines control packets. * @@ -296,7 +305,7 @@ int rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port_id); /** - * Disable slow queue on slaves + * Disable slow queue on members * * This function disables hardware slow packet filter. * diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 86335a7971..56945e2349 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -19,13 +19,13 @@ simple_hash(uint8_t *hash_start, int hash_size) } static uint16_t -calculate_slave(struct bond_dev_private *internals) +calculate_member(struct bond_dev_private *internals) { uint16_t idx; - idx = (internals->mode6.last_slave + 1) % internals->active_slave_count; - internals->mode6.last_slave = idx; - return internals->active_slaves[idx]; + idx = (internals->mode6.last_member + 1) % internals->active_member_count; + internals->mode6.last_member = idx; + return internals->active_members[idx]; } int @@ -41,7 +41,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) /* Fill hash table with initial values */ memset(hash_table, 0, sizeof(struct client_data) * ALB_HASH_TABLE_SIZE); rte_spinlock_init(&internals->mode6.lock); - internals->mode6.last_slave = ALB_NULL_INDEX; + internals->mode6.last_member = ALB_NULL_INDEX; internals->mode6.ntt = 0; /* Initialize memory pool for ARP packets to send */ @@ -96,7 +96,7 @@ void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, /* * We got reply for ARP Request send by the application. We need to * update client table when received data differ from what is stored - * in ALB table and issue sending update packet to that slave. + * in ALB table and issue sending update packet to that member. */ rte_spinlock_lock(&internals->mode6.lock); if (client_info->in_use == 0 || @@ -112,8 +112,8 @@ void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, client_info->cli_ip = arp->arp_data.arp_sip; rte_ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); - client_info->slave_idx = calculate_slave(internals); - rte_eth_macaddr_get(client_info->slave_idx, + client_info->member_idx = calculate_member(internals); + rte_eth_macaddr_get(client_info->member_idx, &client_info->app_mac); rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); @@ -166,33 +166,33 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, &arp->arp_data.arp_tha, &client_info->cli_mac); } - rte_eth_macaddr_get(client_info->slave_idx, + rte_eth_macaddr_get(client_info->member_idx, &client_info->app_mac); rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); - return client_info->slave_idx; + return client_info->member_idx; } } - /* Assign new slave to this client and update src mac in ARP */ + /* Assign new member to this client and update src mac in ARP */ client_info->in_use = 1; client_info->ntt = 0; client_info->app_ip = arp->arp_data.arp_sip; rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); client_info->cli_ip = arp->arp_data.arp_tip; - client_info->slave_idx = calculate_slave(internals); - rte_eth_macaddr_get(client_info->slave_idx, + client_info->member_idx = calculate_member(internals); + rte_eth_macaddr_get(client_info->member_idx, &client_info->app_mac); rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); - return client_info->slave_idx; + return client_info->member_idx; } /* If packet is not ARP Reply, send it on current primary port. */ @@ -208,7 +208,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, { struct rte_ether_hdr *eth_h; struct rte_arp_hdr *arp_h; - uint16_t slave_idx; + uint16_t member_idx; rte_spinlock_lock(&internals->mode6.lock); eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); @@ -238,10 +238,10 @@ bond_mode_alb_arp_upd(struct client_data *client_info, arp_h->arp_plen = sizeof(uint32_t); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); - slave_idx = client_info->slave_idx; + member_idx = client_info->member_idx; rte_spinlock_unlock(&internals->mode6.lock); - return slave_idx; + return member_idx; } void @@ -252,18 +252,18 @@ bond_mode_alb_client_list_upd(struct rte_eth_dev *bond_dev) int i; - /* If active slave count is 0, it's pointless to refresh alb table */ - if (internals->active_slave_count <= 0) + /* If active member count is 0, it's pointless to refresh alb table */ + if (internals->active_member_count <= 0) return; rte_spinlock_lock(&internals->mode6.lock); - internals->mode6.last_slave = ALB_NULL_INDEX; + internals->mode6.last_member = ALB_NULL_INDEX; for (i = 0; i < ALB_HASH_TABLE_SIZE; i++) { client_info = &internals->mode6.client_table[i]; if (client_info->in_use) { - client_info->slave_idx = calculate_slave(internals); - rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); + client_info->member_idx = calculate_member(internals); + rte_eth_macaddr_get(client_info->member_idx, &client_info->app_mac); internals->mode6.ntt = 1; } } diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h index 4e9aeda9bc..beb2e619f9 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.h +++ b/drivers/net/bonding/rte_eth_bond_alb.h @@ -22,8 +22,8 @@ struct client_data { uint32_t cli_ip; /**< Client IP address */ - uint16_t slave_idx; - /**< Index of slave on which we connect with that client */ + uint16_t member_idx; + /**< Index of member on which we connect with that client */ uint8_t in_use; /**< Flag indicating if entry in client table is currently used */ uint8_t ntt; @@ -42,8 +42,8 @@ struct mode_alb_private { /**< Mempool for creating ARP update packets */ uint8_t ntt; /**< Flag indicating if we need to send update to any client on next tx */ - uint32_t last_slave; - /**< Index of last used slave in client table */ + uint32_t last_member; + /**< Index of last used member in client table */ rte_spinlock_t lock; }; @@ -72,9 +72,9 @@ bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** - * Function handles ARP packet transmission. It also decides on which slave - * send that packet. If packet is ARP Request, it is send on primary slave. - * If it is ARP Reply, it is send on slave stored in client table for that + * Function handles ARP packet transmission. It also decides on which member + * send that packet. If packet is ARP Request, it is send on primary member. + * If it is ARP Reply, it is send on member stored in client table for that * connection. On Reply function also updates data in client table. * * @param eth_h ETH header of transmitted packet. @@ -82,7 +82,7 @@ bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, * @param internals Bonding data. * * @return - * Index of slave on which packet should be sent. + * Index of member on which packet should be sent. */ uint16_t bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, @@ -96,14 +96,14 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, * @param internals Bonding data. * * @return - * Index of slave on which packet should be sent. + * Index of member on which packet should be sent. */ uint16_t bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals); /** - * Function updates slave indexes of active connections. + * Function updates member indexes of active connections. * * @param bond_dev Pointer to bonded device struct. */ diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index c0178369b4..b6512a098a 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -37,7 +37,7 @@ valid_bonded_port_id(uint16_t port_id) } int -check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev) +check_for_main_bonded_ethdev(const struct rte_eth_dev *eth_dev) { int i; struct bond_dev_private *internals; @@ -47,31 +47,31 @@ check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev) internals = eth_dev->data->dev_private; - /* Check if any of slave devices is a bonded device */ - for (i = 0; i < internals->slave_count; i++) - if (valid_bonded_port_id(internals->slaves[i].port_id) == 0) + /* Check if any of member devices is a bonded device */ + for (i = 0; i < internals->member_count; i++) + if (valid_bonded_port_id(internals->members[i].port_id) == 0) return 1; return 0; } int -valid_slave_port_id(struct bond_dev_private *internals, uint16_t slave_port_id) +valid_member_port_id(struct bond_dev_private *internals, uint16_t member_port_id) { - RTE_ETH_VALID_PORTID_OR_ERR_RET(slave_port_id, -1); + RTE_ETH_VALID_PORTID_OR_ERR_RET(member_port_id, -1); - /* Verify that slave_port_id refers to a non bonded port */ - if (check_for_bonded_ethdev(&rte_eth_devices[slave_port_id]) == 0 && + /* Verify that member_port_id refers to a non bonded port */ + if (check_for_bonded_ethdev(&rte_eth_devices[member_port_id]) == 0 && internals->mode == BONDING_MODE_8023AD) { - RTE_BOND_LOG(ERR, "Cannot add slave to bonded device in 802.3ad" - " mode as slave is also a bonded device, only " + RTE_BOND_LOG(ERR, "Cannot add member to bonded device in 802.3ad" + " mode as member is also a bonded device, only " "physical devices can be support in this mode."); return -1; } - if (internals->port_id == slave_port_id) { + if (internals->port_id == member_port_id) { RTE_BOND_LOG(ERR, - "Cannot add the bonded device itself as its slave."); + "Cannot add the bonded device itself as its member."); return -1; } @@ -79,61 +79,63 @@ valid_slave_port_id(struct bond_dev_private *internals, uint16_t slave_port_id) } void -activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id) +activate_member(struct rte_eth_dev *eth_dev, uint16_t port_id) { struct bond_dev_private *internals = eth_dev->data->dev_private; - uint16_t active_count = internals->active_slave_count; + uint16_t active_count = internals->active_member_count; if (internals->mode == BONDING_MODE_8023AD) - bond_mode_8023ad_activate_slave(eth_dev, port_id); + bond_mode_8023ad_activate_member(eth_dev, port_id); if (internals->mode == BONDING_MODE_TLB || internals->mode == BONDING_MODE_ALB) { - internals->tlb_slaves_order[active_count] = port_id; + internals->tlb_members_order[active_count] = port_id; } - RTE_ASSERT(internals->active_slave_count < - (RTE_DIM(internals->active_slaves) - 1)); + RTE_ASSERT(internals->active_member_count < + (RTE_DIM(internals->active_members) - 1)); - internals->active_slaves[internals->active_slave_count] = port_id; - internals->active_slave_count++; + internals->active_members[internals->active_member_count] = port_id; + internals->active_member_count++; if (internals->mode == BONDING_MODE_TLB) - bond_tlb_activate_slave(internals); + bond_tlb_activate_member(internals); if (internals->mode == BONDING_MODE_ALB) bond_mode_alb_client_list_upd(eth_dev); } void -deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id) +deactivate_member(struct rte_eth_dev *eth_dev, uint16_t port_id) { - uint16_t slave_pos; + uint16_t member_pos; struct bond_dev_private *internals = eth_dev->data->dev_private; - uint16_t active_count = internals->active_slave_count; + uint16_t active_count = internals->active_member_count; if (internals->mode == BONDING_MODE_8023AD) { bond_mode_8023ad_stop(eth_dev); - bond_mode_8023ad_deactivate_slave(eth_dev, port_id); + bond_mode_8023ad_deactivate_member(eth_dev, port_id); } else if (internals->mode == BONDING_MODE_TLB || internals->mode == BONDING_MODE_ALB) bond_tlb_disable(internals); - slave_pos = find_slave_by_id(internals->active_slaves, active_count, + member_pos = find_member_by_id(internals->active_members, active_count, port_id); - /* If slave was not at the end of the list - * shift active slaves up active array list */ - if (slave_pos < active_count) { + /* + * If member was not at the end of the list + * shift active members up active array list. + */ + if (member_pos < active_count) { active_count--; - memmove(internals->active_slaves + slave_pos, - internals->active_slaves + slave_pos + 1, - (active_count - slave_pos) * - sizeof(internals->active_slaves[0])); + memmove(internals->active_members + member_pos, + internals->active_members + member_pos + 1, + (active_count - member_pos) * + sizeof(internals->active_members[0])); } - RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves)); - internals->active_slave_count = active_count; + RTE_ASSERT(active_count < RTE_DIM(internals->active_members)); + internals->active_member_count = active_count; if (eth_dev->data->dev_started) { if (internals->mode == BONDING_MODE_8023AD) { @@ -192,7 +194,7 @@ rte_eth_bond_free(const char *name) } static int -slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id) +member_vlan_filter_set(uint16_t bonded_port_id, uint16_t member_port_id) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; @@ -224,7 +226,7 @@ slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id) if (unlikely(slab & mask)) { uint16_t vlan_id = pos + i; - res = rte_eth_dev_vlan_filter(slave_port_id, + res = rte_eth_dev_vlan_filter(member_port_id, vlan_id, 1); } } @@ -236,45 +238,45 @@ slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id) } static int -slave_rte_flow_prepare(uint16_t slave_id, struct bond_dev_private *internals) +member_rte_flow_prepare(uint16_t member_id, struct bond_dev_private *internals) { struct rte_flow *flow; struct rte_flow_error ferror; - uint16_t slave_port_id = internals->slaves[slave_id].port_id; + uint16_t member_port_id = internals->members[member_id].port_id; if (internals->flow_isolated_valid != 0) { - if (rte_eth_dev_stop(slave_port_id) != 0) { + if (rte_eth_dev_stop(member_port_id) != 0) { RTE_BOND_LOG(ERR, "Failed to stop device on port %u", - slave_port_id); + member_port_id); return -1; } - if (rte_flow_isolate(slave_port_id, internals->flow_isolated, + if (rte_flow_isolate(member_port_id, internals->flow_isolated, &ferror)) { - RTE_BOND_LOG(ERR, "rte_flow_isolate failed for slave" - " %d: %s", slave_id, ferror.message ? + RTE_BOND_LOG(ERR, "rte_flow_isolate failed for member" + " %d: %s", member_id, ferror.message ? ferror.message : "(no stated reason)"); return -1; } } TAILQ_FOREACH(flow, &internals->flow_list, next) { - flow->flows[slave_id] = rte_flow_create(slave_port_id, + flow->flows[member_id] = rte_flow_create(member_port_id, flow->rule.attr, flow->rule.pattern, flow->rule.actions, &ferror); - if (flow->flows[slave_id] == NULL) { - RTE_BOND_LOG(ERR, "Cannot create flow for slave" - " %d: %s", slave_id, + if (flow->flows[member_id] == NULL) { + RTE_BOND_LOG(ERR, "Cannot create flow for member" + " %d: %s", member_id, ferror.message ? ferror.message : "(no stated reason)"); - /* Destroy successful bond flows from the slave */ + /* Destroy successful bond flows from the member */ TAILQ_FOREACH(flow, &internals->flow_list, next) { - if (flow->flows[slave_id] != NULL) { - rte_flow_destroy(slave_port_id, - flow->flows[slave_id], + if (flow->flows[member_id] != NULL) { + rte_flow_destroy(member_port_id, + flow->flows[member_id], &ferror); - flow->flows[slave_id] = NULL; + flow->flows[member_id] = NULL; } } return -1; @@ -284,7 +286,7 @@ slave_rte_flow_prepare(uint16_t slave_id, struct bond_dev_private *internals) } static void -eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals, +eth_bond_member_inherit_dev_info_rx_first(struct bond_dev_private *internals, const struct rte_eth_dev_info *di) { struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf; @@ -292,20 +294,20 @@ eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals, internals->reta_size = di->reta_size; internals->rss_key_len = di->hash_key_size; - /* Inherit Rx offload capabilities from the first slave device */ + /* Inherit Rx offload capabilities from the first member device */ internals->rx_offload_capa = di->rx_offload_capa; internals->rx_queue_offload_capa = di->rx_queue_offload_capa; internals->flow_type_rss_offloads = di->flow_type_rss_offloads; - /* Inherit maximum Rx packet size from the first slave device */ + /* Inherit maximum Rx packet size from the first member device */ internals->candidate_max_rx_pktlen = di->max_rx_pktlen; - /* Inherit default Rx queue settings from the first slave device */ + /* Inherit default Rx queue settings from the first member device */ memcpy(rxconf_i, &di->default_rxconf, sizeof(*rxconf_i)); /* * Turn off descriptor prefetch and writeback by default for all - * slave devices. Applications may tweak this setting if need be. + * member devices. Applications may tweak this setting if need be. */ rxconf_i->rx_thresh.pthresh = 0; rxconf_i->rx_thresh.hthresh = 0; @@ -314,26 +316,26 @@ eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals, /* Setting this to zero should effectively enable default values */ rxconf_i->rx_free_thresh = 0; - /* Disable deferred start by default for all slave devices */ + /* Disable deferred start by default for all member devices */ rxconf_i->rx_deferred_start = 0; } static void -eth_bond_slave_inherit_dev_info_tx_first(struct bond_dev_private *internals, +eth_bond_member_inherit_dev_info_tx_first(struct bond_dev_private *internals, const struct rte_eth_dev_info *di) { struct rte_eth_txconf *txconf_i = &internals->default_txconf; - /* Inherit Tx offload capabilities from the first slave device */ + /* Inherit Tx offload capabilities from the first member device */ internals->tx_offload_capa = di->tx_offload_capa; internals->tx_queue_offload_capa = di->tx_queue_offload_capa; - /* Inherit default Tx queue settings from the first slave device */ + /* Inherit default Tx queue settings from the first member device */ memcpy(txconf_i, &di->default_txconf, sizeof(*txconf_i)); /* * Turn off descriptor prefetch and writeback by default for all - * slave devices. Applications may tweak this setting if need be. + * member devices. Applications may tweak this setting if need be. */ txconf_i->tx_thresh.pthresh = 0; txconf_i->tx_thresh.hthresh = 0; @@ -341,17 +343,17 @@ eth_bond_slave_inherit_dev_info_tx_first(struct bond_dev_private *internals, /* * Setting these parameters to zero assumes that default - * values will be configured implicitly by slave devices. + * values will be configured implicitly by member devices. */ txconf_i->tx_free_thresh = 0; txconf_i->tx_rs_thresh = 0; - /* Disable deferred start by default for all slave devices */ + /* Disable deferred start by default for all member devices */ txconf_i->tx_deferred_start = 0; } static void -eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals, +eth_bond_member_inherit_dev_info_rx_next(struct bond_dev_private *internals, const struct rte_eth_dev_info *di) { struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf; @@ -362,32 +364,32 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals, internals->flow_type_rss_offloads &= di->flow_type_rss_offloads; /* - * If at least one slave device suggests enabling this - * setting by default, enable it for all slave devices + * If at least one member device suggests enabling this + * setting by default, enable it for all member devices * since disabling it may not be necessarily supported. */ if (rxconf->rx_drop_en == 1) rxconf_i->rx_drop_en = 1; /* - * Adding a new slave device may cause some of previously inherited + * Adding a new member device may cause some of previously inherited * offloads to be withdrawn from the internal rx_queue_offload_capa * value. Thus, the new internal value of default Rx queue offloads * has to be masked by rx_queue_offload_capa to make sure that only * commonly supported offloads are preserved from both the previous - * value and the value being inherited from the new slave device. + * value and the value being inherited from the new member device. */ rxconf_i->offloads = (rxconf_i->offloads | rxconf->offloads) & internals->rx_queue_offload_capa; /* - * RETA size is GCD of all slaves RETA sizes, so, if all sizes will be + * RETA size is GCD of all members RETA sizes, so, if all sizes will be * the power of 2, the lower one is GCD */ if (internals->reta_size > di->reta_size) internals->reta_size = di->reta_size; if (internals->rss_key_len > di->hash_key_size) { - RTE_BOND_LOG(WARNING, "slave has different rss key size, " + RTE_BOND_LOG(WARNING, "member has different rss key size, " "configuring rss may fail"); internals->rss_key_len = di->hash_key_size; } @@ -398,7 +400,7 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals, } static void -eth_bond_slave_inherit_dev_info_tx_next(struct bond_dev_private *internals, +eth_bond_member_inherit_dev_info_tx_next(struct bond_dev_private *internals, const struct rte_eth_dev_info *di) { struct rte_eth_txconf *txconf_i = &internals->default_txconf; @@ -408,34 +410,34 @@ eth_bond_slave_inherit_dev_info_tx_next(struct bond_dev_private *internals, internals->tx_queue_offload_capa &= di->tx_queue_offload_capa; /* - * Adding a new slave device may cause some of previously inherited + * Adding a new member device may cause some of previously inherited * offloads to be withdrawn from the internal tx_queue_offload_capa * value. Thus, the new internal value of default Tx queue offloads * has to be masked by tx_queue_offload_capa to make sure that only * commonly supported offloads are preserved from both the previous - * value and the value being inherited from the new slave device. + * value and the value being inherited from the new member device. */ txconf_i->offloads = (txconf_i->offloads | txconf->offloads) & internals->tx_queue_offload_capa; } static void -eth_bond_slave_inherit_desc_lim_first(struct rte_eth_desc_lim *bond_desc_lim, - const struct rte_eth_desc_lim *slave_desc_lim) +eth_bond_member_inherit_desc_lim_first(struct rte_eth_desc_lim *bond_desc_lim, + const struct rte_eth_desc_lim *member_desc_lim) { - memcpy(bond_desc_lim, slave_desc_lim, sizeof(*bond_desc_lim)); + memcpy(bond_desc_lim, member_desc_lim, sizeof(*bond_desc_lim)); } static int -eth_bond_slave_inherit_desc_lim_next(struct rte_eth_desc_lim *bond_desc_lim, - const struct rte_eth_desc_lim *slave_desc_lim) +eth_bond_member_inherit_desc_lim_next(struct rte_eth_desc_lim *bond_desc_lim, + const struct rte_eth_desc_lim *member_desc_lim) { bond_desc_lim->nb_max = RTE_MIN(bond_desc_lim->nb_max, - slave_desc_lim->nb_max); + member_desc_lim->nb_max); bond_desc_lim->nb_min = RTE_MAX(bond_desc_lim->nb_min, - slave_desc_lim->nb_min); + member_desc_lim->nb_min); bond_desc_lim->nb_align = RTE_MAX(bond_desc_lim->nb_align, - slave_desc_lim->nb_align); + member_desc_lim->nb_align); if (bond_desc_lim->nb_min > bond_desc_lim->nb_max || bond_desc_lim->nb_align > bond_desc_lim->nb_max) { @@ -444,22 +446,22 @@ eth_bond_slave_inherit_desc_lim_next(struct rte_eth_desc_lim *bond_desc_lim, } /* Treat maximum number of segments equal to 0 as unspecified */ - if (slave_desc_lim->nb_seg_max != 0 && + if (member_desc_lim->nb_seg_max != 0 && (bond_desc_lim->nb_seg_max == 0 || - slave_desc_lim->nb_seg_max < bond_desc_lim->nb_seg_max)) - bond_desc_lim->nb_seg_max = slave_desc_lim->nb_seg_max; - if (slave_desc_lim->nb_mtu_seg_max != 0 && + member_desc_lim->nb_seg_max < bond_desc_lim->nb_seg_max)) + bond_desc_lim->nb_seg_max = member_desc_lim->nb_seg_max; + if (member_desc_lim->nb_mtu_seg_max != 0 && (bond_desc_lim->nb_mtu_seg_max == 0 || - slave_desc_lim->nb_mtu_seg_max < bond_desc_lim->nb_mtu_seg_max)) - bond_desc_lim->nb_mtu_seg_max = slave_desc_lim->nb_mtu_seg_max; + member_desc_lim->nb_mtu_seg_max < bond_desc_lim->nb_mtu_seg_max)) + bond_desc_lim->nb_mtu_seg_max = member_desc_lim->nb_mtu_seg_max; return 0; } static int -__eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) +__eth_bond_member_add_lock_free(uint16_t bonded_port_id, uint16_t member_port_id) { - struct rte_eth_dev *bonded_eth_dev, *slave_eth_dev; + struct rte_eth_dev *bonded_eth_dev, *member_eth_dev; struct bond_dev_private *internals; struct rte_eth_link link_props; struct rte_eth_dev_info dev_info; @@ -468,78 +470,78 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) bonded_eth_dev = &rte_eth_devices[bonded_port_id]; internals = bonded_eth_dev->data->dev_private; - if (valid_slave_port_id(internals, slave_port_id) != 0) + if (valid_member_port_id(internals, member_port_id) != 0) return -1; - slave_eth_dev = &rte_eth_devices[slave_port_id]; - if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_BONDED_SLAVE) { - RTE_BOND_LOG(ERR, "Slave device is already a slave of a bonded device"); + member_eth_dev = &rte_eth_devices[member_port_id]; + if (member_eth_dev->data->dev_flags & RTE_ETH_DEV_BONDED_MEMBER) { + RTE_BOND_LOG(ERR, "Member device is already a member of a bonded device"); return -1; } - ret = rte_eth_dev_info_get(slave_port_id, &dev_info); + ret = rte_eth_dev_info_get(member_port_id, &dev_info); if (ret != 0) { RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s\n", - __func__, slave_port_id, strerror(-ret)); + __func__, member_port_id, strerror(-ret)); return ret; } if (dev_info.max_rx_pktlen < internals->max_rx_pktlen) { - RTE_BOND_LOG(ERR, "Slave (port %u) max_rx_pktlen too small", - slave_port_id); + RTE_BOND_LOG(ERR, "Member (port %u) max_rx_pktlen too small", + member_port_id); return -1; } - slave_add(internals, slave_eth_dev); + member_add(internals, member_eth_dev); - /* We need to store slaves reta_size to be able to synchronize RETA for all - * slave devices even if its sizes are different. + /* We need to store members reta_size to be able to synchronize RETA for all + * member devices even if its sizes are different. */ - internals->slaves[internals->slave_count].reta_size = dev_info.reta_size; + internals->members[internals->member_count].reta_size = dev_info.reta_size; - if (internals->slave_count < 1) { - /* if MAC is not user defined then use MAC of first slave add to + if (internals->member_count < 1) { + /* if MAC is not user defined then use MAC of first member add to * bonded device */ if (!internals->user_defined_mac) { if (mac_address_set(bonded_eth_dev, - slave_eth_dev->data->mac_addrs)) { + member_eth_dev->data->mac_addrs)) { RTE_BOND_LOG(ERR, "Failed to set MAC address"); return -1; } } - /* Make primary slave */ - internals->primary_port = slave_port_id; - internals->current_primary_port = slave_port_id; + /* Make primary member */ + internals->primary_port = member_port_id; + internals->current_primary_port = member_port_id; internals->speed_capa = dev_info.speed_capa; - /* Inherit queues settings from first slave */ - internals->nb_rx_queues = slave_eth_dev->data->nb_rx_queues; - internals->nb_tx_queues = slave_eth_dev->data->nb_tx_queues; + /* Inherit queues settings from first member */ + internals->nb_rx_queues = member_eth_dev->data->nb_rx_queues; + internals->nb_tx_queues = member_eth_dev->data->nb_tx_queues; - eth_bond_slave_inherit_dev_info_rx_first(internals, &dev_info); - eth_bond_slave_inherit_dev_info_tx_first(internals, &dev_info); + eth_bond_member_inherit_dev_info_rx_first(internals, &dev_info); + eth_bond_member_inherit_dev_info_tx_first(internals, &dev_info); - eth_bond_slave_inherit_desc_lim_first(&internals->rx_desc_lim, + eth_bond_member_inherit_desc_lim_first(&internals->rx_desc_lim, &dev_info.rx_desc_lim); - eth_bond_slave_inherit_desc_lim_first(&internals->tx_desc_lim, + eth_bond_member_inherit_desc_lim_first(&internals->tx_desc_lim, &dev_info.tx_desc_lim); } else { int ret; internals->speed_capa &= dev_info.speed_capa; - eth_bond_slave_inherit_dev_info_rx_next(internals, &dev_info); - eth_bond_slave_inherit_dev_info_tx_next(internals, &dev_info); + eth_bond_member_inherit_dev_info_rx_next(internals, &dev_info); + eth_bond_member_inherit_dev_info_tx_next(internals, &dev_info); - ret = eth_bond_slave_inherit_desc_lim_next( - &internals->rx_desc_lim, &dev_info.rx_desc_lim); + ret = eth_bond_member_inherit_desc_lim_next(&internals->rx_desc_lim, + &dev_info.rx_desc_lim); if (ret != 0) return ret; - ret = eth_bond_slave_inherit_desc_lim_next( - &internals->tx_desc_lim, &dev_info.tx_desc_lim); + ret = eth_bond_member_inherit_desc_lim_next(&internals->tx_desc_lim, + &dev_info.tx_desc_lim); if (ret != 0) return ret; } @@ -552,79 +554,81 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &= internals->flow_type_rss_offloads; - if (slave_rte_flow_prepare(internals->slave_count, internals) != 0) { - RTE_BOND_LOG(ERR, "Failed to prepare new slave flows: port=%d", - slave_port_id); + if (member_rte_flow_prepare(internals->member_count, internals) != 0) { + RTE_BOND_LOG(ERR, "Failed to prepare new member flows: port=%d", + member_port_id); return -1; } - /* Add additional MAC addresses to the slave */ - if (slave_add_mac_addresses(bonded_eth_dev, slave_port_id) != 0) { - RTE_BOND_LOG(ERR, "Failed to add mac address(es) to slave %hu", - slave_port_id); + /* Add additional MAC addresses to the member */ + if (member_add_mac_addresses(bonded_eth_dev, member_port_id) != 0) { + RTE_BOND_LOG(ERR, "Failed to add mac address(es) to member %hu", + member_port_id); return -1; } - internals->slave_count++; + internals->member_count++; if (bonded_eth_dev->data->dev_started) { - if (slave_configure(bonded_eth_dev, slave_eth_dev) != 0) { - internals->slave_count--; - RTE_BOND_LOG(ERR, "rte_bond_slaves_configure: port=%d", - slave_port_id); + if (member_configure(bonded_eth_dev, member_eth_dev) != 0) { + internals->member_count--; + RTE_BOND_LOG(ERR, "rte_bond_members_configure: port=%d", + member_port_id); return -1; } - if (slave_start(bonded_eth_dev, slave_eth_dev) != 0) { - internals->slave_count--; - RTE_BOND_LOG(ERR, "rte_bond_slaves_start: port=%d", - slave_port_id); + if (member_start(bonded_eth_dev, member_eth_dev) != 0) { + internals->member_count--; + RTE_BOND_LOG(ERR, "rte_bond_members_start: port=%d", + member_port_id); return -1; } } - /* Update all slave devices MACs */ - mac_address_slaves_update(bonded_eth_dev); + /* Update all member devices MACs */ + mac_address_members_update(bonded_eth_dev); /* Register link status change callback with bonded device pointer as * argument*/ - rte_eth_dev_callback_register(slave_port_id, RTE_ETH_EVENT_INTR_LSC, + rte_eth_dev_callback_register(member_port_id, RTE_ETH_EVENT_INTR_LSC, bond_ethdev_lsc_event_callback, &bonded_eth_dev->data->port_id); - /* If bonded device is started then we can add the slave to our active - * slave array */ + /* + * If bonded device is started then we can add the member to our active + * member array. + */ if (bonded_eth_dev->data->dev_started) { - ret = rte_eth_link_get_nowait(slave_port_id, &link_props); + ret = rte_eth_link_get_nowait(member_port_id, &link_props); if (ret < 0) { - rte_eth_dev_callback_unregister(slave_port_id, + rte_eth_dev_callback_unregister(member_port_id, RTE_ETH_EVENT_INTR_LSC, bond_ethdev_lsc_event_callback, &bonded_eth_dev->data->port_id); - internals->slave_count--; + internals->member_count--; RTE_BOND_LOG(ERR, - "Slave (port %u) link get failed: %s\n", - slave_port_id, rte_strerror(-ret)); + "Member (port %u) link get failed: %s\n", + member_port_id, rte_strerror(-ret)); return -1; } if (link_props.link_status == RTE_ETH_LINK_UP) { - if (internals->active_slave_count == 0 && + if (internals->active_member_count == 0 && !internals->user_defined_primary_port) bond_ethdev_primary_set(internals, - slave_port_id); + member_port_id); } } - /* Add slave details to bonded device */ - slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE; + /* Add member details to bonded device */ + member_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_MEMBER; - slave_vlan_filter_set(bonded_port_id, slave_port_id); + member_vlan_filter_set(bonded_port_id, member_port_id); return 0; } int -rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id) +rte_eth_bond_member_add(uint16_t bonded_port_id, uint16_t member_port_id) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; @@ -637,12 +641,12 @@ rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id) bonded_eth_dev = &rte_eth_devices[bonded_port_id]; internals = bonded_eth_dev->data->dev_private; - if (valid_slave_port_id(internals, slave_port_id) != 0) + if (valid_member_port_id(internals, member_port_id) != 0) return -1; rte_spinlock_lock(&internals->lock); - retval = __eth_bond_slave_add_lock_free(bonded_port_id, slave_port_id); + retval = __eth_bond_member_add_lock_free(bonded_port_id, member_port_id); rte_spinlock_unlock(&internals->lock); @@ -650,93 +654,95 @@ rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id) } static int -__eth_bond_slave_remove_lock_free(uint16_t bonded_port_id, - uint16_t slave_port_id) +__eth_bond_member_remove_lock_free(uint16_t bonded_port_id, + uint16_t member_port_id) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; - struct rte_eth_dev *slave_eth_dev; + struct rte_eth_dev *member_eth_dev; struct rte_flow_error flow_error; struct rte_flow *flow; - int i, slave_idx; + int i, member_idx; bonded_eth_dev = &rte_eth_devices[bonded_port_id]; internals = bonded_eth_dev->data->dev_private; - if (valid_slave_port_id(internals, slave_port_id) < 0) + if (valid_member_port_id(internals, member_port_id) < 0) return -1; - /* first remove from active slave list */ - slave_idx = find_slave_by_id(internals->active_slaves, - internals->active_slave_count, slave_port_id); + /* first remove from active member list */ + member_idx = find_member_by_id(internals->active_members, + internals->active_member_count, member_port_id); - if (slave_idx < internals->active_slave_count) - deactivate_slave(bonded_eth_dev, slave_port_id); + if (member_idx < internals->active_member_count) + deactivate_member(bonded_eth_dev, member_port_id); - slave_idx = -1; - /* now find in slave list */ - for (i = 0; i < internals->slave_count; i++) - if (internals->slaves[i].port_id == slave_port_id) { - slave_idx = i; + member_idx = -1; + /* now find in member list */ + for (i = 0; i < internals->member_count; i++) + if (internals->members[i].port_id == member_port_id) { + member_idx = i; break; } - if (slave_idx < 0) { - RTE_BOND_LOG(ERR, "Couldn't find slave in port list, slave count %u", - internals->slave_count); + if (member_idx < 0) { + RTE_BOND_LOG(ERR, "Could not find member in port list, member count %u", + internals->member_count); return -1; } /* Un-register link status change callback with bonded device pointer as * argument*/ - rte_eth_dev_callback_unregister(slave_port_id, RTE_ETH_EVENT_INTR_LSC, + rte_eth_dev_callback_unregister(member_port_id, RTE_ETH_EVENT_INTR_LSC, bond_ethdev_lsc_event_callback, &rte_eth_devices[bonded_port_id].data->port_id); - /* Restore original MAC address of slave device */ - rte_eth_dev_default_mac_addr_set(slave_port_id, - &(internals->slaves[slave_idx].persisted_mac_addr)); + /* Restore original MAC address of member device */ + rte_eth_dev_default_mac_addr_set(member_port_id, + &internals->members[member_idx].persisted_mac_addr); - /* remove additional MAC addresses from the slave */ - slave_remove_mac_addresses(bonded_eth_dev, slave_port_id); + /* remove additional MAC addresses from the member */ + member_remove_mac_addresses(bonded_eth_dev, member_port_id); /* - * Remove bond device flows from slave device. + * Remove bond device flows from member device. * Note: don't restore flow isolate mode. */ TAILQ_FOREACH(flow, &internals->flow_list, next) { - if (flow->flows[slave_idx] != NULL) { - rte_flow_destroy(slave_port_id, flow->flows[slave_idx], + if (flow->flows[member_idx] != NULL) { + rte_flow_destroy(member_port_id, flow->flows[member_idx], &flow_error); - flow->flows[slave_idx] = NULL; + flow->flows[member_idx] = NULL; } } - slave_eth_dev = &rte_eth_devices[slave_port_id]; - slave_remove(internals, slave_eth_dev); - slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE); + member_eth_dev = &rte_eth_devices[member_port_id]; + member_remove(internals, member_eth_dev); + member_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_MEMBER); - /* first slave in the active list will be the primary by default, + /* first member in the active list will be the primary by default, * otherwise use first device in list */ - if (internals->current_primary_port == slave_port_id) { - if (internals->active_slave_count > 0) - internals->current_primary_port = internals->active_slaves[0]; - else if (internals->slave_count > 0) - internals->current_primary_port = internals->slaves[0].port_id; + if (internals->current_primary_port == member_port_id) { + if (internals->active_member_count > 0) + internals->current_primary_port = internals->active_members[0]; + else if (internals->member_count > 0) + internals->current_primary_port = internals->members[0].port_id; else internals->primary_port = 0; - mac_address_slaves_update(bonded_eth_dev); + mac_address_members_update(bonded_eth_dev); } - if (internals->active_slave_count < 1) { - /* if no slaves are any longer attached to bonded device and MAC is not + if (internals->active_member_count < 1) { + /* + * if no members are any longer attached to bonded device and MAC is not * user defined then clear MAC of bonded device as it will be reset - * when a new slave is added */ - if (internals->slave_count < 1 && !internals->user_defined_mac) + * when a new member is added. + */ + if (internals->member_count < 1 && !internals->user_defined_mac) memset(rte_eth_devices[bonded_port_id].data->mac_addrs, 0, sizeof(*(rte_eth_devices[bonded_port_id].data->mac_addrs))); } - if (internals->slave_count == 0) { + if (internals->member_count == 0) { internals->rx_offload_capa = 0; internals->tx_offload_capa = 0; internals->rx_queue_offload_capa = 0; @@ -750,7 +756,7 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id, } int -rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t slave_port_id) +rte_eth_bond_member_remove(uint16_t bonded_port_id, uint16_t member_port_id) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; @@ -764,7 +770,7 @@ rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t slave_port_id) rte_spinlock_lock(&internals->lock); - retval = __eth_bond_slave_remove_lock_free(bonded_port_id, slave_port_id); + retval = __eth_bond_member_remove_lock_free(bonded_port_id, member_port_id); rte_spinlock_unlock(&internals->lock); @@ -781,7 +787,7 @@ rte_eth_bond_mode_set(uint16_t bonded_port_id, uint8_t mode) bonded_eth_dev = &rte_eth_devices[bonded_port_id]; - if (check_for_master_bonded_ethdev(bonded_eth_dev) != 0 && + if (check_for_main_bonded_ethdev(bonded_eth_dev) != 0 && mode == BONDING_MODE_8023AD) return -1; @@ -802,7 +808,7 @@ rte_eth_bond_mode_get(uint16_t bonded_port_id) } int -rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id) +rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t member_port_id) { struct bond_dev_private *internals; @@ -811,13 +817,13 @@ rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id) internals = rte_eth_devices[bonded_port_id].data->dev_private; - if (valid_slave_port_id(internals, slave_port_id) != 0) + if (valid_member_port_id(internals, member_port_id) != 0) return -1; internals->user_defined_primary_port = 1; - internals->primary_port = slave_port_id; + internals->primary_port = member_port_id; - bond_ethdev_primary_set(internals, slave_port_id); + bond_ethdev_primary_set(internals, member_port_id); return 0; } @@ -832,14 +838,14 @@ rte_eth_bond_primary_get(uint16_t bonded_port_id) internals = rte_eth_devices[bonded_port_id].data->dev_private; - if (internals->slave_count < 1) + if (internals->member_count < 1) return -1; return internals->current_primary_port; } int -rte_eth_bond_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], +rte_eth_bond_members_get(uint16_t bonded_port_id, uint16_t members[], uint16_t len) { struct bond_dev_private *internals; @@ -848,22 +854,22 @@ rte_eth_bond_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], if (valid_bonded_port_id(bonded_port_id) != 0) return -1; - if (slaves == NULL) + if (members == NULL) return -1; internals = rte_eth_devices[bonded_port_id].data->dev_private; - if (internals->slave_count > len) + if (internals->member_count > len) return -1; - for (i = 0; i < internals->slave_count; i++) - slaves[i] = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) + members[i] = internals->members[i].port_id; - return internals->slave_count; + return internals->member_count; } int -rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], +rte_eth_bond_active_members_get(uint16_t bonded_port_id, uint16_t members[], uint16_t len) { struct bond_dev_private *internals; @@ -871,18 +877,18 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], if (valid_bonded_port_id(bonded_port_id) != 0) return -1; - if (slaves == NULL) + if (members == NULL) return -1; internals = rte_eth_devices[bonded_port_id].data->dev_private; - if (internals->active_slave_count > len) + if (internals->active_member_count > len) return -1; - memcpy(slaves, internals->active_slaves, - internals->active_slave_count * sizeof(internals->active_slaves[0])); + memcpy(members, internals->active_members, + internals->active_member_count * sizeof(internals->active_members[0])); - return internals->active_slave_count; + return internals->active_member_count; } int @@ -904,9 +910,9 @@ rte_eth_bond_mac_address_set(uint16_t bonded_port_id, internals->user_defined_mac = 1; - /* Update all slave devices MACs*/ - if (internals->slave_count > 0) - return mac_address_slaves_update(bonded_eth_dev); + /* Update all member devices MACs*/ + if (internals->member_count > 0) + return mac_address_members_update(bonded_eth_dev); return 0; } @@ -925,30 +931,30 @@ rte_eth_bond_mac_address_reset(uint16_t bonded_port_id) internals->user_defined_mac = 0; - if (internals->slave_count > 0) { - int slave_port; - /* Get the primary slave location based on the primary port - * number as, while slave_add(), we will keep the primary - * slave based on slave_count,but not based on the primary port. + if (internals->member_count > 0) { + int member_port; + /* Get the primary member location based on the primary port + * number as, while member_add(), we will keep the primary + * member based on member_count,but not based on the primary port. */ - for (slave_port = 0; slave_port < internals->slave_count; - slave_port++) { - if (internals->slaves[slave_port].port_id == + for (member_port = 0; member_port < internals->member_count; + member_port++) { + if (internals->members[member_port].port_id == internals->primary_port) break; } /* Set MAC Address of Bonded Device */ if (mac_address_set(bonded_eth_dev, - &internals->slaves[slave_port].persisted_mac_addr) + &internals->members[member_port].persisted_mac_addr) != 0) { RTE_BOND_LOG(ERR, "Failed to set MAC address on bonded device"); return -1; } - /* Update all slave devices MAC addresses */ - return mac_address_slaves_update(bonded_eth_dev); + /* Update all member devices MAC addresses */ + return mac_address_members_update(bonded_eth_dev); } - /* No need to update anything as no slaves present */ + /* No need to update anything as no members present */ return 0; } diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index 6553166f5c..cbc905f700 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -12,8 +12,8 @@ #include "eth_bond_private.h" const char *pmd_bond_init_valid_arguments[] = { - PMD_BOND_SLAVE_PORT_KVARG, - PMD_BOND_PRIMARY_SLAVE_KVARG, + PMD_BOND_MEMBER_PORT_KVARG, + PMD_BOND_PRIMARY_MEMBER_KVARG, PMD_BOND_MODE_KVARG, PMD_BOND_XMIT_POLICY_KVARG, PMD_BOND_SOCKET_ID_KVARG, @@ -109,31 +109,31 @@ parse_port_id(const char *port_str) } int -bond_ethdev_parse_slave_port_kvarg(const char *key, +bond_ethdev_parse_member_port_kvarg(const char *key, const char *value, void *extra_args) { - struct bond_ethdev_slave_ports *slave_ports; + struct bond_ethdev_member_ports *member_ports; if (value == NULL || extra_args == NULL) return -1; - slave_ports = extra_args; + member_ports = extra_args; - if (strcmp(key, PMD_BOND_SLAVE_PORT_KVARG) == 0) { + if (strcmp(key, PMD_BOND_MEMBER_PORT_KVARG) == 0) { int port_id = parse_port_id(value); if (port_id < 0) { - RTE_BOND_LOG(ERR, "Invalid slave port value (%s) specified", + RTE_BOND_LOG(ERR, "Invalid member port value (%s) specified", value); return -1; } else - slave_ports->slaves[slave_ports->slave_count++] = + member_ports->members[member_ports->member_count++] = port_id; } return 0; } int -bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused, +bond_ethdev_parse_member_mode_kvarg(const char *key __rte_unused, const char *value, void *extra_args) { uint8_t *mode; @@ -160,13 +160,13 @@ bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused, case BONDING_MODE_ALB: return 0; default: - RTE_BOND_LOG(ERR, "Invalid slave mode value (%s) specified", value); + RTE_BOND_LOG(ERR, "Invalid member mode value (%s) specified", value); return -1; } } int -bond_ethdev_parse_slave_agg_mode_kvarg(const char *key __rte_unused, +bond_ethdev_parse_member_agg_mode_kvarg(const char *key __rte_unused, const char *value, void *extra_args) { uint8_t *agg_mode; @@ -221,19 +221,19 @@ bond_ethdev_parse_socket_id_kvarg(const char *key __rte_unused, } int -bond_ethdev_parse_primary_slave_port_id_kvarg(const char *key __rte_unused, +bond_ethdev_parse_primary_member_port_id_kvarg(const char *key __rte_unused, const char *value, void *extra_args) { - int primary_slave_port_id; + int primary_member_port_id; if (value == NULL || extra_args == NULL) return -1; - primary_slave_port_id = parse_port_id(value); - if (primary_slave_port_id < 0) + primary_member_port_id = parse_port_id(value); + if (primary_member_port_id < 0) return -1; - *(uint16_t *)extra_args = (uint16_t)primary_slave_port_id; + *(uint16_t *)extra_args = (uint16_t)primary_member_port_id; return 0; } diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 65b77faae7..71a91675f7 100644 --- a/drivers/net/bonding/rte_eth_bond_flow.c +++ b/drivers/net/bonding/rte_eth_bond_flow.c @@ -69,12 +69,12 @@ bond_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, int i; int ret; - for (i = 0; i < internals->slave_count; i++) { - ret = rte_flow_validate(internals->slaves[i].port_id, attr, + for (i = 0; i < internals->member_count; i++) { + ret = rte_flow_validate(internals->members[i].port_id, attr, patterns, actions, err); if (ret) { RTE_BOND_LOG(ERR, "Operation rte_flow_validate failed" - " for slave %d with error %d", i, ret); + " for member %d with error %d", i, ret); return ret; } } @@ -97,11 +97,11 @@ bond_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, NULL, rte_strerror(ENOMEM)); return NULL; } - for (i = 0; i < internals->slave_count; i++) { - flow->flows[i] = rte_flow_create(internals->slaves[i].port_id, + for (i = 0; i < internals->member_count; i++) { + flow->flows[i] = rte_flow_create(internals->members[i].port_id, attr, patterns, actions, err); if (unlikely(flow->flows[i] == NULL)) { - RTE_BOND_LOG(ERR, "Failed to create flow on slave %d", + RTE_BOND_LOG(ERR, "Failed to create flow on member %d", i); goto err; } @@ -109,10 +109,10 @@ bond_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, TAILQ_INSERT_TAIL(&internals->flow_list, flow, next); return flow; err: - /* Destroy all slaves flows. */ - for (i = 0; i < internals->slave_count; i++) { + /* Destroy all members flows. */ + for (i = 0; i < internals->member_count; i++) { if (flow->flows[i] != NULL) - rte_flow_destroy(internals->slaves[i].port_id, + rte_flow_destroy(internals->members[i].port_id, flow->flows[i], err); } bond_flow_release(&flow); @@ -127,15 +127,15 @@ bond_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, int i; int ret = 0; - for (i = 0; i < internals->slave_count; i++) { + for (i = 0; i < internals->member_count; i++) { int lret; if (unlikely(flow->flows[i] == NULL)) continue; - lret = rte_flow_destroy(internals->slaves[i].port_id, + lret = rte_flow_destroy(internals->members[i].port_id, flow->flows[i], err); if (unlikely(lret != 0)) { - RTE_BOND_LOG(ERR, "Failed to destroy flow on slave %d:" + RTE_BOND_LOG(ERR, "Failed to destroy flow on member %d:" " %d", i, lret); ret = lret; } @@ -154,7 +154,7 @@ bond_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *err) int ret = 0; int lret; - /* Destroy all bond flows from its slaves instead of flushing them to + /* Destroy all bond flows from its members instead of flushing them to * keep the LACP flow or any other external flows. */ RTE_TAILQ_FOREACH_SAFE(flow, &internals->flow_list, next, tmp) { @@ -163,7 +163,7 @@ bond_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *err) ret = lret; } if (unlikely(ret != 0)) - RTE_BOND_LOG(ERR, "Failed to flush flow in all slaves"); + RTE_BOND_LOG(ERR, "Failed to flush flow in all members"); return ret; } @@ -174,26 +174,26 @@ bond_flow_query_count(struct rte_eth_dev *dev, struct rte_flow *flow, struct rte_flow_error *err) { struct bond_dev_private *internals = dev->data->dev_private; - struct rte_flow_query_count slave_count; + struct rte_flow_query_count member_count; int i; int ret; count->bytes = 0; count->hits = 0; - rte_memcpy(&slave_count, count, sizeof(slave_count)); - for (i = 0; i < internals->slave_count; i++) { - ret = rte_flow_query(internals->slaves[i].port_id, + rte_memcpy(&member_count, count, sizeof(member_count)); + for (i = 0; i < internals->member_count; i++) { + ret = rte_flow_query(internals->members[i].port_id, flow->flows[i], action, - &slave_count, err); + &member_count, err); if (unlikely(ret != 0)) { RTE_BOND_LOG(ERR, "Failed to query flow on" - " slave %d: %d", i, ret); + " member %d: %d", i, ret); return ret; } - count->bytes += slave_count.bytes; - count->hits += slave_count.hits; - slave_count.bytes = 0; - slave_count.hits = 0; + count->bytes += member_count.bytes; + count->hits += member_count.hits; + member_count.bytes = 0; + member_count.hits = 0; } return 0; } @@ -221,11 +221,11 @@ bond_flow_isolate(struct rte_eth_dev *dev, int set, int i; int ret; - for (i = 0; i < internals->slave_count; i++) { - ret = rte_flow_isolate(internals->slaves[i].port_id, set, err); + for (i = 0; i < internals->member_count; i++) { + ret = rte_flow_isolate(internals->members[i].port_id, set, err); if (unlikely(ret != 0)) { RTE_BOND_LOG(ERR, "Operation rte_flow_isolate failed" - " for slave %d with error %d", i, ret); + " for member %d with error %d", i, ret); internals->flow_isolated_valid = 0; return ret; } diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index f0c4f7d26b..0e17febcf6 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -61,33 +61,35 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct bond_dev_private *internals; uint16_t num_rx_total = 0; - uint16_t slave_count; - uint16_t active_slave; + uint16_t member_count; + uint16_t active_member; int i; /* Cast to structure, containing bonded device's port id and queue id */ struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue; internals = bd_rx_q->dev_private; - slave_count = internals->active_slave_count; - active_slave = bd_rx_q->active_slave; + member_count = internals->active_member_count; + active_member = bd_rx_q->active_member; - for (i = 0; i < slave_count && nb_pkts; i++) { - uint16_t num_rx_slave; + for (i = 0; i < member_count && nb_pkts; i++) { + uint16_t num_rx_member; - /* Offset of pointer to *bufs increases as packets are received - * from other slaves */ - num_rx_slave = - rte_eth_rx_burst(internals->active_slaves[active_slave], + /* + * Offset of pointer to *bufs increases as packets are received + * from other members. + */ + num_rx_member = + rte_eth_rx_burst(internals->active_members[active_member], bd_rx_q->queue_id, bufs + num_rx_total, nb_pkts); - num_rx_total += num_rx_slave; - nb_pkts -= num_rx_slave; - if (++active_slave >= slave_count) - active_slave = 0; + num_rx_total += num_rx_member; + nb_pkts -= num_rx_member; + if (++active_member >= member_count) + active_member = 0; } - if (++bd_rx_q->active_slave >= slave_count) - bd_rx_q->active_slave = 0; + if (++bd_rx_q->active_member >= member_count) + bd_rx_q->active_member = 0; return num_rx_total; } @@ -158,8 +160,8 @@ const struct rte_flow_attr flow_attr_8023ad = { int bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, - uint16_t slave_port) { - struct rte_eth_dev_info slave_info; + uint16_t member_port) { + struct rte_eth_dev_info member_info; struct rte_flow_error error; struct bond_dev_private *internals = bond_dev->data->dev_private; @@ -177,29 +179,29 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, } }; - int ret = rte_flow_validate(slave_port, &flow_attr_8023ad, + int ret = rte_flow_validate(member_port, &flow_attr_8023ad, flow_item_8023ad, actions, &error); if (ret < 0) { - RTE_BOND_LOG(ERR, "%s: %s (slave_port=%d queue_id=%d)", - __func__, error.message, slave_port, + RTE_BOND_LOG(ERR, "%s: %s (member_port=%d queue_id=%d)", + __func__, error.message, member_port, internals->mode4.dedicated_queues.rx_qid); return -1; } - ret = rte_eth_dev_info_get(slave_port, &slave_info); + ret = rte_eth_dev_info_get(member_port, &member_info); if (ret != 0) { RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s\n", - __func__, slave_port, strerror(-ret)); + __func__, member_port, strerror(-ret)); return ret; } - if (slave_info.max_rx_queues < bond_dev->data->nb_rx_queues || - slave_info.max_tx_queues < bond_dev->data->nb_tx_queues) { + if (member_info.max_rx_queues < bond_dev->data->nb_rx_queues || + member_info.max_tx_queues < bond_dev->data->nb_tx_queues) { RTE_BOND_LOG(ERR, - "%s: Slave %d capabilities doesn't allow allocating additional queues", - __func__, slave_port); + "%s: Member %d capabilities doesn't allow allocating additional queues", + __func__, member_port); return -1; } @@ -214,8 +216,8 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) { uint16_t idx; int ret; - /* Verify if all slaves in bonding supports flow director and */ - if (internals->slave_count > 0) { + /* Verify if all members in bonding supports flow director and */ + if (internals->member_count > 0) { ret = rte_eth_dev_info_get(bond_dev->data->port_id, &bond_info); if (ret != 0) { RTE_BOND_LOG(ERR, @@ -229,9 +231,9 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) { internals->mode4.dedicated_queues.rx_qid = bond_info.nb_rx_queues; internals->mode4.dedicated_queues.tx_qid = bond_info.nb_tx_queues; - for (idx = 0; idx < internals->slave_count; idx++) { + for (idx = 0; idx < internals->member_count; idx++) { if (bond_ethdev_8023ad_flow_verify(bond_dev, - internals->slaves[idx].port_id) != 0) + internals->members[idx].port_id) != 0) return -1; } } @@ -240,7 +242,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) { } int -bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) { +bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t member_port) { struct rte_flow_error error; struct bond_dev_private *internals = bond_dev->data->dev_private; @@ -258,12 +260,12 @@ bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) { } }; - internals->mode4.dedicated_queues.flow[slave_port] = rte_flow_create(slave_port, + internals->mode4.dedicated_queues.flow[member_port] = rte_flow_create(member_port, &flow_attr_8023ad, flow_item_8023ad, actions, &error); - if (internals->mode4.dedicated_queues.flow[slave_port] == NULL) { + if (internals->mode4.dedicated_queues.flow[member_port] == NULL) { RTE_BOND_LOG(ERR, "bond_ethdev_8023ad_flow_set: %s " - "(slave_port=%d queue_id=%d)", - error.message, slave_port, + "(member_port=%d queue_id=%d)", + error.message, member_port, internals->mode4.dedicated_queues.rx_qid); return -1; } @@ -304,10 +306,10 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, const uint16_t ether_type_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); uint16_t num_rx_total = 0; /* Total number of received packets */ - uint16_t slaves[RTE_MAX_ETHPORTS]; - uint16_t slave_count, idx; + uint16_t members[RTE_MAX_ETHPORTS]; + uint16_t member_count, idx; - uint8_t collecting; /* current slave collecting status */ + uint8_t collecting; /* current member collecting status */ const uint8_t promisc = rte_eth_promiscuous_get(internals->port_id); const uint8_t allmulti = rte_eth_allmulticast_get(internals->port_id); uint8_t subtype; @@ -315,24 +317,24 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, uint16_t j; uint16_t k; - /* Copy slave list to protect against slave up/down changes during tx + /* Copy member list to protect against member up/down changes during tx * bursting */ - slave_count = internals->active_slave_count; - memcpy(slaves, internals->active_slaves, - sizeof(internals->active_slaves[0]) * slave_count); + member_count = internals->active_member_count; + memcpy(members, internals->active_members, + sizeof(internals->active_members[0]) * member_count); - idx = bd_rx_q->active_slave; - if (idx >= slave_count) { - bd_rx_q->active_slave = 0; + idx = bd_rx_q->active_member; + if (idx >= member_count) { + bd_rx_q->active_member = 0; idx = 0; } - for (i = 0; i < slave_count && num_rx_total < nb_pkts; i++) { + for (i = 0; i < member_count && num_rx_total < nb_pkts; i++) { j = num_rx_total; - collecting = ACTOR_STATE(&bond_mode_8023ad_ports[slaves[idx]], + collecting = ACTOR_STATE(&bond_mode_8023ad_ports[members[idx]], COLLECTING); - /* Read packets from this slave */ - num_rx_total += rte_eth_rx_burst(slaves[idx], bd_rx_q->queue_id, + /* Read packets from this member */ + num_rx_total += rte_eth_rx_burst(members[idx], bd_rx_q->queue_id, &bufs[num_rx_total], nb_pkts - num_rx_total); for (k = j; k < 2 && k < num_rx_total; k++) @@ -348,7 +350,7 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, /* Remove packet from array if: * - it is slow packet but no dedicated rxq is present, - * - slave is not in collecting state, + * - member is not in collecting state, * - bonding interface is not in promiscuous mode and * packet address isn't in mac_addrs array: * - packet is unicast, @@ -367,7 +369,7 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, !allmulti)))) { if (hdr->ether_type == ether_type_slow_be) { bond_mode_8023ad_handle_slow_pkt( - internals, slaves[idx], bufs[j]); + internals, members[idx], bufs[j]); } else rte_pktmbuf_free(bufs[j]); @@ -380,12 +382,12 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, } else j++; } - if (unlikely(++idx == slave_count)) + if (unlikely(++idx == member_count)) idx = 0; } - if (++bd_rx_q->active_slave >= slave_count) - bd_rx_q->active_slave = 0; + if (++bd_rx_q->active_member >= member_count) + bd_rx_q->active_member = 0; return num_rx_total; } @@ -406,7 +408,7 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs, #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) uint32_t burstnumberRX; -uint32_t burstnumberTX; +uint32_t burst_number_TX; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB @@ -583,59 +585,61 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs, struct bond_dev_private *internals; struct bond_tx_queue *bd_tx_q; - struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_pkts]; - uint16_t slave_nb_pkts[RTE_MAX_ETHPORTS] = { 0 }; + struct rte_mbuf *member_bufs[RTE_MAX_ETHPORTS][nb_pkts]; + uint16_t member_nb_pkts[RTE_MAX_ETHPORTS] = { 0 }; - uint16_t num_of_slaves; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t num_of_members; + uint16_t members[RTE_MAX_ETHPORTS]; - uint16_t num_tx_total = 0, num_tx_slave; + uint16_t num_tx_total = 0, num_tx_member; - static int slave_idx = 0; - int i, cslave_idx = 0, tx_fail_total = 0; + static int member_idx; + int i, cmember_idx = 0, tx_fail_total = 0; bd_tx_q = (struct bond_tx_queue *)queue; internals = bd_tx_q->dev_private; - /* Copy slave list to protect against slave up/down changes during tx + /* Copy member list to protect against member up/down changes during tx * bursting */ - num_of_slaves = internals->active_slave_count; - memcpy(slaves, internals->active_slaves, - sizeof(internals->active_slaves[0]) * num_of_slaves); + num_of_members = internals->active_member_count; + memcpy(members, internals->active_members, + sizeof(internals->active_members[0]) * num_of_members); - if (num_of_slaves < 1) + if (num_of_members < 1) return num_tx_total; - /* Populate slaves mbuf with which packets are to be sent on it */ + /* Populate members mbuf with which packets are to be sent on it */ for (i = 0; i < nb_pkts; i++) { - cslave_idx = (slave_idx + i) % num_of_slaves; - slave_bufs[cslave_idx][(slave_nb_pkts[cslave_idx])++] = bufs[i]; + cmember_idx = (member_idx + i) % num_of_members; + member_bufs[cmember_idx][(member_nb_pkts[cmember_idx])++] = bufs[i]; } - /* increment current slave index so the next call to tx burst starts on the - * next slave */ - slave_idx = ++cslave_idx; + /* + * increment current member index so the next call to tx burst starts on the + * next member. + */ + member_idx = ++cmember_idx; - /* Send packet burst on each slave device */ - for (i = 0; i < num_of_slaves; i++) { - if (slave_nb_pkts[i] > 0) { - num_tx_slave = rte_eth_tx_prepare(slaves[i], - bd_tx_q->queue_id, slave_bufs[i], - slave_nb_pkts[i]); - num_tx_slave = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, - slave_bufs[i], num_tx_slave); + /* Send packet burst on each member device */ + for (i = 0; i < num_of_members; i++) { + if (member_nb_pkts[i] > 0) { + num_tx_member = rte_eth_tx_prepare(members[i], + bd_tx_q->queue_id, member_bufs[i], + member_nb_pkts[i]); + num_tx_member = rte_eth_tx_burst(members[i], bd_tx_q->queue_id, + member_bufs[i], num_tx_member); /* if tx burst fails move packets to end of bufs */ - if (unlikely(num_tx_slave < slave_nb_pkts[i])) { - int tx_fail_slave = slave_nb_pkts[i] - num_tx_slave; + if (unlikely(num_tx_member < member_nb_pkts[i])) { + int tx_fail_member = member_nb_pkts[i] - num_tx_member; - tx_fail_total += tx_fail_slave; + tx_fail_total += tx_fail_member; memcpy(&bufs[nb_pkts - tx_fail_total], - &slave_bufs[i][num_tx_slave], - tx_fail_slave * sizeof(bufs[0])); + &member_bufs[i][num_tx_member], + tx_fail_member * sizeof(bufs[0])); } - num_tx_total += num_tx_slave; + num_tx_total += num_tx_member; } } @@ -653,7 +657,7 @@ bond_ethdev_tx_burst_active_backup(void *queue, bd_tx_q = (struct bond_tx_queue *)queue; internals = bd_tx_q->dev_private; - if (internals->active_slave_count < 1) + if (internals->active_member_count < 1) return 0; nb_prep_pkts = rte_eth_tx_prepare(internals->current_primary_port, @@ -699,7 +703,7 @@ ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr) void burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves) + uint16_t member_count, uint16_t *members) { struct rte_ether_hdr *eth_hdr; uint32_t hash; @@ -710,13 +714,13 @@ burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, hash = ether_hash(eth_hdr); - slaves[i] = (hash ^= hash >> 8) % slave_count; + members[i] = (hash ^= hash >> 8) % member_count; } } void burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves) + uint16_t member_count, uint16_t *members) { uint16_t i; struct rte_ether_hdr *eth_hdr; @@ -748,13 +752,13 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, hash ^= hash >> 16; hash ^= hash >> 8; - slaves[i] = hash % slave_count; + members[i] = hash % member_count; } } void burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t slave_count, uint16_t *slaves) + uint16_t member_count, uint16_t *members) { struct rte_ether_hdr *eth_hdr; uint16_t proto; @@ -822,30 +826,29 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, hash ^= hash >> 16; hash ^= hash >> 8; - slaves[i] = hash % slave_count; + members[i] = hash % member_count; } } -struct bwg_slave { +struct bwg_member { uint64_t bwg_left_int; uint64_t bwg_left_remainder; - uint16_t slave; + uint16_t member; }; void -bond_tlb_activate_slave(struct bond_dev_private *internals) { +bond_tlb_activate_member(struct bond_dev_private *internals) { int i; - for (i = 0; i < internals->active_slave_count; i++) { - tlb_last_obytets[internals->active_slaves[i]] = 0; - } + for (i = 0; i < internals->active_member_count; i++) + tlb_last_obytets[internals->active_members[i]] = 0; } static int bandwidth_cmp(const void *a, const void *b) { - const struct bwg_slave *bwg_a = a; - const struct bwg_slave *bwg_b = b; + const struct bwg_member *bwg_a = a; + const struct bwg_member *bwg_b = b; int64_t diff = (int64_t)bwg_b->bwg_left_int - (int64_t)bwg_a->bwg_left_int; int64_t diff2 = (int64_t)bwg_b->bwg_left_remainder - (int64_t)bwg_a->bwg_left_remainder; @@ -863,14 +866,14 @@ bandwidth_cmp(const void *a, const void *b) static void bandwidth_left(uint16_t port_id, uint64_t load, uint8_t update_idx, - struct bwg_slave *bwg_slave) + struct bwg_member *bwg_member) { struct rte_eth_link link_status; int ret; ret = rte_eth_link_get_nowait(port_id, &link_status); if (ret < 0) { - RTE_BOND_LOG(ERR, "Slave (port %u) link get failed: %s", + RTE_BOND_LOG(ERR, "Member (port %u) link get failed: %s", port_id, rte_strerror(-ret)); return; } @@ -878,51 +881,51 @@ bandwidth_left(uint16_t port_id, uint64_t load, uint8_t update_idx, if (link_bwg == 0) return; link_bwg = link_bwg * (update_idx+1) * REORDER_PERIOD_MS; - bwg_slave->bwg_left_int = (link_bwg - 1000*load) / link_bwg; - bwg_slave->bwg_left_remainder = (link_bwg - 1000*load) % link_bwg; + bwg_member->bwg_left_int = (link_bwg - 1000 * load) / link_bwg; + bwg_member->bwg_left_remainder = (link_bwg - 1000 * load) % link_bwg; } static void -bond_ethdev_update_tlb_slave_cb(void *arg) +bond_ethdev_update_tlb_member_cb(void *arg) { struct bond_dev_private *internals = arg; - struct rte_eth_stats slave_stats; - struct bwg_slave bwg_array[RTE_MAX_ETHPORTS]; - uint16_t slave_count; + struct rte_eth_stats member_stats; + struct bwg_member bwg_array[RTE_MAX_ETHPORTS]; + uint16_t member_count; uint64_t tx_bytes; uint8_t update_stats = 0; - uint16_t slave_id; + uint16_t member_id; uint16_t i; - internals->slave_update_idx++; + internals->member_update_idx++; - if (internals->slave_update_idx >= REORDER_PERIOD_MS) + if (internals->member_update_idx >= REORDER_PERIOD_MS) update_stats = 1; - for (i = 0; i < internals->active_slave_count; i++) { - slave_id = internals->active_slaves[i]; - rte_eth_stats_get(slave_id, &slave_stats); - tx_bytes = slave_stats.obytes - tlb_last_obytets[slave_id]; - bandwidth_left(slave_id, tx_bytes, - internals->slave_update_idx, &bwg_array[i]); - bwg_array[i].slave = slave_id; + for (i = 0; i < internals->active_member_count; i++) { + member_id = internals->active_members[i]; + rte_eth_stats_get(member_id, &member_stats); + tx_bytes = member_stats.obytes - tlb_last_obytets[member_id]; + bandwidth_left(member_id, tx_bytes, + internals->member_update_idx, &bwg_array[i]); + bwg_array[i].member = member_id; if (update_stats) { - tlb_last_obytets[slave_id] = slave_stats.obytes; + tlb_last_obytets[member_id] = member_stats.obytes; } } if (update_stats == 1) - internals->slave_update_idx = 0; + internals->member_update_idx = 0; - slave_count = i; - qsort(bwg_array, slave_count, sizeof(bwg_array[0]), bandwidth_cmp); - for (i = 0; i < slave_count; i++) - internals->tlb_slaves_order[i] = bwg_array[i].slave; + member_count = i; + qsort(bwg_array, member_count, sizeof(bwg_array[0]), bandwidth_cmp); + for (i = 0; i < member_count; i++) + internals->tlb_members_order[i] = bwg_array[i].member; - rte_eal_alarm_set(REORDER_PERIOD_MS * 1000, bond_ethdev_update_tlb_slave_cb, + rte_eal_alarm_set(REORDER_PERIOD_MS * 1000, bond_ethdev_update_tlb_member_cb, (struct bond_dev_private *)internals); } @@ -937,29 +940,29 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint16_t num_tx_total = 0, num_tx_prep; uint16_t i, j; - uint16_t num_of_slaves = internals->active_slave_count; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t num_of_members = internals->active_member_count; + uint16_t members[RTE_MAX_ETHPORTS]; struct rte_ether_hdr *ether_hdr; - struct rte_ether_addr primary_slave_addr; - struct rte_ether_addr active_slave_addr; + struct rte_ether_addr primary_member_addr; + struct rte_ether_addr active_member_addr; - if (num_of_slaves < 1) + if (num_of_members < 1) return num_tx_total; - memcpy(slaves, internals->tlb_slaves_order, - sizeof(internals->tlb_slaves_order[0]) * num_of_slaves); + memcpy(members, internals->tlb_members_order, + sizeof(internals->tlb_members_order[0]) * num_of_members); - rte_ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); + rte_ether_addr_copy(primary_port->data->mac_addrs, &primary_member_addr); if (nb_pkts > 3) { for (i = 0; i < 3; i++) rte_prefetch0(rte_pktmbuf_mtod(bufs[i], void*)); } - for (i = 0; i < num_of_slaves; i++) { - rte_eth_macaddr_get(slaves[i], &active_slave_addr); + for (i = 0; i < num_of_members; i++) { + rte_eth_macaddr_get(members[i], &active_member_addr); for (j = num_tx_total; j < nb_pkts; j++) { if (j + 3 < nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); @@ -967,17 +970,18 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); if (rte_is_same_ether_addr(ðer_hdr->src_addr, - &primary_slave_addr)) - rte_ether_addr_copy(&active_slave_addr, + &primary_member_addr)) + rte_ether_addr_copy(&active_member_addr, ðer_hdr->src_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) - mode6_debug("TX IPv4:", ether_hdr, slaves[i], &burstnumberTX); + mode6_debug("TX IPv4:", ether_hdr, members[i], + &burst_number_TX); #endif } - num_tx_prep = rte_eth_tx_prepare(slaves[i], bd_tx_q->queue_id, + num_tx_prep = rte_eth_tx_prepare(members[i], bd_tx_q->queue_id, bufs + num_tx_total, nb_pkts - num_tx_total); - num_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, + num_tx_total += rte_eth_tx_burst(members[i], bd_tx_q->queue_id, bufs + num_tx_total, num_tx_prep); if (num_tx_total == nb_pkts) @@ -990,13 +994,13 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) void bond_tlb_disable(struct bond_dev_private *internals) { - rte_eal_alarm_cancel(bond_ethdev_update_tlb_slave_cb, internals); + rte_eal_alarm_cancel(bond_ethdev_update_tlb_member_cb, internals); } void bond_tlb_enable(struct bond_dev_private *internals) { - bond_ethdev_update_tlb_slave_cb(internals); + bond_ethdev_update_tlb_member_cb(internals); } static uint16_t @@ -1011,11 +1015,11 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct client_data *client_info; /* - * We create transmit buffers for every slave and one additional to send + * We create transmit buffers for every member and one additional to send * through tlb. In worst case every packet will be send on one port. */ - struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS + 1][nb_pkts]; - uint16_t slave_bufs_pkts[RTE_MAX_ETHPORTS + 1] = { 0 }; + struct rte_mbuf *member_bufs[RTE_MAX_ETHPORTS + 1][nb_pkts]; + uint16_t member_bufs_pkts[RTE_MAX_ETHPORTS + 1] = { 0 }; /* * We create separate transmit buffers for update packets as they won't @@ -1029,7 +1033,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint16_t num_send, num_not_send = 0; uint16_t num_tx_total = 0; - uint16_t slave_idx; + uint16_t member_idx; int i, j; @@ -1040,19 +1044,19 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) offset = get_vlan_offset(eth_h, ðer_type); if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { - slave_idx = bond_mode_alb_arp_xmit(eth_h, offset, internals); + member_idx = bond_mode_alb_arp_xmit(eth_h, offset, internals); /* Change src mac in eth header */ - rte_eth_macaddr_get(slave_idx, ð_h->src_addr); + rte_eth_macaddr_get(member_idx, ð_h->src_addr); - /* Add packet to slave tx buffer */ - slave_bufs[slave_idx][slave_bufs_pkts[slave_idx]] = bufs[i]; - slave_bufs_pkts[slave_idx]++; + /* Add packet to member tx buffer */ + member_bufs[member_idx][member_bufs_pkts[member_idx]] = bufs[i]; + member_bufs_pkts[member_idx]++; } else { /* If packet is not ARP, send it with TLB policy */ - slave_bufs[RTE_MAX_ETHPORTS][slave_bufs_pkts[RTE_MAX_ETHPORTS]] = + member_bufs[RTE_MAX_ETHPORTS][member_bufs_pkts[RTE_MAX_ETHPORTS]] = bufs[i]; - slave_bufs_pkts[RTE_MAX_ETHPORTS]++; + member_bufs_pkts[RTE_MAX_ETHPORTS]++; } } @@ -1062,7 +1066,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) client_info = &internals->mode6.client_table[i]; if (client_info->in_use) { - /* Allocate new packet to send ARP update on current slave */ + /* Allocate new packet to send ARP update on current member */ upd_pkt = rte_pktmbuf_alloc(internals->mode6.mempool); if (upd_pkt == NULL) { RTE_BOND_LOG(ERR, @@ -1076,44 +1080,44 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; - slave_idx = bond_mode_alb_arp_upd(client_info, upd_pkt, + member_idx = bond_mode_alb_arp_upd(client_info, upd_pkt, internals); /* Add packet to update tx buffer */ - update_bufs[slave_idx][update_bufs_pkts[slave_idx]] = upd_pkt; - update_bufs_pkts[slave_idx]++; + update_bufs[member_idx][update_bufs_pkts[member_idx]] = upd_pkt; + update_bufs_pkts[member_idx]++; } } internals->mode6.ntt = 0; } - /* Send ARP packets on proper slaves */ + /* Send ARP packets on proper members */ for (i = 0; i < RTE_MAX_ETHPORTS; i++) { - if (slave_bufs_pkts[i] > 0) { + if (member_bufs_pkts[i] > 0) { num_send = rte_eth_tx_prepare(i, bd_tx_q->queue_id, - slave_bufs[i], slave_bufs_pkts[i]); + member_bufs[i], member_bufs_pkts[i]); num_send = rte_eth_tx_burst(i, bd_tx_q->queue_id, - slave_bufs[i], num_send); - for (j = 0; j < slave_bufs_pkts[i] - num_send; j++) { + member_bufs[i], num_send); + for (j = 0; j < member_bufs_pkts[i] - num_send; j++) { bufs[nb_pkts - 1 - num_not_send - j] = - slave_bufs[i][nb_pkts - 1 - j]; + member_bufs[i][nb_pkts - 1 - j]; } num_tx_total += num_send; - num_not_send += slave_bufs_pkts[i] - num_send; + num_not_send += member_bufs_pkts[i] - num_send; #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) /* Print TX stats including update packets */ - for (j = 0; j < slave_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], + for (j = 0; j < member_bufs_pkts[i]; j++) { + eth_h = rte_pktmbuf_mtod(member_bufs[i][j], struct rte_ether_hdr *); - mode6_debug("TX ARP:", eth_h, i, &burstnumberTX); + mode6_debug("TX ARP:", eth_h, i, &burst_number_TX); } #endif } } - /* Send update packets on proper slaves */ + /* Send update packets on proper members */ for (i = 0; i < RTE_MAX_ETHPORTS; i++) { if (update_bufs_pkts[i] > 0) { num_send = rte_eth_tx_prepare(i, bd_tx_q->queue_id, @@ -1127,21 +1131,21 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) for (j = 0; j < update_bufs_pkts[i]; j++) { eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct rte_ether_hdr *); - mode6_debug("TX ARPupd:", eth_h, i, &burstnumberTX); + mode6_debug("TX ARPupd:", eth_h, i, &burst_number_TX); } #endif } } /* Send non-ARP packets using tlb policy */ - if (slave_bufs_pkts[RTE_MAX_ETHPORTS] > 0) { + if (member_bufs_pkts[RTE_MAX_ETHPORTS] > 0) { num_send = bond_ethdev_tx_burst_tlb(queue, - slave_bufs[RTE_MAX_ETHPORTS], - slave_bufs_pkts[RTE_MAX_ETHPORTS]); + member_bufs[RTE_MAX_ETHPORTS], + member_bufs_pkts[RTE_MAX_ETHPORTS]); - for (j = 0; j < slave_bufs_pkts[RTE_MAX_ETHPORTS]; j++) { + for (j = 0; j < member_bufs_pkts[RTE_MAX_ETHPORTS]; j++) { bufs[nb_pkts - 1 - num_not_send - j] = - slave_bufs[RTE_MAX_ETHPORTS][nb_pkts - 1 - j]; + member_bufs[RTE_MAX_ETHPORTS][nb_pkts - 1 - j]; } num_tx_total += num_send; @@ -1152,59 +1156,59 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) static inline uint16_t tx_burst_balance(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs, - uint16_t *slave_port_ids, uint16_t slave_count) + uint16_t *member_port_ids, uint16_t member_count) { struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - /* Array to sort mbufs for transmission on each slave into */ - struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_bufs]; - /* Number of mbufs for transmission on each slave */ - uint16_t slave_nb_bufs[RTE_MAX_ETHPORTS] = { 0 }; - /* Mapping array generated by hash function to map mbufs to slaves */ - uint16_t bufs_slave_port_idxs[nb_bufs]; + /* Array to sort mbufs for transmission on each member into */ + struct rte_mbuf *member_bufs[RTE_MAX_ETHPORTS][nb_bufs]; + /* Number of mbufs for transmission on each member */ + uint16_t member_nb_bufs[RTE_MAX_ETHPORTS] = { 0 }; + /* Mapping array generated by hash function to map mbufs to members */ + uint16_t bufs_member_port_idxs[nb_bufs]; - uint16_t slave_tx_count; + uint16_t member_tx_count; uint16_t total_tx_count = 0, total_tx_fail_count = 0; uint16_t i; /* - * Populate slaves mbuf with the packets which are to be sent on it - * selecting output slave using hash based on xmit policy + * Populate members mbuf with the packets which are to be sent on it + * selecting output member using hash based on xmit policy */ - internals->burst_xmit_hash(bufs, nb_bufs, slave_count, - bufs_slave_port_idxs); + internals->burst_xmit_hash(bufs, nb_bufs, member_count, + bufs_member_port_idxs); for (i = 0; i < nb_bufs; i++) { - /* Populate slave mbuf arrays with mbufs for that slave. */ - uint16_t slave_idx = bufs_slave_port_idxs[i]; + /* Populate member mbuf arrays with mbufs for that member. */ + uint16_t member_idx = bufs_member_port_idxs[i]; - slave_bufs[slave_idx][slave_nb_bufs[slave_idx]++] = bufs[i]; + member_bufs[member_idx][member_nb_bufs[member_idx]++] = bufs[i]; } - /* Send packet burst on each slave device */ - for (i = 0; i < slave_count; i++) { - if (slave_nb_bufs[i] == 0) + /* Send packet burst on each member device */ + for (i = 0; i < member_count; i++) { + if (member_nb_bufs[i] == 0) continue; - slave_tx_count = rte_eth_tx_prepare(slave_port_ids[i], - bd_tx_q->queue_id, slave_bufs[i], - slave_nb_bufs[i]); - slave_tx_count = rte_eth_tx_burst(slave_port_ids[i], - bd_tx_q->queue_id, slave_bufs[i], - slave_tx_count); + member_tx_count = rte_eth_tx_prepare(member_port_ids[i], + bd_tx_q->queue_id, member_bufs[i], + member_nb_bufs[i]); + member_tx_count = rte_eth_tx_burst(member_port_ids[i], + bd_tx_q->queue_id, member_bufs[i], + member_tx_count); - total_tx_count += slave_tx_count; + total_tx_count += member_tx_count; /* If tx burst fails move packets to end of bufs */ - if (unlikely(slave_tx_count < slave_nb_bufs[i])) { - int slave_tx_fail_count = slave_nb_bufs[i] - - slave_tx_count; - total_tx_fail_count += slave_tx_fail_count; + if (unlikely(member_tx_count < member_nb_bufs[i])) { + int member_tx_fail_count = member_nb_bufs[i] - + member_tx_count; + total_tx_fail_count += member_tx_fail_count; memcpy(&bufs[nb_bufs - total_tx_fail_count], - &slave_bufs[i][slave_tx_count], - slave_tx_fail_count * sizeof(bufs[0])); + &member_bufs[i][member_tx_count], + member_tx_fail_count * sizeof(bufs[0])); } } @@ -1218,23 +1222,23 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs, struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - uint16_t slave_port_ids[RTE_MAX_ETHPORTS]; - uint16_t slave_count; + uint16_t member_port_ids[RTE_MAX_ETHPORTS]; + uint16_t member_count; if (unlikely(nb_bufs == 0)) return 0; - /* Copy slave list to protect against slave up/down changes during tx + /* Copy member list to protect against member up/down changes during tx * bursting */ - slave_count = internals->active_slave_count; - if (unlikely(slave_count < 1)) + member_count = internals->active_member_count; + if (unlikely(member_count < 1)) return 0; - memcpy(slave_port_ids, internals->active_slaves, - sizeof(slave_port_ids[0]) * slave_count); - return tx_burst_balance(queue, bufs, nb_bufs, slave_port_ids, - slave_count); + memcpy(member_port_ids, internals->active_members, + sizeof(member_port_ids[0]) * member_count); + return tx_burst_balance(queue, bufs, nb_bufs, member_port_ids, + member_count); } static inline uint16_t @@ -1244,31 +1248,31 @@ tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs, struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - uint16_t slave_port_ids[RTE_MAX_ETHPORTS]; - uint16_t slave_count; + uint16_t member_port_ids[RTE_MAX_ETHPORTS]; + uint16_t member_count; - uint16_t dist_slave_port_ids[RTE_MAX_ETHPORTS]; - uint16_t dist_slave_count; + uint16_t dist_member_port_ids[RTE_MAX_ETHPORTS]; + uint16_t dist_member_count; - uint16_t slave_tx_count; + uint16_t member_tx_count; uint16_t i; - /* Copy slave list to protect against slave up/down changes during tx + /* Copy member list to protect against member up/down changes during tx * bursting */ - slave_count = internals->active_slave_count; - if (unlikely(slave_count < 1)) + member_count = internals->active_member_count; + if (unlikely(member_count < 1)) return 0; - memcpy(slave_port_ids, internals->active_slaves, - sizeof(slave_port_ids[0]) * slave_count); + memcpy(member_port_ids, internals->active_members, + sizeof(member_port_ids[0]) * member_count); if (dedicated_txq) goto skip_tx_ring; /* Check for LACP control packets and send if available */ - for (i = 0; i < slave_count; i++) { - struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; + for (i = 0; i < member_count; i++) { + struct port *port = &bond_mode_8023ad_ports[member_port_ids[i]]; struct rte_mbuf *ctrl_pkt = NULL; if (likely(rte_ring_empty(port->tx_ring))) @@ -1276,15 +1280,15 @@ tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs, if (rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt) != -ENOENT) { - slave_tx_count = rte_eth_tx_prepare(slave_port_ids[i], + member_tx_count = rte_eth_tx_prepare(member_port_ids[i], bd_tx_q->queue_id, &ctrl_pkt, 1); - slave_tx_count = rte_eth_tx_burst(slave_port_ids[i], - bd_tx_q->queue_id, &ctrl_pkt, slave_tx_count); + member_tx_count = rte_eth_tx_burst(member_port_ids[i], + bd_tx_q->queue_id, &ctrl_pkt, member_tx_count); /* * re-enqueue LAG control plane packets to buffering * ring if transmission fails so the packet isn't lost. */ - if (slave_tx_count != 1) + if (member_tx_count != 1) rte_ring_enqueue(port->tx_ring, ctrl_pkt); } } @@ -1293,20 +1297,20 @@ tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs, if (unlikely(nb_bufs == 0)) return 0; - dist_slave_count = 0; - for (i = 0; i < slave_count; i++) { - struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; + dist_member_count = 0; + for (i = 0; i < member_count; i++) { + struct port *port = &bond_mode_8023ad_ports[member_port_ids[i]]; if (ACTOR_STATE(port, DISTRIBUTING)) - dist_slave_port_ids[dist_slave_count++] = - slave_port_ids[i]; + dist_member_port_ids[dist_member_count++] = + member_port_ids[i]; } - if (unlikely(dist_slave_count < 1)) + if (unlikely(dist_member_count < 1)) return 0; - return tx_burst_balance(queue, bufs, nb_bufs, dist_slave_port_ids, - dist_slave_count); + return tx_burst_balance(queue, bufs, nb_bufs, dist_member_port_ids, + dist_member_count); } static uint16_t @@ -1330,78 +1334,78 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs, struct bond_dev_private *internals; struct bond_tx_queue *bd_tx_q; - uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t members[RTE_MAX_ETHPORTS]; uint8_t tx_failed_flag = 0; - uint16_t num_of_slaves; + uint16_t num_of_members; uint16_t max_nb_of_tx_pkts = 0; - int slave_tx_total[RTE_MAX_ETHPORTS]; - int i, most_successful_tx_slave = -1; + int member_tx_total[RTE_MAX_ETHPORTS]; + int i, most_successful_tx_member = -1; bd_tx_q = (struct bond_tx_queue *)queue; internals = bd_tx_q->dev_private; - /* Copy slave list to protect against slave up/down changes during tx + /* Copy member list to protect against member up/down changes during tx * bursting */ - num_of_slaves = internals->active_slave_count; - memcpy(slaves, internals->active_slaves, - sizeof(internals->active_slaves[0]) * num_of_slaves); + num_of_members = internals->active_member_count; + memcpy(members, internals->active_members, + sizeof(internals->active_members[0]) * num_of_members); - if (num_of_slaves < 1) + if (num_of_members < 1) return 0; /* It is rare that bond different PMDs together, so just call tx-prepare once */ - nb_pkts = rte_eth_tx_prepare(slaves[0], bd_tx_q->queue_id, bufs, nb_pkts); + nb_pkts = rte_eth_tx_prepare(members[0], bd_tx_q->queue_id, bufs, nb_pkts); /* Increment reference count on mbufs */ for (i = 0; i < nb_pkts; i++) - rte_pktmbuf_refcnt_update(bufs[i], num_of_slaves - 1); + rte_pktmbuf_refcnt_update(bufs[i], num_of_members - 1); - /* Transmit burst on each active slave */ - for (i = 0; i < num_of_slaves; i++) { - slave_tx_total[i] = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, + /* Transmit burst on each active member */ + for (i = 0; i < num_of_members; i++) { + member_tx_total[i] = rte_eth_tx_burst(members[i], bd_tx_q->queue_id, bufs, nb_pkts); - if (unlikely(slave_tx_total[i] < nb_pkts)) + if (unlikely(member_tx_total[i] < nb_pkts)) tx_failed_flag = 1; - /* record the value and slave index for the slave which transmits the + /* record the value and member index for the member which transmits the * maximum number of packets */ - if (slave_tx_total[i] > max_nb_of_tx_pkts) { - max_nb_of_tx_pkts = slave_tx_total[i]; - most_successful_tx_slave = i; + if (member_tx_total[i] > max_nb_of_tx_pkts) { + max_nb_of_tx_pkts = member_tx_total[i]; + most_successful_tx_member = i; } } - /* if slaves fail to transmit packets from burst, the calling application + /* if members fail to transmit packets from burst, the calling application * is not expected to know about multiple references to packets so we must - * handle failures of all packets except those of the most successful slave + * handle failures of all packets except those of the most successful member */ if (unlikely(tx_failed_flag)) - for (i = 0; i < num_of_slaves; i++) - if (i != most_successful_tx_slave) - while (slave_tx_total[i] < nb_pkts) - rte_pktmbuf_free(bufs[slave_tx_total[i]++]); + for (i = 0; i < num_of_members; i++) + if (i != most_successful_tx_member) + while (member_tx_total[i] < nb_pkts) + rte_pktmbuf_free(bufs[member_tx_total[i]++]); return max_nb_of_tx_pkts; } static void -link_properties_set(struct rte_eth_dev *ethdev, struct rte_eth_link *slave_link) +link_properties_set(struct rte_eth_dev *ethdev, struct rte_eth_link *member_link) { struct bond_dev_private *bond_ctx = ethdev->data->dev_private; if (bond_ctx->mode == BONDING_MODE_8023AD) { /** * If in mode 4 then save the link properties of the first - * slave, all subsequent slaves must match these properties + * member, all subsequent members must match these properties */ - struct rte_eth_link *bond_link = &bond_ctx->mode4.slave_link; + struct rte_eth_link *bond_link = &bond_ctx->mode4.member_link; - bond_link->link_autoneg = slave_link->link_autoneg; - bond_link->link_duplex = slave_link->link_duplex; - bond_link->link_speed = slave_link->link_speed; + bond_link->link_autoneg = member_link->link_autoneg; + bond_link->link_duplex = member_link->link_duplex; + bond_link->link_speed = member_link->link_speed; } else { /** * In any other mode the link properties are set to default @@ -1414,16 +1418,16 @@ link_properties_set(struct rte_eth_dev *ethdev, struct rte_eth_link *slave_link) static int link_properties_valid(struct rte_eth_dev *ethdev, - struct rte_eth_link *slave_link) + struct rte_eth_link *member_link) { struct bond_dev_private *bond_ctx = ethdev->data->dev_private; if (bond_ctx->mode == BONDING_MODE_8023AD) { - struct rte_eth_link *bond_link = &bond_ctx->mode4.slave_link; + struct rte_eth_link *bond_link = &bond_ctx->mode4.member_link; - if (bond_link->link_duplex != slave_link->link_duplex || - bond_link->link_autoneg != slave_link->link_autoneg || - bond_link->link_speed != slave_link->link_speed) + if (bond_link->link_duplex != member_link->link_duplex || + bond_link->link_autoneg != member_link->link_autoneg || + bond_link->link_speed != member_link->link_speed) return -1; } @@ -1480,11 +1484,11 @@ mac_address_set(struct rte_eth_dev *eth_dev, static const struct rte_ether_addr null_mac_addr; /* - * Add additional MAC addresses to the slave + * Add additional MAC addresses to the member */ int -slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, - uint16_t slave_port_id) +member_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, + uint16_t member_port_id) { int i, ret; struct rte_ether_addr *mac_addr; @@ -1494,11 +1498,11 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; - ret = rte_eth_dev_mac_addr_add(slave_port_id, mac_addr, 0); + ret = rte_eth_dev_mac_addr_add(member_port_id, mac_addr, 0); if (ret < 0) { /* rollback */ for (i--; i > 0; i--) - rte_eth_dev_mac_addr_remove(slave_port_id, + rte_eth_dev_mac_addr_remove(member_port_id, &bonded_eth_dev->data->mac_addrs[i]); return ret; } @@ -1508,11 +1512,11 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, } /* - * Remove additional MAC addresses from the slave + * Remove additional MAC addresses from the member */ int -slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, - uint16_t slave_port_id) +member_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, + uint16_t member_port_id) { int i, rc, ret; struct rte_ether_addr *mac_addr; @@ -1523,7 +1527,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; - ret = rte_eth_dev_mac_addr_remove(slave_port_id, mac_addr); + ret = rte_eth_dev_mac_addr_remove(member_port_id, mac_addr); /* save only the first error */ if (ret < 0 && rc == 0) rc = ret; @@ -1533,26 +1537,26 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, } int -mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev) +mac_address_members_update(struct rte_eth_dev *bonded_eth_dev) { struct bond_dev_private *internals = bonded_eth_dev->data->dev_private; bool set; int i; - /* Update slave devices MAC addresses */ - if (internals->slave_count < 1) + /* Update member devices MAC addresses */ + if (internals->member_count < 1) return -1; switch (internals->mode) { case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: - for (i = 0; i < internals->slave_count; i++) { + for (i = 0; i < internals->member_count; i++) { if (rte_eth_dev_default_mac_addr_set( - internals->slaves[i].port_id, + internals->members[i].port_id, bonded_eth_dev->data->mac_addrs)) { RTE_BOND_LOG(ERR, "Failed to update port Id %d MAC address", - internals->slaves[i].port_id); + internals->members[i].port_id); return -1; } } @@ -1565,8 +1569,8 @@ mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev) case BONDING_MODE_ALB: default: set = true; - for (i = 0; i < internals->slave_count; i++) { - if (internals->slaves[i].port_id == + for (i = 0; i < internals->member_count; i++) { + if (internals->members[i].port_id == internals->current_primary_port) { if (rte_eth_dev_default_mac_addr_set( internals->current_primary_port, @@ -1577,10 +1581,10 @@ mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev) } } else { if (rte_eth_dev_default_mac_addr_set( - internals->slaves[i].port_id, - &internals->slaves[i].persisted_mac_addr)) { + internals->members[i].port_id, + &internals->members[i].persisted_mac_addr)) { RTE_BOND_LOG(ERR, "Failed to update port Id %d MAC address", - internals->slaves[i].port_id); + internals->members[i].port_id); } } } @@ -1655,55 +1659,55 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, uint8_t mode) static int -slave_configure_slow_queue(struct rte_eth_dev *bonded_eth_dev, - struct rte_eth_dev *slave_eth_dev) +member_configure_slow_queue(struct rte_eth_dev *bonded_eth_dev, + struct rte_eth_dev *member_eth_dev) { int errval = 0; struct bond_dev_private *internals = bonded_eth_dev->data->dev_private; - struct port *port = &bond_mode_8023ad_ports[slave_eth_dev->data->port_id]; + struct port *port = &bond_mode_8023ad_ports[member_eth_dev->data->port_id]; if (port->slow_pool == NULL) { char mem_name[256]; - int slave_id = slave_eth_dev->data->port_id; + int member_id = member_eth_dev->data->port_id; - snprintf(mem_name, RTE_DIM(mem_name), "slave_port%u_slow_pool", - slave_id); + snprintf(mem_name, RTE_DIM(mem_name), "member_port%u_slow_pool", + member_id); port->slow_pool = rte_pktmbuf_pool_create(mem_name, 8191, 250, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - slave_eth_dev->data->numa_node); + member_eth_dev->data->numa_node); /* Any memory allocation failure in initialization is critical because * resources can't be free, so reinitialization is impossible. */ if (port->slow_pool == NULL) { - rte_panic("Slave %u: Failed to create memory pool '%s': %s\n", - slave_id, mem_name, rte_strerror(rte_errno)); + rte_panic("Member %u: Failed to create memory pool '%s': %s\n", + member_id, mem_name, rte_strerror(rte_errno)); } } if (internals->mode4.dedicated_queues.enabled == 1) { /* Configure slow Rx queue */ - errval = rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, + errval = rte_eth_rx_queue_setup(member_eth_dev->data->port_id, internals->mode4.dedicated_queues.rx_qid, 128, - rte_eth_dev_socket_id(slave_eth_dev->data->port_id), + rte_eth_dev_socket_id(member_eth_dev->data->port_id), NULL, port->slow_pool); if (errval != 0) { RTE_BOND_LOG(ERR, "rte_eth_rx_queue_setup: port=%d queue_id %d, err (%d)", - slave_eth_dev->data->port_id, + member_eth_dev->data->port_id, internals->mode4.dedicated_queues.rx_qid, errval); return errval; } - errval = rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, + errval = rte_eth_tx_queue_setup(member_eth_dev->data->port_id, internals->mode4.dedicated_queues.tx_qid, 512, - rte_eth_dev_socket_id(slave_eth_dev->data->port_id), + rte_eth_dev_socket_id(member_eth_dev->data->port_id), NULL); if (errval != 0) { RTE_BOND_LOG(ERR, "rte_eth_tx_queue_setup: port=%d queue_id %d, err (%d)", - slave_eth_dev->data->port_id, + member_eth_dev->data->port_id, internals->mode4.dedicated_queues.tx_qid, errval); return errval; @@ -1713,8 +1717,8 @@ slave_configure_slow_queue(struct rte_eth_dev *bonded_eth_dev, } int -slave_configure(struct rte_eth_dev *bonded_eth_dev, - struct rte_eth_dev *slave_eth_dev) +member_configure(struct rte_eth_dev *bonded_eth_dev, + struct rte_eth_dev *member_eth_dev) { uint16_t nb_rx_queues; uint16_t nb_tx_queues; @@ -1723,45 +1727,45 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, struct bond_dev_private *internals = bonded_eth_dev->data->dev_private; - /* Stop slave */ - errval = rte_eth_dev_stop(slave_eth_dev->data->port_id); + /* Stop member */ + errval = rte_eth_dev_stop(member_eth_dev->data->port_id); if (errval != 0) RTE_BOND_LOG(ERR, "rte_eth_dev_stop: port %u, err (%d)", - slave_eth_dev->data->port_id, errval); + member_eth_dev->data->port_id, errval); - /* Enable interrupts on slave device if supported */ - if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) - slave_eth_dev->data->dev_conf.intr_conf.lsc = 1; + /* Enable interrupts on member device if supported */ + if (member_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + member_eth_dev->data->dev_conf.intr_conf.lsc = 1; - /* If RSS is enabled for bonding, try to enable it for slaves */ + /* If RSS is enabled for bonding, try to enable it for members */ if (bonded_eth_dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { /* rss_key won't be empty if RSS is configured in bonded dev */ - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = + member_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = internals->rss_key_len; - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = + member_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = internals->rss_key; - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = + member_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf; - slave_eth_dev->data->dev_conf.rxmode.mq_mode = + member_eth_dev->data->dev_conf.rxmode.mq_mode = bonded_eth_dev->data->dev_conf.rxmode.mq_mode; } else { - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = 0; - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0; - slave_eth_dev->data->dev_conf.rxmode.mq_mode = + member_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = 0; + member_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; + member_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0; + member_eth_dev->data->dev_conf.rxmode.mq_mode = bonded_eth_dev->data->dev_conf.rxmode.mq_mode; } - slave_eth_dev->data->dev_conf.rxmode.mtu = + member_eth_dev->data->dev_conf.rxmode.mtu = bonded_eth_dev->data->dev_conf.rxmode.mtu; - slave_eth_dev->data->dev_conf.link_speeds = + member_eth_dev->data->dev_conf.link_speeds = bonded_eth_dev->data->dev_conf.link_speeds; - slave_eth_dev->data->dev_conf.txmode.offloads = + member_eth_dev->data->dev_conf.txmode.offloads = bonded_eth_dev->data->dev_conf.txmode.offloads; - slave_eth_dev->data->dev_conf.rxmode.offloads = + member_eth_dev->data->dev_conf.rxmode.offloads = bonded_eth_dev->data->dev_conf.rxmode.offloads; nb_rx_queues = bonded_eth_dev->data->nb_rx_queues; @@ -1775,28 +1779,28 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, } /* Configure device */ - errval = rte_eth_dev_configure(slave_eth_dev->data->port_id, + errval = rte_eth_dev_configure(member_eth_dev->data->port_id, nb_rx_queues, nb_tx_queues, - &(slave_eth_dev->data->dev_conf)); + &member_eth_dev->data->dev_conf); if (errval != 0) { - RTE_BOND_LOG(ERR, "Cannot configure slave device: port %u, err (%d)", - slave_eth_dev->data->port_id, errval); + RTE_BOND_LOG(ERR, "Cannot configure member device: port %u, err (%d)", + member_eth_dev->data->port_id, errval); return errval; } - errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id, + errval = rte_eth_dev_set_mtu(member_eth_dev->data->port_id, bonded_eth_dev->data->mtu); if (errval != 0 && errval != -ENOTSUP) { RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)", - slave_eth_dev->data->port_id, errval); + member_eth_dev->data->port_id, errval); return errval; } return 0; } int -slave_start(struct rte_eth_dev *bonded_eth_dev, - struct rte_eth_dev *slave_eth_dev) +member_start(struct rte_eth_dev *bonded_eth_dev, + struct rte_eth_dev *member_eth_dev) { int errval = 0; struct bond_rx_queue *bd_rx_q; @@ -1804,19 +1808,20 @@ slave_start(struct rte_eth_dev *bonded_eth_dev, uint16_t q_id; struct rte_flow_error flow_error; struct bond_dev_private *internals = bonded_eth_dev->data->dev_private; + uint16_t member_port_id = member_eth_dev->data->port_id; /* Setup Rx Queues */ for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) { bd_rx_q = (struct bond_rx_queue *)bonded_eth_dev->data->rx_queues[q_id]; - errval = rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, q_id, + errval = rte_eth_rx_queue_setup(member_port_id, q_id, bd_rx_q->nb_rx_desc, - rte_eth_dev_socket_id(slave_eth_dev->data->port_id), + rte_eth_dev_socket_id(member_port_id), &(bd_rx_q->rx_conf), bd_rx_q->mb_pool); if (errval != 0) { RTE_BOND_LOG(ERR, "rte_eth_rx_queue_setup: port=%d queue_id %d, err (%d)", - slave_eth_dev->data->port_id, q_id, errval); + member_port_id, q_id, errval); return errval; } } @@ -1825,58 +1830,58 @@ slave_start(struct rte_eth_dev *bonded_eth_dev, for (q_id = 0; q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) { bd_tx_q = (struct bond_tx_queue *)bonded_eth_dev->data->tx_queues[q_id]; - errval = rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, q_id, + errval = rte_eth_tx_queue_setup(member_port_id, q_id, bd_tx_q->nb_tx_desc, - rte_eth_dev_socket_id(slave_eth_dev->data->port_id), + rte_eth_dev_socket_id(member_port_id), &bd_tx_q->tx_conf); if (errval != 0) { RTE_BOND_LOG(ERR, "rte_eth_tx_queue_setup: port=%d queue_id %d, err (%d)", - slave_eth_dev->data->port_id, q_id, errval); + member_port_id, q_id, errval); return errval; } } if (internals->mode == BONDING_MODE_8023AD && internals->mode4.dedicated_queues.enabled == 1) { - if (slave_configure_slow_queue(bonded_eth_dev, slave_eth_dev) + if (member_configure_slow_queue(bonded_eth_dev, member_eth_dev) != 0) return errval; errval = bond_ethdev_8023ad_flow_verify(bonded_eth_dev, - slave_eth_dev->data->port_id); + member_port_id); if (errval != 0) { RTE_BOND_LOG(ERR, "bond_ethdev_8023ad_flow_verify: port=%d, err (%d)", - slave_eth_dev->data->port_id, errval); + member_port_id, errval); return errval; } - if (internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id] != NULL) { - errval = rte_flow_destroy(slave_eth_dev->data->port_id, - internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id], + if (internals->mode4.dedicated_queues.flow[member_port_id] != NULL) { + errval = rte_flow_destroy(member_port_id, + internals->mode4.dedicated_queues.flow[member_port_id], &flow_error); RTE_BOND_LOG(ERR, "bond_ethdev_8023ad_flow_destroy: port=%d, err (%d)", - slave_eth_dev->data->port_id, errval); + member_port_id, errval); } } /* Start device */ - errval = rte_eth_dev_start(slave_eth_dev->data->port_id); + errval = rte_eth_dev_start(member_port_id); if (errval != 0) { RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)", - slave_eth_dev->data->port_id, errval); + member_port_id, errval); return -1; } if (internals->mode == BONDING_MODE_8023AD && internals->mode4.dedicated_queues.enabled == 1) { errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev, - slave_eth_dev->data->port_id); + member_port_id); if (errval != 0) { RTE_BOND_LOG(ERR, "bond_ethdev_8023ad_flow_set: port=%d, err (%d)", - slave_eth_dev->data->port_id, errval); + member_port_id, errval); return errval; } } @@ -1888,27 +1893,27 @@ slave_start(struct rte_eth_dev *bonded_eth_dev, internals = bonded_eth_dev->data->dev_private; - for (i = 0; i < internals->slave_count; i++) { - if (internals->slaves[i].port_id == slave_eth_dev->data->port_id) { + for (i = 0; i < internals->member_count; i++) { + if (internals->members[i].port_id == member_port_id) { errval = rte_eth_dev_rss_reta_update( - slave_eth_dev->data->port_id, + member_port_id, &internals->reta_conf[0], - internals->slaves[i].reta_size); + internals->members[i].reta_size); if (errval != 0) { RTE_BOND_LOG(WARNING, - "rte_eth_dev_rss_reta_update on slave port %d fails (err %d)." + "rte_eth_dev_rss_reta_update on member port %d fails (err %d)." " RSS Configuration for bonding may be inconsistent.", - slave_eth_dev->data->port_id, errval); + member_port_id, errval); } break; } } } - /* If lsc interrupt is set, check initial slave's link status */ - if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { - slave_eth_dev->dev_ops->link_update(slave_eth_dev, 0); - bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id, + /* If lsc interrupt is set, check initial member's link status */ + if (member_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { + member_eth_dev->dev_ops->link_update(member_eth_dev, 0); + bond_ethdev_lsc_event_callback(member_port_id, RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id, NULL); } @@ -1917,75 +1922,74 @@ slave_start(struct rte_eth_dev *bonded_eth_dev, } void -slave_remove(struct bond_dev_private *internals, - struct rte_eth_dev *slave_eth_dev) +member_remove(struct bond_dev_private *internals, + struct rte_eth_dev *member_eth_dev) { uint16_t i; - for (i = 0; i < internals->slave_count; i++) - if (internals->slaves[i].port_id == - slave_eth_dev->data->port_id) + for (i = 0; i < internals->member_count; i++) + if (internals->members[i].port_id == + member_eth_dev->data->port_id) break; - if (i < (internals->slave_count - 1)) { + if (i < (internals->member_count - 1)) { struct rte_flow *flow; - memmove(&internals->slaves[i], &internals->slaves[i + 1], - sizeof(internals->slaves[0]) * - (internals->slave_count - i - 1)); + memmove(&internals->members[i], &internals->members[i + 1], + sizeof(internals->members[0]) * + (internals->member_count - i - 1)); TAILQ_FOREACH(flow, &internals->flow_list, next) { memmove(&flow->flows[i], &flow->flows[i + 1], sizeof(flow->flows[0]) * - (internals->slave_count - i - 1)); - flow->flows[internals->slave_count - 1] = NULL; + (internals->member_count - i - 1)); + flow->flows[internals->member_count - 1] = NULL; } } - internals->slave_count--; + internals->member_count--; - /* force reconfiguration of slave interfaces */ - rte_eth_dev_internal_reset(slave_eth_dev); + /* force reconfiguration of member interfaces */ + rte_eth_dev_internal_reset(member_eth_dev); } static void -bond_ethdev_slave_link_status_change_monitor(void *cb_arg); +bond_ethdev_member_link_status_change_monitor(void *cb_arg); void -slave_add(struct bond_dev_private *internals, - struct rte_eth_dev *slave_eth_dev) +member_add(struct bond_dev_private *internals, + struct rte_eth_dev *member_eth_dev) { - struct bond_slave_details *slave_details = - &internals->slaves[internals->slave_count]; + struct bond_member_details *member_details = + &internals->members[internals->member_count]; - slave_details->port_id = slave_eth_dev->data->port_id; - slave_details->last_link_status = 0; + member_details->port_id = member_eth_dev->data->port_id; + member_details->last_link_status = 0; - /* Mark slave devices that don't support interrupts so we can + /* Mark member devices that don't support interrupts so we can * compensate when we start the bond */ - if (!(slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) { - slave_details->link_status_poll_enabled = 1; - } + if (!(member_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) + member_details->link_status_poll_enabled = 1; - slave_details->link_status_wait_to_complete = 0; + member_details->link_status_wait_to_complete = 0; /* clean tlb_last_obytes when adding port for bonding device */ - memcpy(&(slave_details->persisted_mac_addr), slave_eth_dev->data->mac_addrs, + memcpy(&member_details->persisted_mac_addr, member_eth_dev->data->mac_addrs, sizeof(struct rte_ether_addr)); } void bond_ethdev_primary_set(struct bond_dev_private *internals, - uint16_t slave_port_id) + uint16_t member_port_id) { int i; - if (internals->active_slave_count < 1) - internals->current_primary_port = slave_port_id; + if (internals->active_member_count < 1) + internals->current_primary_port = member_port_id; else - /* Search bonded device slave ports for new proposed primary port */ - for (i = 0; i < internals->active_slave_count; i++) { - if (internals->active_slaves[i] == slave_port_id) - internals->current_primary_port = slave_port_id; + /* Search bonded device member ports for new proposed primary port */ + for (i = 0; i < internals->active_member_count; i++) { + if (internals->active_members[i] == member_port_id) + internals->current_primary_port = member_port_id; } } @@ -1998,9 +2002,9 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) struct bond_dev_private *internals; int i; - /* slave eth dev will be started by bonded device */ + /* member eth dev will be started by bonded device */ if (check_for_bonded_ethdev(eth_dev)) { - RTE_BOND_LOG(ERR, "User tried to explicitly start a slave eth_dev (%d)", + RTE_BOND_LOG(ERR, "User tried to explicitly start a member eth_dev (%d)", eth_dev->data->port_id); return -1; } @@ -2010,17 +2014,17 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) internals = eth_dev->data->dev_private; - if (internals->slave_count == 0) { - RTE_BOND_LOG(ERR, "Cannot start port since there are no slave devices"); + if (internals->member_count == 0) { + RTE_BOND_LOG(ERR, "Cannot start port since there are no member devices"); goto out_err; } if (internals->user_defined_mac == 0) { struct rte_ether_addr *new_mac_addr = NULL; - for (i = 0; i < internals->slave_count; i++) - if (internals->slaves[i].port_id == internals->primary_port) - new_mac_addr = &internals->slaves[i].persisted_mac_addr; + for (i = 0; i < internals->member_count; i++) + if (internals->members[i].port_id == internals->primary_port) + new_mac_addr = &internals->members[i].persisted_mac_addr; if (new_mac_addr == NULL) goto out_err; @@ -2042,28 +2046,28 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) } - /* Reconfigure each slave device if starting bonded device */ - for (i = 0; i < internals->slave_count; i++) { - struct rte_eth_dev *slave_ethdev = - &(rte_eth_devices[internals->slaves[i].port_id]); - if (slave_configure(eth_dev, slave_ethdev) != 0) { + /* Reconfigure each member device if starting bonded device */ + for (i = 0; i < internals->member_count; i++) { + struct rte_eth_dev *member_ethdev = + &(rte_eth_devices[internals->members[i].port_id]); + if (member_configure(eth_dev, member_ethdev) != 0) { RTE_BOND_LOG(ERR, - "bonded port (%d) failed to reconfigure slave device (%d)", + "bonded port (%d) failed to reconfigure member device (%d)", eth_dev->data->port_id, - internals->slaves[i].port_id); + internals->members[i].port_id); goto out_err; } - if (slave_start(eth_dev, slave_ethdev) != 0) { + if (member_start(eth_dev, member_ethdev) != 0) { RTE_BOND_LOG(ERR, - "bonded port (%d) failed to start slave device (%d)", + "bonded port (%d) failed to start member device (%d)", eth_dev->data->port_id, - internals->slaves[i].port_id); + internals->members[i].port_id); goto out_err; } - /* We will need to poll for link status if any slave doesn't + /* We will need to poll for link status if any member doesn't * support interrupts */ - if (internals->slaves[i].link_status_poll_enabled) + if (internals->members[i].link_status_poll_enabled) internals->link_status_polling_enabled = 1; } @@ -2071,12 +2075,12 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) if (internals->link_status_polling_enabled) { rte_eal_alarm_set( internals->link_status_polling_interval_ms * 1000, - bond_ethdev_slave_link_status_change_monitor, + bond_ethdev_member_link_status_change_monitor, (void *)&rte_eth_devices[internals->port_id]); } - /* Update all slave devices MACs*/ - if (mac_address_slaves_update(eth_dev) != 0) + /* Update all member devices MACs*/ + if (mac_address_members_update(eth_dev) != 0) goto out_err; if (internals->user_defined_primary_port) @@ -2132,8 +2136,8 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) bond_mode_8023ad_stop(eth_dev); /* Discard all messages to/from mode 4 state machines */ - for (i = 0; i < internals->active_slave_count; i++) { - port = &bond_mode_8023ad_ports[internals->active_slaves[i]]; + for (i = 0; i < internals->active_member_count; i++) { + port = &bond_mode_8023ad_ports[internals->active_members[i]]; RTE_ASSERT(port->rx_ring != NULL); while (rte_ring_dequeue(port->rx_ring, &pkt) != -ENOENT) @@ -2148,30 +2152,30 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) if (internals->mode == BONDING_MODE_TLB || internals->mode == BONDING_MODE_ALB) { bond_tlb_disable(internals); - for (i = 0; i < internals->active_slave_count; i++) - tlb_last_obytets[internals->active_slaves[i]] = 0; + for (i = 0; i < internals->active_member_count; i++) + tlb_last_obytets[internals->active_members[i]] = 0; } eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; eth_dev->data->dev_started = 0; internals->link_status_polling_enabled = 0; - for (i = 0; i < internals->slave_count; i++) { - uint16_t slave_id = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) { + uint16_t member_id = internals->members[i].port_id; - internals->slaves[i].last_link_status = 0; - ret = rte_eth_dev_stop(slave_id); + internals->members[i].last_link_status = 0; + ret = rte_eth_dev_stop(member_id); if (ret != 0) { RTE_BOND_LOG(ERR, "Failed to stop device on port %u", - slave_id); + member_id); return ret; } - /* active slaves need to be deactivated. */ - if (find_slave_by_id(internals->active_slaves, - internals->active_slave_count, slave_id) != - internals->active_slave_count) - deactivate_slave(eth_dev, slave_id); + /* active members need to be deactivated. */ + if (find_member_by_id(internals->active_members, + internals->active_member_count, member_id) != + internals->active_member_count) + deactivate_member(eth_dev, member_id); } return 0; @@ -2188,8 +2192,8 @@ bond_ethdev_cfg_cleanup(struct rte_eth_dev *dev, bool remove) /* Flush flows in all back-end devices before removing them */ bond_flow_ops.flush(dev, &ferror); - while (internals->slave_count != skipped) { - uint16_t port_id = internals->slaves[skipped].port_id; + while (internals->member_count != skipped) { + uint16_t port_id = internals->members[skipped].port_id; int ret; ret = rte_eth_dev_stop(port_id); @@ -2203,7 +2207,7 @@ bond_ethdev_cfg_cleanup(struct rte_eth_dev *dev, bool remove) continue; } - if (rte_eth_bond_slave_remove(bond_port_id, port_id) != 0) { + if (rte_eth_bond_member_remove(bond_port_id, port_id) != 0) { RTE_BOND_LOG(ERR, "Failed to remove port %d from bonded device %s", port_id, dev->device->name); @@ -2246,7 +2250,7 @@ static int bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct bond_dev_private *internals = dev->data->dev_private; - struct bond_slave_details slave; + struct bond_member_details member; int ret; uint16_t max_nb_rx_queues = UINT16_MAX; @@ -2259,31 +2263,31 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) RTE_ETHER_MAX_JUMBO_FRAME_LEN; /* Max number of tx/rx queues that the bonded device can support is the - * minimum values of the bonded slaves, as all slaves must be capable + * minimum values of the bonded members, as all members must be capable * of supporting the same number of tx/rx queues. */ - if (internals->slave_count > 0) { - struct rte_eth_dev_info slave_info; + if (internals->member_count > 0) { + struct rte_eth_dev_info member_info; uint16_t idx; - for (idx = 0; idx < internals->slave_count; idx++) { - slave = internals->slaves[idx]; - ret = rte_eth_dev_info_get(slave.port_id, &slave_info); + for (idx = 0; idx < internals->member_count; idx++) { + member = internals->members[idx]; + ret = rte_eth_dev_info_get(member.port_id, &member_info); if (ret != 0) { RTE_BOND_LOG(ERR, "%s: Error during getting device (port %u) info: %s\n", __func__, - slave.port_id, + member.port_id, strerror(-ret)); return ret; } - if (slave_info.max_rx_queues < max_nb_rx_queues) - max_nb_rx_queues = slave_info.max_rx_queues; + if (member_info.max_rx_queues < max_nb_rx_queues) + max_nb_rx_queues = member_info.max_rx_queues; - if (slave_info.max_tx_queues < max_nb_tx_queues) - max_nb_tx_queues = slave_info.max_tx_queues; + if (member_info.max_tx_queues < max_nb_tx_queues) + max_nb_tx_queues = member_info.max_tx_queues; } } @@ -2332,7 +2336,7 @@ bond_ethdev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) uint16_t i; struct bond_dev_private *internals = dev->data->dev_private; - /* don't do this while a slave is being added */ + /* don't do this while a member is being added */ rte_spinlock_lock(&internals->lock); if (on) @@ -2340,13 +2344,13 @@ bond_ethdev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) else rte_bitmap_clear(internals->vlan_filter_bmp, vlan_id); - for (i = 0; i < internals->slave_count; i++) { - uint16_t port_id = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) { + uint16_t port_id = internals->members[i].port_id; res = rte_eth_dev_vlan_filter(port_id, vlan_id, on); if (res == ENOTSUP) RTE_BOND_LOG(WARNING, - "Setting VLAN filter on slave port %u not supported.", + "Setting VLAN filter on member port %u not supported.", port_id); } @@ -2424,14 +2428,14 @@ bond_ethdev_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_id) } static void -bond_ethdev_slave_link_status_change_monitor(void *cb_arg) +bond_ethdev_member_link_status_change_monitor(void *cb_arg) { - struct rte_eth_dev *bonded_ethdev, *slave_ethdev; + struct rte_eth_dev *bonded_ethdev, *member_ethdev; struct bond_dev_private *internals; - /* Default value for polling slave found is true as we don't want to + /* Default value for polling member found is true as we don't want to * disable the polling thread if we cannot get the lock */ - int i, polling_slave_found = 1; + int i, polling_member_found = 1; if (cb_arg == NULL) return; @@ -2443,28 +2447,28 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg) !internals->link_status_polling_enabled) return; - /* If device is currently being configured then don't check slaves link + /* If device is currently being configured then don't check members link * status, wait until next period */ if (rte_spinlock_trylock(&internals->lock)) { - if (internals->slave_count > 0) - polling_slave_found = 0; + if (internals->member_count > 0) + polling_member_found = 0; - for (i = 0; i < internals->slave_count; i++) { - if (!internals->slaves[i].link_status_poll_enabled) + for (i = 0; i < internals->member_count; i++) { + if (!internals->members[i].link_status_poll_enabled) continue; - slave_ethdev = &rte_eth_devices[internals->slaves[i].port_id]; - polling_slave_found = 1; + member_ethdev = &rte_eth_devices[internals->members[i].port_id]; + polling_member_found = 1; - /* Update slave link status */ - (*slave_ethdev->dev_ops->link_update)(slave_ethdev, - internals->slaves[i].link_status_wait_to_complete); + /* Update member link status */ + (*member_ethdev->dev_ops->link_update)(member_ethdev, + internals->members[i].link_status_wait_to_complete); /* if link status has changed since last checked then call lsc * event callback */ - if (slave_ethdev->data->dev_link.link_status != - internals->slaves[i].last_link_status) { - bond_ethdev_lsc_event_callback(internals->slaves[i].port_id, + if (member_ethdev->data->dev_link.link_status != + internals->members[i].last_link_status) { + bond_ethdev_lsc_event_callback(internals->members[i].port_id, RTE_ETH_EVENT_INTR_LSC, &bonded_ethdev->data->port_id, NULL); @@ -2473,10 +2477,10 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg) rte_spinlock_unlock(&internals->lock); } - if (polling_slave_found) - /* Set alarm to continue monitoring link status of slave ethdev's */ + if (polling_member_found) + /* Set alarm to continue monitoring link status of member ethdev's */ rte_eal_alarm_set(internals->link_status_polling_interval_ms * 1000, - bond_ethdev_slave_link_status_change_monitor, cb_arg); + bond_ethdev_member_link_status_change_monitor, cb_arg); } static int @@ -2485,7 +2489,7 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) int (*link_update)(uint16_t port_id, struct rte_eth_link *eth_link); struct bond_dev_private *bond_ctx; - struct rte_eth_link slave_link; + struct rte_eth_link member_link; bool one_link_update_succeeded; uint32_t idx; @@ -2496,7 +2500,7 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) ethdev->data->dev_link.link_speed = RTE_ETH_SPEED_NUM_NONE; if (ethdev->data->dev_started == 0 || - bond_ctx->active_slave_count == 0) { + bond_ctx->active_member_count == 0) { ethdev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; return 0; } @@ -2512,51 +2516,51 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) case BONDING_MODE_BROADCAST: /** * Setting link speed to UINT32_MAX to ensure we pick up the - * value of the first active slave + * value of the first active member */ ethdev->data->dev_link.link_speed = UINT32_MAX; /** - * link speed is minimum value of all the slaves link speed as - * packet loss will occur on this slave if transmission at rates + * link speed is minimum value of all the members link speed as + * packet loss will occur on this member if transmission at rates * greater than this are attempted */ - for (idx = 0; idx < bond_ctx->active_slave_count; idx++) { - ret = link_update(bond_ctx->active_slaves[idx], - &slave_link); + for (idx = 0; idx < bond_ctx->active_member_count; idx++) { + ret = link_update(bond_ctx->active_members[idx], + &member_link); if (ret < 0) { ethdev->data->dev_link.link_speed = RTE_ETH_SPEED_NUM_NONE; RTE_BOND_LOG(ERR, - "Slave (port %u) link get failed: %s", - bond_ctx->active_slaves[idx], + "Member (port %u) link get failed: %s", + bond_ctx->active_members[idx], rte_strerror(-ret)); return 0; } - if (slave_link.link_speed < + if (member_link.link_speed < ethdev->data->dev_link.link_speed) ethdev->data->dev_link.link_speed = - slave_link.link_speed; + member_link.link_speed; } break; case BONDING_MODE_ACTIVE_BACKUP: - /* Current primary slave */ - ret = link_update(bond_ctx->current_primary_port, &slave_link); + /* Current primary member */ + ret = link_update(bond_ctx->current_primary_port, &member_link); if (ret < 0) { - RTE_BOND_LOG(ERR, "Slave (port %u) link get failed: %s", + RTE_BOND_LOG(ERR, "Member (port %u) link get failed: %s", bond_ctx->current_primary_port, rte_strerror(-ret)); return 0; } - ethdev->data->dev_link.link_speed = slave_link.link_speed; + ethdev->data->dev_link.link_speed = member_link.link_speed; break; case BONDING_MODE_8023AD: ethdev->data->dev_link.link_autoneg = - bond_ctx->mode4.slave_link.link_autoneg; + bond_ctx->mode4.member_link.link_autoneg; ethdev->data->dev_link.link_duplex = - bond_ctx->mode4.slave_link.link_duplex; + bond_ctx->mode4.member_link.link_duplex; /* fall through */ /* to update link speed */ case BONDING_MODE_ROUND_ROBIN: @@ -2566,29 +2570,29 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) default: /** * In theses mode the maximum theoretical link speed is the sum - * of all the slaves + * of all the members */ ethdev->data->dev_link.link_speed = RTE_ETH_SPEED_NUM_NONE; one_link_update_succeeded = false; - for (idx = 0; idx < bond_ctx->active_slave_count; idx++) { - ret = link_update(bond_ctx->active_slaves[idx], - &slave_link); + for (idx = 0; idx < bond_ctx->active_member_count; idx++) { + ret = link_update(bond_ctx->active_members[idx], + &member_link); if (ret < 0) { RTE_BOND_LOG(ERR, - "Slave (port %u) link get failed: %s", - bond_ctx->active_slaves[idx], + "Member (port %u) link get failed: %s", + bond_ctx->active_members[idx], rte_strerror(-ret)); continue; } one_link_update_succeeded = true; ethdev->data->dev_link.link_speed += - slave_link.link_speed; + member_link.link_speed; } if (!one_link_update_succeeded) { - RTE_BOND_LOG(ERR, "All slaves link get failed"); + RTE_BOND_LOG(ERR, "All members link get failed"); return 0; } } @@ -2602,27 +2606,27 @@ static int bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { struct bond_dev_private *internals = dev->data->dev_private; - struct rte_eth_stats slave_stats; + struct rte_eth_stats member_stats; int i, j; - for (i = 0; i < internals->slave_count; i++) { - rte_eth_stats_get(internals->slaves[i].port_id, &slave_stats); + for (i = 0; i < internals->member_count; i++) { + rte_eth_stats_get(internals->members[i].port_id, &member_stats); - stats->ipackets += slave_stats.ipackets; - stats->opackets += slave_stats.opackets; - stats->ibytes += slave_stats.ibytes; - stats->obytes += slave_stats.obytes; - stats->imissed += slave_stats.imissed; - stats->ierrors += slave_stats.ierrors; - stats->oerrors += slave_stats.oerrors; - stats->rx_nombuf += slave_stats.rx_nombuf; + stats->ipackets += member_stats.ipackets; + stats->opackets += member_stats.opackets; + stats->ibytes += member_stats.ibytes; + stats->obytes += member_stats.obytes; + stats->imissed += member_stats.imissed; + stats->ierrors += member_stats.ierrors; + stats->oerrors += member_stats.oerrors; + stats->rx_nombuf += member_stats.rx_nombuf; for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) { - stats->q_ipackets[j] += slave_stats.q_ipackets[j]; - stats->q_opackets[j] += slave_stats.q_opackets[j]; - stats->q_ibytes[j] += slave_stats.q_ibytes[j]; - stats->q_obytes[j] += slave_stats.q_obytes[j]; - stats->q_errors[j] += slave_stats.q_errors[j]; + stats->q_ipackets[j] += member_stats.q_ipackets[j]; + stats->q_opackets[j] += member_stats.q_opackets[j]; + stats->q_ibytes[j] += member_stats.q_ibytes[j]; + stats->q_obytes[j] += member_stats.q_obytes[j]; + stats->q_errors[j] += member_stats.q_errors[j]; } } @@ -2638,8 +2642,8 @@ bond_ethdev_stats_reset(struct rte_eth_dev *dev) int err; int ret; - for (i = 0, err = 0; i < internals->slave_count; i++) { - ret = rte_eth_stats_reset(internals->slaves[i].port_id); + for (i = 0, err = 0; i < internals->member_count; i++) { + ret = rte_eth_stats_reset(internals->members[i].port_id); if (ret != 0) err = ret; } @@ -2656,15 +2660,15 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev) uint16_t port_id; switch (internals->mode) { - /* Promiscuous mode is propagated to all slaves */ + /* Promiscuous mode is propagated to all members */ case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: case BONDING_MODE_8023AD: { - unsigned int slave_ok = 0; + unsigned int member_ok = 0; - for (i = 0; i < internals->slave_count; i++) { - port_id = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) { + port_id = internals->members[i].port_id; ret = rte_eth_promiscuous_enable(port_id); if (ret != 0) @@ -2672,23 +2676,23 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev) "Failed to enable promiscuous mode for port %u: %s", port_id, rte_strerror(-ret)); else - slave_ok++; + member_ok++; } /* * Report success if operation is successful on at least - * on one slave. Otherwise return last error code. + * on one member. Otherwise return last error code. */ - if (slave_ok > 0) + if (member_ok > 0) ret = 0; break; } - /* Promiscuous mode is propagated only to primary slave */ + /* Promiscuous mode is propagated only to primary member */ case BONDING_MODE_ACTIVE_BACKUP: case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: /* Do not touch promisc when there cannot be primary ports */ - if (internals->slave_count == 0) + if (internals->member_count == 0) break; port_id = internals->current_primary_port; ret = rte_eth_promiscuous_enable(port_id); @@ -2710,20 +2714,20 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev) uint16_t port_id; switch (internals->mode) { - /* Promiscuous mode is propagated to all slaves */ + /* Promiscuous mode is propagated to all members */ case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: case BONDING_MODE_8023AD: { - unsigned int slave_ok = 0; + unsigned int member_ok = 0; - for (i = 0; i < internals->slave_count; i++) { - port_id = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) { + port_id = internals->members[i].port_id; if (internals->mode == BONDING_MODE_8023AD && bond_mode_8023ad_ports[port_id].forced_rx_flags == BOND_8023AD_FORCED_PROMISC) { - slave_ok++; + member_ok++; continue; } ret = rte_eth_promiscuous_disable(port_id); @@ -2732,23 +2736,23 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev) "Failed to disable promiscuous mode for port %u: %s", port_id, rte_strerror(-ret)); else - slave_ok++; + member_ok++; } /* * Report success if operation is successful on at least - * on one slave. Otherwise return last error code. + * on one member. Otherwise return last error code. */ - if (slave_ok > 0) + if (member_ok > 0) ret = 0; break; } - /* Promiscuous mode is propagated only to primary slave */ + /* Promiscuous mode is propagated only to primary member */ case BONDING_MODE_ACTIVE_BACKUP: case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: /* Do not touch promisc when there cannot be primary ports */ - if (internals->slave_count == 0) + if (internals->member_count == 0) break; port_id = internals->current_primary_port; ret = rte_eth_promiscuous_disable(port_id); @@ -2772,7 +2776,7 @@ bond_ethdev_promiscuous_update(struct rte_eth_dev *dev) case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: case BONDING_MODE_8023AD: - /* As promiscuous mode is propagated to all slaves for these + /* As promiscuous mode is propagated to all members for these * mode, no need to update for bonding device. */ break; @@ -2780,9 +2784,9 @@ bond_ethdev_promiscuous_update(struct rte_eth_dev *dev) case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: - /* As promiscuous mode is propagated only to primary slave + /* As promiscuous mode is propagated only to primary member * for these mode. When active/standby switchover, promiscuous - * mode should be set to new primary slave according to bonding + * mode should be set to new primary member according to bonding * device. */ if (rte_eth_promiscuous_get(internals->port_id) == 1) @@ -2803,15 +2807,15 @@ bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev) uint16_t port_id; switch (internals->mode) { - /* allmulti mode is propagated to all slaves */ + /* allmulti mode is propagated to all members */ case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: case BONDING_MODE_8023AD: { - unsigned int slave_ok = 0; + unsigned int member_ok = 0; - for (i = 0; i < internals->slave_count; i++) { - port_id = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) { + port_id = internals->members[i].port_id; ret = rte_eth_allmulticast_enable(port_id); if (ret != 0) @@ -2819,23 +2823,23 @@ bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev) "Failed to enable allmulti mode for port %u: %s", port_id, rte_strerror(-ret)); else - slave_ok++; + member_ok++; } /* * Report success if operation is successful on at least - * on one slave. Otherwise return last error code. + * on one member. Otherwise return last error code. */ - if (slave_ok > 0) + if (member_ok > 0) ret = 0; break; } - /* allmulti mode is propagated only to primary slave */ + /* allmulti mode is propagated only to primary member */ case BONDING_MODE_ACTIVE_BACKUP: case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: /* Do not touch allmulti when there cannot be primary ports */ - if (internals->slave_count == 0) + if (internals->member_count == 0) break; port_id = internals->current_primary_port; ret = rte_eth_allmulticast_enable(port_id); @@ -2857,15 +2861,15 @@ bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev) uint16_t port_id; switch (internals->mode) { - /* allmulti mode is propagated to all slaves */ + /* allmulti mode is propagated to all members */ case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: case BONDING_MODE_8023AD: { - unsigned int slave_ok = 0; + unsigned int member_ok = 0; - for (i = 0; i < internals->slave_count; i++) { - uint16_t port_id = internals->slaves[i].port_id; + for (i = 0; i < internals->member_count; i++) { + uint16_t port_id = internals->members[i].port_id; if (internals->mode == BONDING_MODE_8023AD && bond_mode_8023ad_ports[port_id].forced_rx_flags == @@ -2878,23 +2882,23 @@ bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev) "Failed to disable allmulti mode for port %u: %s", port_id, rte_strerror(-ret)); else - slave_ok++; + member_ok++; } /* * Report success if operation is successful on at least - * on one slave. Otherwise return last error code. + * on one member. Otherwise return last error code. */ - if (slave_ok > 0) + if (member_ok > 0) ret = 0; break; } - /* allmulti mode is propagated only to primary slave */ + /* allmulti mode is propagated only to primary member */ case BONDING_MODE_ACTIVE_BACKUP: case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: /* Do not touch allmulti when there cannot be primary ports */ - if (internals->slave_count == 0) + if (internals->member_count == 0) break; port_id = internals->current_primary_port; ret = rte_eth_allmulticast_disable(port_id); @@ -2918,7 +2922,7 @@ bond_ethdev_allmulticast_update(struct rte_eth_dev *dev) case BONDING_MODE_BALANCE: case BONDING_MODE_BROADCAST: case BONDING_MODE_8023AD: - /* As allmulticast mode is propagated to all slaves for these + /* As allmulticast mode is propagated to all members for these * mode, no need to update for bonding device. */ break; @@ -2926,9 +2930,9 @@ bond_ethdev_allmulticast_update(struct rte_eth_dev *dev) case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: - /* As allmulticast mode is propagated only to primary slave + /* As allmulticast mode is propagated only to primary member * for these mode. When active/standby switchover, allmulticast - * mode should be set to new primary slave according to bonding + * mode should be set to new primary member according to bonding * device. */ if (rte_eth_allmulticast_get(internals->port_id) == 1) @@ -2961,8 +2965,8 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, int ret; uint8_t lsc_flag = 0; - int valid_slave = 0; - uint16_t active_pos, slave_idx; + int valid_member = 0; + uint16_t active_pos, member_idx; uint16_t i; if (type != RTE_ETH_EVENT_INTR_LSC || param == NULL) @@ -2979,62 +2983,62 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, if (!bonded_eth_dev->data->dev_started) return rc; - /* verify that port_id is a valid slave of bonded port */ - for (i = 0; i < internals->slave_count; i++) { - if (internals->slaves[i].port_id == port_id) { - valid_slave = 1; - slave_idx = i; + /* verify that port_id is a valid member of bonded port */ + for (i = 0; i < internals->member_count; i++) { + if (internals->members[i].port_id == port_id) { + valid_member = 1; + member_idx = i; break; } } - if (!valid_slave) + if (!valid_member) return rc; /* Synchronize lsc callback parallel calls either by real link event - * from the slaves PMDs or by the bonding PMD itself. + * from the members PMDs or by the bonding PMD itself. */ rte_spinlock_lock(&internals->lsc_lock); /* Search for port in active port list */ - active_pos = find_slave_by_id(internals->active_slaves, - internals->active_slave_count, port_id); + active_pos = find_member_by_id(internals->active_members, + internals->active_member_count, port_id); ret = rte_eth_link_get_nowait(port_id, &link); if (ret < 0) - RTE_BOND_LOG(ERR, "Slave (port %u) link get failed", port_id); + RTE_BOND_LOG(ERR, "Member (port %u) link get failed", port_id); if (ret == 0 && link.link_status) { - if (active_pos < internals->active_slave_count) + if (active_pos < internals->active_member_count) goto link_update; /* check link state properties if bonded link is up*/ if (bonded_eth_dev->data->dev_link.link_status == RTE_ETH_LINK_UP) { if (link_properties_valid(bonded_eth_dev, &link) != 0) RTE_BOND_LOG(ERR, "Invalid link properties " - "for slave %d in bonding mode %d", + "for member %d in bonding mode %d", port_id, internals->mode); } else { - /* inherit slave link properties */ + /* inherit member link properties */ link_properties_set(bonded_eth_dev, &link); } - /* If no active slave ports then set this port to be + /* If no active member ports then set this port to be * the primary port. */ - if (internals->active_slave_count < 1) { - /* If first active slave, then change link status */ + if (internals->active_member_count < 1) { + /* If first active member, then change link status */ bonded_eth_dev->data->dev_link.link_status = RTE_ETH_LINK_UP; internals->current_primary_port = port_id; lsc_flag = 1; - mac_address_slaves_update(bonded_eth_dev); + mac_address_members_update(bonded_eth_dev); bond_ethdev_promiscuous_update(bonded_eth_dev); bond_ethdev_allmulticast_update(bonded_eth_dev); } - activate_slave(bonded_eth_dev, port_id); + activate_member(bonded_eth_dev, port_id); /* If the user has defined the primary port then default to * using it. @@ -3043,24 +3047,24 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, internals->primary_port == port_id) bond_ethdev_primary_set(internals, port_id); } else { - if (active_pos == internals->active_slave_count) + if (active_pos == internals->active_member_count) goto link_update; - /* Remove from active slave list */ - deactivate_slave(bonded_eth_dev, port_id); + /* Remove from active member list */ + deactivate_member(bonded_eth_dev, port_id); - if (internals->active_slave_count < 1) + if (internals->active_member_count < 1) lsc_flag = 1; - /* Update primary id, take first active slave from list or if none + /* Update primary id, take first active member from list or if none * available set to -1 */ if (port_id == internals->current_primary_port) { - if (internals->active_slave_count > 0) + if (internals->active_member_count > 0) bond_ethdev_primary_set(internals, - internals->active_slaves[0]); + internals->active_members[0]); else internals->current_primary_port = internals->primary_port; - mac_address_slaves_update(bonded_eth_dev); + mac_address_members_update(bonded_eth_dev); bond_ethdev_promiscuous_update(bonded_eth_dev); bond_ethdev_allmulticast_update(bonded_eth_dev); } @@ -3069,10 +3073,10 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, link_update: /** * Update bonded device link properties after any change to active - * slaves + * members */ bond_ethdev_link_update(bonded_eth_dev, 0); - internals->slaves[slave_idx].last_link_status = link.link_status; + internals->members[member_idx].last_link_status = link.link_status; if (lsc_flag) { /* Cancel any possible outstanding interrupts if delays are enabled */ @@ -3114,7 +3118,7 @@ bond_ethdev_rss_reta_update(struct rte_eth_dev *dev, { unsigned i, j; int result = 0; - int slave_reta_size; + int member_reta_size; unsigned reta_count; struct bond_dev_private *internals = dev->data->dev_private; @@ -3137,11 +3141,11 @@ bond_ethdev_rss_reta_update(struct rte_eth_dev *dev, memcpy(&internals->reta_conf[i], &internals->reta_conf[0], sizeof(internals->reta_conf[0]) * reta_count); - /* Propagate RETA over slaves */ - for (i = 0; i < internals->slave_count; i++) { - slave_reta_size = internals->slaves[i].reta_size; - result = rte_eth_dev_rss_reta_update(internals->slaves[i].port_id, - &internals->reta_conf[0], slave_reta_size); + /* Propagate RETA over members */ + for (i = 0; i < internals->member_count; i++) { + member_reta_size = internals->members[i].reta_size; + result = rte_eth_dev_rss_reta_update(internals->members[i].port_id, + &internals->reta_conf[0], member_reta_size); if (result < 0) return result; } @@ -3194,8 +3198,8 @@ bond_ethdev_rss_hash_update(struct rte_eth_dev *dev, bond_rss_conf.rss_key_len = internals->rss_key_len; } - for (i = 0; i < internals->slave_count; i++) { - result = rte_eth_dev_rss_hash_update(internals->slaves[i].port_id, + for (i = 0; i < internals->member_count; i++) { + result = rte_eth_dev_rss_hash_update(internals->members[i].port_id, &bond_rss_conf); if (result < 0) return result; @@ -3221,21 +3225,21 @@ bond_ethdev_rss_hash_conf_get(struct rte_eth_dev *dev, static int bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { - struct rte_eth_dev *slave_eth_dev; + struct rte_eth_dev *member_eth_dev; struct bond_dev_private *internals = dev->data->dev_private; int ret, i; rte_spinlock_lock(&internals->lock); - for (i = 0; i < internals->slave_count; i++) { - slave_eth_dev = &rte_eth_devices[internals->slaves[i].port_id]; - if (*slave_eth_dev->dev_ops->mtu_set == NULL) { + for (i = 0; i < internals->member_count; i++) { + member_eth_dev = &rte_eth_devices[internals->members[i].port_id]; + if (*member_eth_dev->dev_ops->mtu_set == NULL) { rte_spinlock_unlock(&internals->lock); return -ENOTSUP; } } - for (i = 0; i < internals->slave_count; i++) { - ret = rte_eth_dev_set_mtu(internals->slaves[i].port_id, mtu); + for (i = 0; i < internals->member_count; i++) { + ret = rte_eth_dev_set_mtu(internals->members[i].port_id, mtu); if (ret < 0) { rte_spinlock_unlock(&internals->lock); return ret; @@ -3271,29 +3275,29 @@ bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t vmdq) { - struct rte_eth_dev *slave_eth_dev; + struct rte_eth_dev *member_eth_dev; struct bond_dev_private *internals = dev->data->dev_private; int ret, i; rte_spinlock_lock(&internals->lock); - for (i = 0; i < internals->slave_count; i++) { - slave_eth_dev = &rte_eth_devices[internals->slaves[i].port_id]; - if (*slave_eth_dev->dev_ops->mac_addr_add == NULL || - *slave_eth_dev->dev_ops->mac_addr_remove == NULL) { + for (i = 0; i < internals->member_count; i++) { + member_eth_dev = &rte_eth_devices[internals->members[i].port_id]; + if (*member_eth_dev->dev_ops->mac_addr_add == NULL || + *member_eth_dev->dev_ops->mac_addr_remove == NULL) { ret = -ENOTSUP; goto end; } } - for (i = 0; i < internals->slave_count; i++) { - ret = rte_eth_dev_mac_addr_add(internals->slaves[i].port_id, + for (i = 0; i < internals->member_count; i++) { + ret = rte_eth_dev_mac_addr_add(internals->members[i].port_id, mac_addr, vmdq); if (ret < 0) { /* rollback */ for (i--; i >= 0; i--) rte_eth_dev_mac_addr_remove( - internals->slaves[i].port_id, mac_addr); + internals->members[i].port_id, mac_addr); goto end; } } @@ -3307,22 +3311,22 @@ bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, static void bond_ethdev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { - struct rte_eth_dev *slave_eth_dev; + struct rte_eth_dev *member_eth_dev; struct bond_dev_private *internals = dev->data->dev_private; int i; rte_spinlock_lock(&internals->lock); - for (i = 0; i < internals->slave_count; i++) { - slave_eth_dev = &rte_eth_devices[internals->slaves[i].port_id]; - if (*slave_eth_dev->dev_ops->mac_addr_remove == NULL) + for (i = 0; i < internals->member_count; i++) { + member_eth_dev = &rte_eth_devices[internals->members[i].port_id]; + if (*member_eth_dev->dev_ops->mac_addr_remove == NULL) goto end; } struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[index]; - for (i = 0; i < internals->slave_count; i++) - rte_eth_dev_mac_addr_remove(internals->slaves[i].port_id, + for (i = 0; i < internals->member_count; i++) + rte_eth_dev_mac_addr_remove(internals->members[i].port_id, mac_addr); end: @@ -3402,30 +3406,30 @@ dump_basic(const struct rte_eth_dev *dev, FILE *f) fprintf(f, "\n"); } - if (internals->slave_count > 0) { - fprintf(f, "\tSlaves (%u): [", internals->slave_count); - for (i = 0; i < internals->slave_count - 1; i++) - fprintf(f, "%u ", internals->slaves[i].port_id); + if (internals->member_count > 0) { + fprintf(f, "\tMembers (%u): [", internals->member_count); + for (i = 0; i < internals->member_count - 1; i++) + fprintf(f, "%u ", internals->members[i].port_id); - fprintf(f, "%u]\n", internals->slaves[internals->slave_count - 1].port_id); + fprintf(f, "%u]\n", internals->members[internals->member_count - 1].port_id); } else { - fprintf(f, "\tSlaves: []\n"); + fprintf(f, "\tMembers: []\n"); } - if (internals->active_slave_count > 0) { - fprintf(f, "\tActive Slaves (%u): [", internals->active_slave_count); - for (i = 0; i < internals->active_slave_count - 1; i++) - fprintf(f, "%u ", internals->active_slaves[i]); + if (internals->active_member_count > 0) { + fprintf(f, "\tActive Members (%u): [", internals->active_member_count); + for (i = 0; i < internals->active_member_count - 1; i++) + fprintf(f, "%u ", internals->active_members[i]); - fprintf(f, "%u]\n", internals->active_slaves[internals->active_slave_count - 1]); + fprintf(f, "%u]\n", internals->active_members[internals->active_member_count - 1]); } else { - fprintf(f, "\tActive Slaves: []\n"); + fprintf(f, "\tActive Members: []\n"); } if (internals->user_defined_primary_port) fprintf(f, "\tUser Defined Primary: [%u]\n", internals->primary_port); - if (internals->slave_count > 0) + if (internals->member_count > 0) fprintf(f, "\tCurrent Primary: [%u]\n", internals->current_primary_port); } @@ -3471,7 +3475,7 @@ dump_lacp_port_param(const struct port_params *params, FILE *f) } static void -dump_lacp_slave(const struct rte_eth_bond_8023ad_slave_info *info, FILE *f) +dump_lacp_member(const struct rte_eth_bond_8023ad_member_info *info, FILE *f) { char a_state[256] = { 0 }; char p_state[256] = { 0 }; @@ -3520,18 +3524,18 @@ dump_lacp_slave(const struct rte_eth_bond_8023ad_slave_info *info, FILE *f) static void dump_lacp(uint16_t port_id, FILE *f) { - struct rte_eth_bond_8023ad_slave_info slave_info; + struct rte_eth_bond_8023ad_member_info member_info; struct rte_eth_bond_8023ad_conf port_conf; - uint16_t slaves[RTE_MAX_ETHPORTS]; - int num_active_slaves; + uint16_t members[RTE_MAX_ETHPORTS]; + int num_active_members; int i, ret; fprintf(f, " - Lacp info:\n"); - num_active_slaves = rte_eth_bond_active_slaves_get(port_id, slaves, + num_active_members = rte_eth_bond_active_members_get(port_id, members, RTE_MAX_ETHPORTS); - if (num_active_slaves < 0) { - fprintf(f, "\tFailed to get active slave list for port %u\n", + if (num_active_members < 0) { + fprintf(f, "\tFailed to get active member list for port %u\n", port_id); return; } @@ -3545,16 +3549,16 @@ dump_lacp(uint16_t port_id, FILE *f) } dump_lacp_conf(&port_conf, f); - for (i = 0; i < num_active_slaves; i++) { - ret = rte_eth_bond_8023ad_slave_info(port_id, slaves[i], - &slave_info); + for (i = 0; i < num_active_members; i++) { + ret = rte_eth_bond_8023ad_member_info(port_id, members[i], + &member_info); if (ret) { - fprintf(f, "\tGet slave device %u 8023ad info failed\n", - slaves[i]); + fprintf(f, "\tGet member device %u 8023ad info failed\n", + members[i]); return; } - fprintf(f, "\tSlave Port: %u\n", slaves[i]); - dump_lacp_slave(&slave_info, f); + fprintf(f, "\tMember Port: %u\n", members[i]); + dump_lacp_member(&member_info, f); } } @@ -3655,8 +3659,8 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) internals->link_down_delay_ms = 0; internals->link_up_delay_ms = 0; - internals->slave_count = 0; - internals->active_slave_count = 0; + internals->member_count = 0; + internals->active_member_count = 0; internals->rx_offload_capa = 0; internals->tx_offload_capa = 0; internals->rx_queue_offload_capa = 0; @@ -3684,8 +3688,8 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) internals->rx_desc_lim.nb_align = 1; internals->tx_desc_lim.nb_align = 1; - memset(internals->active_slaves, 0, sizeof(internals->active_slaves)); - memset(internals->slaves, 0, sizeof(internals->slaves)); + memset(internals->active_members, 0, sizeof(internals->active_members)); + memset(internals->members, 0, sizeof(internals->members)); TAILQ_INIT(&internals->flow_list); internals->flow_isolated_valid = 0; @@ -3770,7 +3774,7 @@ bond_probe(struct rte_vdev_device *dev) /* Parse link bonding mode */ if (rte_kvargs_count(kvlist, PMD_BOND_MODE_KVARG) == 1) { if (rte_kvargs_process(kvlist, PMD_BOND_MODE_KVARG, - &bond_ethdev_parse_slave_mode_kvarg, + &bond_ethdev_parse_member_mode_kvarg, &bonding_mode) != 0) { RTE_BOND_LOG(ERR, "Invalid mode for bonded device %s", name); @@ -3815,7 +3819,7 @@ bond_probe(struct rte_vdev_device *dev) if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) { if (rte_kvargs_process(kvlist, PMD_BOND_AGG_MODE_KVARG, - &bond_ethdev_parse_slave_agg_mode_kvarg, + &bond_ethdev_parse_member_agg_mode_kvarg, &agg_mode) != 0) { RTE_BOND_LOG(ERR, "Failed to parse agg selection mode for bonded device %s", @@ -3865,7 +3869,7 @@ bond_remove(struct rte_vdev_device *dev) RTE_ASSERT(eth_dev->device == &dev->device); internals = eth_dev->data->dev_private; - if (internals->slave_count != 0) + if (internals->member_count != 0) return -EBUSY; if (eth_dev->data->dev_started == 1) { @@ -3877,7 +3881,7 @@ bond_remove(struct rte_vdev_device *dev) return ret; } -/* this part will resolve the slave portids after all the other pdev and vdev +/* this part will resolve the member portids after all the other pdev and vdev * have been allocated */ static int bond_ethdev_configure(struct rte_eth_dev *dev) @@ -3959,7 +3963,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) if (link_speeds & RTE_ETH_LINK_SPEED_FIXED) { if ((link_speeds & (internals->speed_capa & ~RTE_ETH_LINK_SPEED_FIXED)) == 0) { - RTE_BOND_LOG(ERR, "the fixed speed is not supported by all slave devices."); + RTE_BOND_LOG(ERR, "the fixed speed is not supported by all member devices."); return -EINVAL; } /* @@ -4041,7 +4045,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) { if (rte_kvargs_process(kvlist, PMD_BOND_AGG_MODE_KVARG, - &bond_ethdev_parse_slave_agg_mode_kvarg, + &bond_ethdev_parse_member_agg_mode_kvarg, &agg_mode) != 0) { RTE_BOND_LOG(ERR, "Failed to parse agg selection mode for bonded device %s", @@ -4059,60 +4063,60 @@ bond_ethdev_configure(struct rte_eth_dev *dev) } } - /* Parse/add slave ports to bonded device */ - if (rte_kvargs_count(kvlist, PMD_BOND_SLAVE_PORT_KVARG) > 0) { - struct bond_ethdev_slave_ports slave_ports; + /* Parse/add member ports to bonded device */ + if (rte_kvargs_count(kvlist, PMD_BOND_MEMBER_PORT_KVARG) > 0) { + struct bond_ethdev_member_ports member_ports; unsigned i; - memset(&slave_ports, 0, sizeof(slave_ports)); + memset(&member_ports, 0, sizeof(member_ports)); - if (rte_kvargs_process(kvlist, PMD_BOND_SLAVE_PORT_KVARG, - &bond_ethdev_parse_slave_port_kvarg, &slave_ports) != 0) { + if (rte_kvargs_process(kvlist, PMD_BOND_MEMBER_PORT_KVARG, + &bond_ethdev_parse_member_port_kvarg, &member_ports) != 0) { RTE_BOND_LOG(ERR, - "Failed to parse slave ports for bonded device %s", + "Failed to parse member ports for bonded device %s", name); return -1; } - for (i = 0; i < slave_ports.slave_count; i++) { - if (rte_eth_bond_slave_add(port_id, slave_ports.slaves[i]) != 0) { + for (i = 0; i < member_ports.member_count; i++) { + if (rte_eth_bond_member_add(port_id, member_ports.members[i]) != 0) { RTE_BOND_LOG(ERR, - "Failed to add port %d as slave to bonded device %s", - slave_ports.slaves[i], name); + "Failed to add port %d as member to bonded device %s", + member_ports.members[i], name); } } } else { - RTE_BOND_LOG(INFO, "No slaves specified for bonded device %s", name); + RTE_BOND_LOG(INFO, "No members specified for bonded device %s", name); return -1; } - /* Parse/set primary slave port id*/ - arg_count = rte_kvargs_count(kvlist, PMD_BOND_PRIMARY_SLAVE_KVARG); + /* Parse/set primary member port id*/ + arg_count = rte_kvargs_count(kvlist, PMD_BOND_PRIMARY_MEMBER_KVARG); if (arg_count == 1) { - uint16_t primary_slave_port_id; + uint16_t primary_member_port_id; if (rte_kvargs_process(kvlist, - PMD_BOND_PRIMARY_SLAVE_KVARG, - &bond_ethdev_parse_primary_slave_port_id_kvarg, - &primary_slave_port_id) < 0) { + PMD_BOND_PRIMARY_MEMBER_KVARG, + &bond_ethdev_parse_primary_member_port_id_kvarg, + &primary_member_port_id) < 0) { RTE_BOND_LOG(INFO, - "Invalid primary slave port id specified for bonded device %s", + "Invalid primary member port id specified for bonded device %s", name); return -1; } /* Set balance mode transmit policy*/ - if (rte_eth_bond_primary_set(port_id, primary_slave_port_id) + if (rte_eth_bond_primary_set(port_id, primary_member_port_id) != 0) { RTE_BOND_LOG(ERR, - "Failed to set primary slave port %d on bonded device %s", - primary_slave_port_id, name); + "Failed to set primary member port %d on bonded device %s", + primary_member_port_id, name); return -1; } } else if (arg_count > 1) { RTE_BOND_LOG(INFO, - "Primary slave can be specified only once for bonded device %s", + "Primary member can be specified only once for bonded device %s", name); return -1; } @@ -4206,15 +4210,15 @@ bond_ethdev_configure(struct rte_eth_dev *dev) return -1; } - /* configure slaves so we can pass mtu setting */ - for (i = 0; i < internals->slave_count; i++) { - struct rte_eth_dev *slave_ethdev = - &(rte_eth_devices[internals->slaves[i].port_id]); - if (slave_configure(dev, slave_ethdev) != 0) { + /* configure members so we can pass mtu setting */ + for (i = 0; i < internals->member_count; i++) { + struct rte_eth_dev *member_ethdev = + &(rte_eth_devices[internals->members[i].port_id]); + if (member_configure(dev, member_ethdev) != 0) { RTE_BOND_LOG(ERR, - "bonded port (%d) failed to configure slave device (%d)", + "bonded port (%d) failed to configure member device (%d)", dev->data->port_id, - internals->slaves[i].port_id); + internals->members[i].port_id); return -1; } } @@ -4230,7 +4234,7 @@ RTE_PMD_REGISTER_VDEV(net_bonding, pmd_bond_drv); RTE_PMD_REGISTER_ALIAS(net_bonding, eth_bond); RTE_PMD_REGISTER_PARAM_STRING(net_bonding, - "slave= " + "member= " "primary= " "mode=[0-6] " "xmit_policy=[l2 | l23 | l34] " diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map index 9333923b4e..56bc143a89 100644 --- a/drivers/net/bonding/version.map +++ b/drivers/net/bonding/version.map @@ -12,8 +12,6 @@ DPDK_23 { rte_eth_bond_8023ad_ext_distrib_get; rte_eth_bond_8023ad_ext_slowtx; rte_eth_bond_8023ad_setup; - rte_eth_bond_8023ad_slave_info; - rte_eth_bond_active_slaves_get; rte_eth_bond_create; rte_eth_bond_free; rte_eth_bond_link_monitoring_set; @@ -23,11 +21,18 @@ DPDK_23 { rte_eth_bond_mode_set; rte_eth_bond_primary_get; rte_eth_bond_primary_set; - rte_eth_bond_slave_add; - rte_eth_bond_slave_remove; - rte_eth_bond_slaves_get; rte_eth_bond_xmit_policy_get; rte_eth_bond_xmit_policy_set; local: *; }; + +EXPERIMENTAL { + # added in 23.07 + global: + rte_eth_bond_8023ad_member_info; + rte_eth_bond_active_members_get; + rte_eth_bond_member_add; + rte_eth_bond_member_remove; + rte_eth_bond_members_get; +}; diff --git a/examples/bond/main.c b/examples/bond/main.c index 9b076bb39f..90f422ec11 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -105,8 +105,8 @@ ":%02"PRIx8":%02"PRIx8":%02"PRIx8, \ RTE_ETHER_ADDR_BYTES(&addr)) -uint16_t slaves[RTE_MAX_ETHPORTS]; -uint16_t slaves_count; +uint16_t members[RTE_MAX_ETHPORTS]; +uint16_t members_count; static uint16_t BOND_PORT = 0xffff; @@ -128,7 +128,7 @@ static struct rte_eth_conf port_conf = { }; static void -slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) +member_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) { int retval; uint16_t nb_rxd = RTE_RX_DESC_DEFAULT; @@ -252,10 +252,10 @@ bond_port_init(struct rte_mempool *mbuf_pool) rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc " "failed (res=%d)\n", BOND_PORT, retval); - for (i = 0; i < slaves_count; i++) { - if (rte_eth_bond_slave_add(BOND_PORT, slaves[i]) == -1) - rte_exit(-1, "Oooops! adding slave (%u) to bond (%u) failed!\n", - slaves[i], BOND_PORT); + for (i = 0; i < members_count; i++) { + if (rte_eth_bond_member_add(BOND_PORT, members[i]) == -1) + rte_exit(-1, "Oooops! adding member (%u) to bond (%u) failed!\n", + members[i], BOND_PORT); } @@ -283,18 +283,18 @@ bond_port_init(struct rte_mempool *mbuf_pool) if (retval < 0) rte_exit(retval, "Start port %d failed (res=%d)", BOND_PORT, retval); - printf("Waiting for slaves to become active..."); + printf("Waiting for members to become active..."); while (wait_counter) { - uint16_t act_slaves[16] = {0}; - if (rte_eth_bond_active_slaves_get(BOND_PORT, act_slaves, 16) == - slaves_count) { + uint16_t act_members[16] = {0}; + if (rte_eth_bond_active_members_get(BOND_PORT, act_members, 16) == + members_count) { printf("\n"); break; } sleep(1); printf("..."); if (--wait_counter == 0) - rte_exit(-1, "\nFailed to activate slaves\n"); + rte_exit(-1, "\nFailed to activate members\n"); } retval = rte_eth_promiscuous_enable(BOND_PORT); @@ -631,7 +631,7 @@ static void cmd_help_parsed(__rte_unused void *parsed_result, "send IP - sends one ARPrequest through bonding for IP.\n" "start - starts listening ARPs.\n" "stop - stops lcore_main.\n" - "show - shows some bond info: ex. active slaves etc.\n" + "show - shows some bond info: ex. active members etc.\n" "help - prints help.\n" "quit - terminate all threads and quit.\n" ); @@ -742,13 +742,13 @@ static void cmd_show_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data) { - uint16_t slaves[16] = {0}; + uint16_t members[16] = {0}; uint8_t len = 16; struct rte_ether_addr addr; uint16_t i; int ret; - for (i = 0; i < slaves_count; i++) { + for (i = 0; i < members_count; i++) { ret = rte_eth_macaddr_get(i, &addr); if (ret != 0) { cmdline_printf(cl, @@ -763,9 +763,9 @@ static void cmd_show_parsed(__rte_unused void *parsed_result, rte_spinlock_lock(&global_flag_stru_p->lock); cmdline_printf(cl, - "Active_slaves:%d " + "Active_members:%d " "packets received:Tot:%d Arp:%d IPv4:%d\n", - rte_eth_bond_active_slaves_get(BOND_PORT, slaves, len), + rte_eth_bond_active_members_get(BOND_PORT, members, len), global_flag_stru_p->port_packets[0], global_flag_stru_p->port_packets[1], global_flag_stru_p->port_packets[2]); @@ -836,10 +836,10 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); /* initialize all ports */ - slaves_count = nb_ports; + members_count = nb_ports; RTE_ETH_FOREACH_DEV(i) { - slave_port_init(i, mbuf_pool); - slaves[i] = i; + member_port_init(i, mbuf_pool); + members[i] = i; } bond_port_init(mbuf_pool); diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 99fe9e238b..85439e3a41 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -2035,8 +2035,13 @@ struct rte_eth_dev_owner { #define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE RTE_BIT32(0) /** Device supports link state interrupt */ #define RTE_ETH_DEV_INTR_LSC RTE_BIT32(1) -/** Device is a bonded slave */ -#define RTE_ETH_DEV_BONDED_SLAVE RTE_BIT32(2) +/** Device is a bonded member */ +#define RTE_ETH_DEV_BONDED_MEMBER RTE_BIT32(2) +#define RTE_ETH_DEV_BONDED_SLAVE \ + do { \ + RTE_DEPRECATED(RTE_ETH_DEV_BONDED_SLAVE) \ + RTE_ETH_DEV_BONDED_MEMBER \ + } while (0) /** Device supports device removal interrupt */ #define RTE_ETH_DEV_INTR_RMV RTE_BIT32(3) /** Device is port representor */ -- 2.39.1