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 8E13DA0C4B for ; Tue, 9 Nov 2021 10:59:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 844CF40E03; Tue, 9 Nov 2021 10:59:08 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by mails.dpdk.org (Postfix) with ESMTP id CC76840E03; Tue, 9 Nov 2021 10:59:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWbxKKbA/KUKbv3FOi8SgV2G6NW5zpOTzsj6b43OcjQ2hmPW0e6uf2waFTNl1rHaXg9o9GnUcsmCp9KyreNHUV+FifXpOH3A+y/mPxNgpHnY9CCRZKkYSp+EpcP9ptFHnTLMhePEr/8/LGgRiPiEjv6hf4p07VC+wPShPemUAG9o5KOu0mxKPlS0IfkbnU9GKyEms8cXBJvZXn7khYt6SFISA7FSdYSfC17TGqjjdhWqV/xEp9k5KoVPQrSV6dyg/Lsk97Pbom7bj/zREFn8b7BF4Ly4LXuXvX0RXg/dYrSbylgG8VropgmYBkeJz3zfRWD+taAvmgsiAD+4aWj9Bg== 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=fCDZIjMG2HB9laZGdV8erbjV8Yd7tfubhoIaMRmn3N0=; b=DITMPOAwpzr96EVj8qr6ueoTfujbm8mw6GeSXXGLKFhu04qhpLIkCqW7fFqilKgq3Ye7y1sGktr03ntwtNPYa4T1wqtZ08x5dX1nc1VUatlhQYHRjdXW4kRRi1DAglITvTYQ1R6g9atuZZPoDgGOjlPqYwBLz+VCN/8VQZPUzl8QUhDUPe7oGcVE/rVifaeliqYEC8hCQG+LYgROw54RZ5R9XS33fmi3Uvyq/yEmvvTuTFvKzMRKNb79UmWFRyEnV70m2b0YB6l4SIpg/LlkJu0tF9sL0PGNUUagzEUota57VxIsv60q44IK2c4qcqzaaYYqWQjmsgbhyXvOQfcOEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fCDZIjMG2HB9laZGdV8erbjV8Yd7tfubhoIaMRmn3N0=; b=CvVQRHDjEBHdE4+c4WW/wKZB1bO45umpnJNevoRDACcrMA9iK48+dMpPUQx5SdJcovo83dH9Mu3wz0xUXsqdQshZrNG8zGMuOSeeaeurBmceMWDPLaLkUcbZmtP/sXE5fRF5GLVaE7zUO/5G7C764PMWDvgiJZFRSKzBdIrwZOYy0Ohz+gXeqFmN7kS67ze7r7htpR5ZMZV9qu9wMRS7ZN2tTf3jUxUFLvGkQcB0IRYzH8UVfwYEdfwVGBf877JJgtmQak/S8Aw5dcR3vAo8bpWTqyt8f6+xQwmDgm/kEzaZ0UVr0Tgcqg4vxOfocCVQtJlYmXRfOTJdQKpmLh2NGA== Received: from MW4PR04CA0339.namprd04.prod.outlook.com (2603:10b6:303:8a::14) by BY5PR12MB4209.namprd12.prod.outlook.com (2603:10b6:a03:20d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15; Tue, 9 Nov 2021 09:59:05 +0000 Received: from CO1NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::a3) by MW4PR04CA0339.outlook.office365.com (2603:10b6:303:8a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Tue, 9 Nov 2021 09:59:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT028.mail.protection.outlook.com (10.13.175.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Tue, 9 Nov 2021 09:59:02 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 9 Nov 2021 09:58:59 +0000 From: Gregory Etelson To: , CC: , , , , Anatoly Burakov Date: Tue, 9 Nov 2021 11:58:47 +0200 Message-ID: <20211109095847.7642-1-getelson@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211026095037.17557-1-getelson@nvidia.com> References: <20211026095037.17557-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52e75535-76ae-47f5-d5f3-08d9a3678ee7 X-MS-TrafficTypeDiagnostic: BY5PR12MB4209: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 32vnKNpkfF7TTaL76hhTKGHv+YnsMu6izjEjBwe1iLxVSHjt6yp8ZY0qTyIcpA/7UIStZ249a8d2f0Hhh2XYTQJL2Irilyr4RganM7jSI8HQodtzXqYPpaqtVs75sLbLcIjOnmpn6Kzps6W1rcZAcJC9UcMRsVZX77ChSfdizNaxlJ48M6I/eDYBGzQlYCr6Hb1YVSAwnwaxkgE3uIf4qpjkYPSyTWovXH5mxQjHbPxZ0ydRYwylUea5R3lgfC9EyBDz5aR01BDnzcOi2EgB/wnwNS6/oltJ6obQ0eBlclvuJALuVJ9wIVDa+DZ9/zKWAvMZwzOKa2gFv8uEuPHSYm7tv1kcV+6/L2Hnu1P72vJXNajX6ep4pekdRhrskDPEmdaq2eO3Uh49ATrWzE8TisCqkEU6hY1qX08cBd2JRmGJupFypYbcKsjjKS4t4aopvk2zvNgCY4Z7Q080jo2pL6IRt8g3ziVn0HP4jTLShUUXIX1tbJQf4bH932pYnALwKsADmreatoyVgLAXMAwRgCl2HWhYDitmXv/UHdoIZdEnVEMXcFX2nWeSPw+2dkkUo7JBBb8PGMqyxurq0itWAOo4AVHnnQsb/vp89kE1c4rYkykw/vVR09KkJ5uv66Kks3sb8XfukldV45lPcEqXv8eAi5GnC6P1+bHlaxHwlqc7Enj6kJ8WKdoytqnSc/LGUI84QNzEmV2CxWXgEaCkCA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(4326008)(47076005)(82310400003)(7696005)(7049001)(83380400001)(36756003)(55016002)(2906002)(86362001)(426003)(6286002)(2616005)(1076003)(5660300002)(508600001)(8936002)(54906003)(356005)(6666004)(26005)(316002)(70206006)(36860700001)(186003)(16526019)(110136005)(8676002)(70586007)(7636003)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2021 09:59:02.2943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52e75535-76ae-47f5-d5f3-08d9a3678ee7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4209 Subject: [dpdk-stable] [PATCH v2] examples/multi_proces: fix Rx packets distribution X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" MP servers distributes Rx packets between clients according to round-robin scheme. Current implementation always started packets distribution from the first client. That procedure resulted in uniform distribution in cases when Rx packets number was around clients number multiplication. However, if RX burst repeatedly returned single packet, round-robin scheme would not work because all packets were assigned to the first client only. The patch does not restart packets distribution from the first client. Packets distribution always continues to the next client. Cc: stable@dpdk.org Fixes: af75078fece3 ("first public release") Signed-off-by: Gregory Etelson Acked-by: Anatoly Burakov --- v2: Remove explisit static variable initialization. --- examples/multi_process/client_server_mp/mp_server/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index b4761ebc7b..31e7e76706 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -234,7 +234,12 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], uint16_t rx_count) { uint16_t i; - uint8_t client = 0; + /* + * C99: All objects with static storage duration + * shall be initialized (set to their initial values) before + * program startup. + */ + static uint8_t client; for (i = 0; i < rx_count; i++) { enqueue_rx_packet(client, pkts[i]); -- 2.33.1