From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48272A04BC; Fri, 9 Oct 2020 11:19:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98F6B1C225; Fri, 9 Oct 2020 11:19:21 +0200 (CEST) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by dpdk.org (Postfix) with ESMTP id B88551C224 for ; Fri, 9 Oct 2020 11:19:20 +0200 (CEST) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 09 Oct 2020 02:19:06 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 9 Oct 2020 09:19:12 +0000 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.52) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 9 Oct 2020 09:19:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b43i2z3Bxk/qzQSgVAWNaSmldfVyOFCyNMKKhHdE1HRmKiiupHbZdrnLRW5bf8QgJ1DwosxFQ34uqMnTHk1Dm8KmysBmbyuata/KMrXMqYuIMYfxO+HhkrAdB/r1JXOQsG7S6BqK9fjDCEr4b0IKU1/DVHZV5mmqUrNs4M8YIOP7Ah6rYhR3/RbOu7Ru/oC7MU/Umn97xM0QAHFAlQaBlihNcRGwuw+zzrjsujC2FQQ87N4Z/GLMMoAMC5d1jU3kyRvGdiscCOOWYhUMSFUM6ehZkKWL5Bjae/66LiSPkDKeELDJ0Kgw6hQcq5K0362edWhG84ZQYQZSgwLgKh2+TA== 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-SenderADCheck; bh=mu99BYyJrdRmlxzt+OchOgKy2e6J98+EkAVJDSLqddU=; b=K6G02ntBTefFvv6MPIyEAiiGi4r3EY+cj0twMxVIp5Bvnf9sZuWRkWu4phOQCX1PxyAwPUcdCmqK21pPI7wl4Wwx2u5F04P8uoITBoM7RK+rAjtgyrsXEEwZQj0HtMv5kv1XLwyFGG3Hl1g/7G5PJjH0sFncIFIjgnQeoZBgsPG68vCx5XnNb/FznFh2L4AteNVwF0TxWVTuDltsByGQFgPfDJORU1AGzLADaOJvJMpB/wTXbzRvlutUKG0vZDzQvWnyNmgHUJQUDWCybytfwYT16/tTCGVpmq8N7LP9RgLLN2b322Jo8XMgPozoCUxZC00oi9dVhvZ2/HJA1Gp+dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from BYAPR12MB3285.namprd12.prod.outlook.com (2603:10b6:a03:134::14) by BYAPR12MB3062.namprd12.prod.outlook.com (2603:10b6:a03:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23; Fri, 9 Oct 2020 09:19:11 +0000 Received: from BYAPR12MB3285.namprd12.prod.outlook.com ([fe80::9577:cc9f:6780:4c6c]) by BYAPR12MB3285.namprd12.prod.outlook.com ([fe80::9577:cc9f:6780:4c6c%7]) with mapi id 15.20.3455.024; Fri, 9 Oct 2020 09:19:10 +0000 From: Tal Shnaiderman To: Suanming Mou , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 1/2] eal/windows: add pthread mutex lock Thread-Index: AQHWndoc0L4Tad1e6EuyxydnLs8fVqmO/cDA Date: Fri, 9 Oct 2020 09:19:10 +0000 Message-ID: References: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> <1602206243-157603-1-git-send-email-suanmingm@nvidia.com> <1602206243-157603-2-git-send-email-suanmingm@nvidia.com> In-Reply-To: <1602206243-157603-2-git-send-email-suanmingm@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [77.137.141.17] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c8f52ab1-716e-46d3-f30b-08d86c3461e8 x-ms-traffictypediagnostic: BYAPR12MB3062: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:154; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9jwj8GJMu6x1TmJSzKnfkceCcR+VVS6AvykgtGlHDlSpeCPkPhzlTbKEWmYWN4ssrE9tCGPS9piDw0vb3BC9i5bcYTjdqeZtU9yKNh14Ya6iVYglsVXKyD7iIiHMCFA0mQT3qte8dXgXHOUGSMgro1qQXZHh/B3ioovZ5aAdFP0lLCDwLDQf4NwVrk1iqH9NpYcHfeqcGA2yUGYwnWmy1WqdfN/1OK6nimfhBRpbaIVujquoy1mDnaxbEFwz2gQHh2V1lcdmoreFVBhGTp92sL1JdU0/H1Rn6ensYmC9qdMpA1RwabrypBWOsC3/MMJg x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR12MB3285.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(64756008)(26005)(66476007)(8936002)(86362001)(66446008)(55016002)(52536014)(8676002)(76116006)(66556008)(110136005)(316002)(83380400001)(66946007)(478600001)(7696005)(45080400002)(4326008)(9686003)(2906002)(33656002)(71200400001)(5660300002)(6506007)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: SQRDp4lOAiY1py036/BpO4Dm9WW6lDwUfylvte9sIfShznXsJ+THw8x7+k+NH3AzvW4JM19pzd3hr276xwfQjIEISmwSo7RkmQEHdT2zMFkl29mmS8LKBrHhxzxKavZwi57ikEfMLkvAbogSBUvqj+YU3KHG9bUKXfQOr+cqaItN6a1osvoE6alm9MO6z/p7SW29q54infsJHXrn7IE5jk5RLIni8fc8+8mixuMvE7tfIsZGlK32VQVh1XUzj+UFGjR+zUjlH8SKcHOqUtkDTCuxavyyeHfkW1OvPknoa5OGxYSqClkPHIN4qNfP+Lx4j1FoYo7/IAeE5JsV4+dcVwNlzAprQ9BtQW0BsOnkSr5e0yi9xOCnsooXsoo0I0PgiTDKZ36C6Xrdw+pjvLCw36Msy1NQ/R14QoPEqH/oS2p44KD/xta+XrvjmmuU2JD4Ko9ld0BulnV4w+3xhUIGzJ6ecOaWFtO/DZy0/zgyc4u5rzwVwgF/Dpb58kuPJIrAYLjQzZfn32Y2n2A8JB3schMvUP7xp5Whxt7OriiFAbzgq81rV9i2h2+m0tWhmDpcOmR/ITbGgI+KDl122iQozkDMHWmMSJHKRgK6Qkk/+EEdLghsoQoSJgD/+hpSFZy3Wm20J2E+jW1HEv/Go9AYNA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3285.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8f52ab1-716e-46d3-f30b-08d86c3461e8 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2020 09:19:10.7682 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: B8kqvskazIWjHCFoxY/oEmp8UXAVbxmNjD1YoPkCtzMRW8AQQb2I2VaALk8qCcUQva8/BTkRADAjH/SKmd9NOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3062 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602235146; bh=mu99BYyJrdRmlxzt+OchOgKy2e6J98+EkAVJDSLqddU=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ms-exchange-transport-forked: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:x-forefront-antispam-report: x-ms-exchange-antispam-messagedata:Content-Type: Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=EPafvOwe+oCT5qA+TQA62fgJ3kMuc2zyx3DNb1Cn++p0EHz/egRDYlqjxu9H5zJSQ e+9Y+bDRUfkNL0gKHkgv86mMVzIUuClwV/CJLh9J9ILDybyfR3QymlQZuSYtsUiex+ Fz3ImHuU12H2EfIkb0dx6XsCE46IWDlxKgqlKIu5ZZsL3Ysf54j+QDDcSeMPcHx6Pa CB3s3Hi567G2ATZzz9gWiOSW+pqMMKUvds1znTUQIcoHIL1MRmkHpWmlHrjlA+KiQV J7+rE6BJWJV5xOwCfXOJUTPNjLnHSSi0/yAiqirCNBSUkG37ZGg4u/v8vQ84HDFArM S1p5zZaivtOUQ== Subject: Re: [dpdk-dev] [PATCH v4 1/2] eal/windows: add pthread mutex lock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > Subject: [dpdk-dev] [PATCH v4 1/2] eal/windows: add pthread mutex lock >=20 > Add pthread mutex lock as it is needed for the thread safe rte_flow > functions. >=20 > Signed-off-by: Suanming Mou > Acked-by: Dmitry Kozlyuk > --- > =09 > v4: > - Add PTHREAD_MUTEX_INITIALIZER macro. >=20 > v3: > - No updates. >=20 > v2: > - Using critical section for windows pthread mutex. >=20 > --- >=20 > lib/librte_eal/windows/include/pthread.h | 35 > ++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) >=20 > diff --git a/lib/librte_eal/windows/include/pthread.h > b/lib/librte_eal/windows/include/pthread.h > index 99013dc..c62251f 100644 > --- a/lib/librte_eal/windows/include/pthread.h > +++ b/lib/librte_eal/windows/include/pthread.h > @@ -28,6 +28,12 @@ > /* defining pthread_attr_t type on Windows since there is no in Microsof= t > libc*/ typedef void *pthread_attr_t; >=20 > +typedef void *pthread_mutexattr_t; > + > +typedef CRITICAL_SECTION pthread_mutex_t; > + > +#define PTHREAD_MUTEX_INITIALIZER {(void *)-1, -1, 0, 0, 0, 0} > + > typedef SYNCHRONIZATION_BARRIER pthread_barrier_t; >=20 > #define pthread_barrier_init(barrier, attr, count) \ @@ -139,6 +145,35 @= @ > return 0; > } >=20 > +static inline int > +pthread_mutex_init(pthread_mutex_t *mutex, > + __rte_unused pthread_mutexattr_t *attr) { > + InitializeCriticalSection(mutex); > + return 0; > +} > + > +static inline int > +pthread_mutex_lock(pthread_mutex_t *mutex) { > + EnterCriticalSection(mutex); > + return 0; > +} > + > +static inline int > +pthread_mutex_unlock(pthread_mutex_t *mutex) { > + LeaveCriticalSection(mutex); > + return 0; > +} > + > +static inline int > +pthread_mutex_destroy(pthread_mutex_t *mutex) { > + DeleteCriticalSection(mutex); > + return 0; > +} > + > #ifdef __cplusplus > } > #endif > -- > 1.8.3.1 Tested-by: Tal Shnaiderman Acked-by: Tal Shnaiderman