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 83818A0542; Mon, 6 Jun 2022 17:38:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 214DC4069C; Mon, 6 Jun 2022 17:38:26 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 780784021E for ; Mon, 6 Jun 2022 17:38:25 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d22so12377249plr.9 for ; Mon, 06 Jun 2022 08:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/5TnI7QKXbEEdspDB2TS3h7vXKZF4ckZ9v91QOS0Kfk=; b=gi+LZjy0fswK5icI1xpAmI3TJVOcybbf9YsmmBqzyYaGDAIk2LRucFPYZ8EIlaTx0h kq034JzhFzIbBLLWvXCO33XFKNbgKMbW918wee6Yr/F9/dccai7VRH6nevJdNi7tJP+v A9UENlU9vkzvo2xAHFUy3lOyP1UJP477ydBGoDaqYXwYEOPhyv0niuNs2L4ZuBR7lMYq TcTK431r5+1xCUUd8eFYkqUtzxaugQSymsg0VoK904HJCisTy95iDjyHfADVfztyqmyF 3SAiVyOPpPfSTfNn69mvfZ/UzAirnntDtw7a1kCrU5EBJ+4iIroOILnzgE07apHJbmTX PBAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/5TnI7QKXbEEdspDB2TS3h7vXKZF4ckZ9v91QOS0Kfk=; b=Hncgb9ki1VyPQUyfE+ddiopwO8czQxNJ1Hb2q7bztcFc/K+Ox5s58c3ypREJqhbOon A4NGmJcyQ/ijDxQv+N2kk6LxUzfEbEMWy1Z3W5AuDHgqX1okqA5Tt5/CzHvG5/lqiJQj fbbEE+4aythBjlcu9ykQGpR7amsXI55yB1AcMVt6gV/0oJb0rxzI4I/KcPYKg6sOGdBv Af2lUO3KmwkBAcWMGdPON23/66OdZRBZmXNPdilyNNt26U4eP5zHU7JHljR03nm2rCb5 WZFGU1f/rvM963I8SMsMAyT0a6aF6jlW1jPgXDZa8JD1vVl1fDjSUUBl5+X20Kc0wqhR W/yA== X-Gm-Message-State: AOAM533vQsWl34k2c3hDnbAt04Kp9G8+iUbMsRqhgEkrLcuxB/liaROp WRRWd3SLGd3CnZJYa7/FVAQSjQ== X-Google-Smtp-Source: ABdhPJw022Y3/eae3OhpXvWmQqqtVd/KeCZzCf9MjToNEX6eVN6/ChLOwQoEitxo8ung3UcOmZf2Zw== X-Received: by 2002:a17:902:9f96:b0:163:dc33:6b72 with SMTP id g22-20020a1709029f9600b00163dc336b72mr25008271plq.34.1654529904537; Mon, 06 Jun 2022 08:38:24 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id e63-20020a621e42000000b0051bbb661782sm10133625pfe.192.2022.06.06.08.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:38:24 -0700 (PDT) Date: Mon, 6 Jun 2022 08:38:21 -0700 From: Stephen Hemminger To: Wei Huang Cc: dev@dpdk.org, thomas@monjalon.net, nipun.gupta@nxp.com, hemant.agrawal@nxp.com, stable@dpdk.org, rosen.xu@intel.com, tianfei.zhang@intel.com, qi.z.zhang@intel.com Subject: Re: [PATCH v5 1/5] drivers/raw: introduce AFU raw device driver Message-ID: <20220606083821.5c8903b3@hermes.local> In-Reply-To: <1653629824-4535-2-git-send-email-wei.huang@intel.com> References: <1652939560-15786-1-git-send-email-wei.huang@intel.com> <1653629824-4535-1-git-send-email-wei.huang@intel.com> <1653629824-4535-2-git-send-email-wei.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Fri, 27 May 2022 01:37:00 -0400 Wei Huang wrote: > +static inline int afu_mf_trylock(struct afu_mf_rawdev *dev) > +{ > + int32_t x = 0; > + > + if (!dev || !dev->shared) > + return -ENODEV; > + > + x = __atomic_load_n(&dev->shared->lock, __ATOMIC_RELAXED); > + > + if ((x != 0) || (__atomic_compare_exchange_n(&dev->shared->lock, &x, 1, > + 1, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED) == 0)) > + return -EBUSY; > + > + return 0; > +} > + > +static inline void afu_mf_unlock(struct afu_mf_rawdev *dev) > +{ > + if (!dev || !dev->shared) > + return; > + > + __atomic_store_n(&dev->shared->lock, 0, __ATOMIC_RELEASE); > +} What other subsystem is this shared with? Is there a good reason it can't just use existing spinlock?