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 CFB9545BF4; Sun, 27 Oct 2024 17:59:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E57C402F1; Sun, 27 Oct 2024 17:59:40 +0100 (CET) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id 2C277402E4 for ; Sun, 27 Oct 2024 17:59:35 +0100 (CET) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2e56750bb0dso2540916a91.0 for ; Sun, 27 Oct 2024 09:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1730048374; x=1730653174; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=d9CaDNKEqnNCaHW/VApXBcDP0p/oqIYNQPbTrLoJ4Hs=; b=d5hvx5Og72eo2WtTBvAHqYlxMQzzCLhW38r+oeZq+ykNy5RUCsyNSKZvkVnsA7l/3i BR06xzLEJ3joO9xAo+hedP6PAHenrht9n9ZxPetHyZ3G+SJmUQx5CQ+7YbuniD9hCsyl aqKLxXc/66nG3lC3zNvGBp5VfsTzUiefBzzsTpodNdEAg5RMy3F5GiyqSBFGeAWLczP7 BvadOSRdTgO+jNmcJfjxpUhyiWywHqX6UCzObsw8YZ52Dn9mogwHRqvOtbFNGjpsXQB4 nKoDmJrqacTWvsgRnqt3REIBh7xuZdoOny5oLZITB+MIV6OPUBHQ7IRVNS8Ua1o2PWDL VQww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730048374; x=1730653174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d9CaDNKEqnNCaHW/VApXBcDP0p/oqIYNQPbTrLoJ4Hs=; b=Qh1GxRw5efssh7ZPkfn1W80oxBdr+3yb99aJC9JUZSPRWPXKWIlqob0+tSz45gwxTf +eOq3v3ZuD19E3mGZ3rVzdlU0H2sBurCKo+z+2GWxaspvjLbga16uZbPV7LQm28+ZzI8 f5+uEFQnJ6fI5liFFMiTD0LVwF4BVk5WxDWUCVodlfhM2F1YVje33whcspasldlogVhj fAJnf9UkXfMm+HqVtWFF5HVZr82EP7vQQmPUTSgB1R/LMJtOjMhYoB6T9UyVH/SYFJ9R OnxGLDRs0hWeCA/il8oW6eR4GPILdZb4y2lG2JGNEu85ZAoVSd9djBFwj3LnJ1l9io9A TJxw== X-Gm-Message-State: AOJu0YxvbMwLLHtp7yD3wjdIDUnu/UIAjoEf5ywd3Tf1YzbqveZNKld5 8a7sjl6PL7ST9QcoOYafpn2h0IklBBBf/INKzcJNFJrJzeb4oo1bKzyAsh6pBBk= X-Google-Smtp-Source: AGHT+IHCKYLzNxoTZ9lpid1SlMid/aPXcXbBAlqg2zv8OLXwdpZO8yGrCgwSqVRYXErnLW/qBhUHJQ== X-Received: by 2002:a17:90a:2c44:b0:2e2:e2f8:104 with SMTP id 98e67ed59e1d1-2e8f0f53d46mr6842320a91.8.1730048374258; Sun, 27 Oct 2024 09:59:34 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e77e4c7076sm7435157a91.16.2024.10.27.09.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 09:59:34 -0700 (PDT) Date: Sun, 27 Oct 2024 09:40:48 -0700 From: Stephen Hemminger To: Junlong Wang Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@amd.com, wang.yong19@zte.com.cn Subject: Re: [PATCH v7 9/9] net/zxdh: add zxdh dev configure ops Message-ID: <20241027094048.2ed2f342@hermes.local> In-Reply-To: <20241022122042.2127065-10-wang.junlong1@zte.com.cn> References: <20241016081647.1808333-2-wang.junlong1@zte.com.cn> <20241022122042.2127065-1-wang.junlong1@zte.com.cn> <20241022122042.2127065-10-wang.junlong1@zte.com.cn> 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 Tue, 22 Oct 2024 20:20:42 +0800 Junlong Wang wrote: > +int32_t zxdh_acquire_lock(struct zxdh_hw *hw) > +{ > + uint32_t var = zxdh_read_comm_reg((uint64_t)hw->common_cfg, ZXDH_VF_LOCK_REG); > + > + /* check whether lock is used */ > + if (!(var & ZXDH_VF_LOCK_ENABLE_MASK)) > + return -1; > + > + return 0; > +} > + > +int32_t zxdh_release_lock(struct zxdh_hw *hw) > +{ > + uint32_t var = zxdh_read_comm_reg((uint64_t)hw->common_cfg, ZXDH_VF_LOCK_REG); > + > + if (var & ZXDH_VF_LOCK_ENABLE_MASK) { > + var &= ~ZXDH_VF_LOCK_ENABLE_MASK; > + zxdh_write_comm_reg((uint64_t)hw->common_cfg, ZXDH_VF_LOCK_REG, var); > + return 0; > + } > + > + return -1; > +} > + It is your driver, so you are free to name functions as appropriate. But it would make more sense to make the hardware lock follow the pattern of existing spinlock's etc.