From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0070.outbound.protection.outlook.com [104.47.38.70]) by dpdk.org (Postfix) with ESMTP id 797F11D90; Tue, 28 Nov 2017 03:22:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=studentuml.onmicrosoft.com; s=selector1-student-uml-edu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PH75PAh0TMyIP/fWjFgUcsokaS8Hi4I3tcE8oQVMJhY=; b=ZMkA5LFfD3dQ9lNkAcsfnHEMblXKUI/MF3jvDW01bpo5+jtfPRsMtZtyOJTBUAR2YeH8xP8/drXr/HH8buJq/iDT/C9V74o/1Jp8ZusObbzZo44zG3av5sYMkSbZTXu7Q4tmeIT+3FTEMONlkBav4nDfV5wMndvC5jyIwQh1xTk= Received: from BN6PR02MB2689.namprd02.prod.outlook.com (10.175.95.15) by BN6PR02MB2690.namprd02.prod.outlook.com (10.175.95.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Tue, 28 Nov 2017 02:22:58 +0000 Received: from BN6PR02MB2689.namprd02.prod.outlook.com ([10.175.95.15]) by BN6PR02MB2689.namprd02.prod.outlook.com ([10.175.95.15]) with mapi id 15.20.0239.012; Tue, 28 Nov 2017 02:22:58 +0000 From: "Wu, Xiaoban" To: "users@dpdk.org" , "dev@dpdk.org" Thread-Topic: A question about the possible race condition in the l3fwd example? Thread-Index: AQHTZ+33jKE+NJVCl0+UXPVbQfpA+w== Date: Tue, 28 Nov 2017 02:22:57 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Xiaoban_Wu@student.uml.edu; x-originating-ip: [129.63.253.96] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR02MB2690; 6:6XLDzEoTMqm5Ft+gYgvLTBJxl5am9lGPZokxuLJRq5OM5KD9MbUpf3YnCJn7xoHVl0qZVgrlBoTnliYzV68DY8+ItIjbFwZo7I+ynlBrQ/qWeB5lU1tZlbCNjq/GIDabCPdRmH662l9+DR552ISYBgdXPjqZ+hOkS4F4QAqkWPvsebmMhOhXddlsUKJ67Hue2Pz799hi75qg3R4t4sJIa+WfDk76eOisdgCvg6Nfq/C7mgMMm0xhvz70yxr/nHhIiSpOn7OFW7gkP8d7Yg9h6WOxrhn5VzorkC9LkpeRXGVwYDmj0A4/TRP1qAiNKUEdHbGhFMEN7B6aUMdbNukdZDVL09+dlsqgXc9n3QXZgIs=; 5:pps9U9ION7CxTaOc8kDWR2o1V2UQaDzQH9CvkSactCO09O0SFLrfcDsxQL3XYQXGVsPqyyIOgJLnNwR9+udSCOgX3q4UzUaQ8Sj+LU8HHfJ6vq7kq3BHPTecsnaJ1+FNvfqq2ppxDOY0CpkUChWPnKdd6vLuTg+A3W0b2HNyR6o=; 24:qNU/C4N19pLBP4dkmIgHreOxIRUD0bNjillUMNOKqvToVpalr4rOfh81fh8Fb/aAXT8/tuuvGxowyAfsbRdV0wPunCr142VeQKZSObhSxxY=; 7:IBVX02EqOMRPdUATuBSV/2iTCrwNcuSVzAUvSBvR19zFgsaeL/B5kZXA+8lWPq5klQnKH4GVfvVPperU4t/q32+rPg3Hz/fIIpeWz3Jx1hvEE+57uC+tUoMxnZvgzoriyxbVZiqa5MlXNiXGXf8F6amUNi3G3V6qutv1Irt3qJFT01Htfc0ro3MPhGNRHEAiFBz6OVpI7a+BYckaJ/ZqL0H/fCaxM5te/y94lHglWOY9QJwAyEF9oqhZmT1APA23 x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 092cd9c6-9e88-4b7f-96e4-08d53606f0d9 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603199); SRVR:BN6PR02MB2690; x-ms-traffictypediagnostic: BN6PR02MB2690: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231022)(93006095)(93001095)(6041248)(20161123558100)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BN6PR02MB2690; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR02MB2690; x-forefront-prvs: 0505147DDB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(366004)(376002)(346002)(199003)(189002)(413944005)(5660300001)(54356999)(101416001)(50986999)(42882006)(6606003)(8936002)(99286004)(106356001)(75432002)(450100002)(33656002)(189998001)(68736007)(53336002)(66066001)(55016002)(105586002)(72206003)(25786009)(14454004)(19627405001)(478600001)(97736004)(2501003)(54896002)(2906002)(2900100001)(53936002)(6436002)(3660700001)(6506006)(77096006)(9686003)(316002)(74316002)(7736002)(86362001)(3280700002)(8676002)(102836003)(81156014)(110136005)(3846002)(81166006)(7696005)(88552002)(6116002)(786003)(42413003)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB2690; H:BN6PR02MB2689.namprd02.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: student.uml.edu does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: student.uml.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 092cd9c6-9e88-4b7f-96e4-08d53606f0d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2017 02:22:57.9726 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4c25b8a6-17f7-46f9-83f0-54734ab81fb1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2690 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] A question about the possible race condition in the l3fwd example? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 02:22:59 -0000 Dear All, I am studying the source code of the l3fwd example. I am confused about a p= ossible race condition in the l3fwd_lpm_simple_forward(). In this function it calls send_single_packet(), which executes the followin= g code, len =3D qconf->tx_mbufs[port].len; qconf->tx_mbufs[port].m_table[len] =3D m; len++; As you can see, if two threads are trying to call send_single_packet() at t= he same time and send different packets to the same port, which writes the= value to the same array and updates the same counter 'len', then the race = condition happens, so we might lose packets. Can anybody please clarify if this indeed brings race condition? If yes, th= en why we want to design it in this way, just for high performance? If no, = why? Thanks very much for your help. Best wishes, Xiaoban