Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3956846iob; Tue, 17 May 2022 10:39:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZxOBmCi0Wu17rgHk41cGYyeLhI0popcj4gH99HRwA18JUY1lkWYUo3Q0U4HsIGJuhsE9P X-Received: by 2002:a17:906:6bd7:b0:6f4:e6e4:1d41 with SMTP id t23-20020a1709066bd700b006f4e6e41d41mr21163635ejs.770.1652809192139; Tue, 17 May 2022 10:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652809192; cv=none; d=google.com; s=arc-20160816; b=DSeUjt/WHl15yMtkRfuJqtFEdKE8m50W5tdzXuDG+BcgP+lIzHS0aReLJtdROEzH4i /4inRIx5jwxgSwsthvF0RqB5mavFbzVyaClnmucHVHxbSDyPuq9SL6KEG5pgfR/3QgHM LgRPN7Kl9A3DC3Tjg1k5q1NOuFHadRNh4L/owfK/oTkfDp89SsCk4bJYhGLuYccAKNca Jf6d35PIz/xcSScDQsNxsU7QZPzJiWj+PGXIbPeW84zUBRs9jikG0IBVinmJZ0zDthDA n261a/jDcgggyx8p66H3pBsQRlo+sV8grVpio4bzjkXau+kWztHL/daicdNp/G6r/JME 6LSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NtCVu5kwlt/0GeeCJHb+/bnS0itYTikVVYx8LL9uX0w=; b=LbpxXPQsw1RAarfHr3s9XSxUQC7a1MqqNw666oO14CvB1yi7adlAmpu9p7kB2vXAg+ jkwEZZ6uDgbaOKuNsgUB0r3mTagX6zQRAm5pIO7/g/CmJHunc6V0T0wM0SDROKxYxYkx fNbeUgepTW1yx1jqy12Bry502NcnJibwBhdDMpKx0I2TJMihpQQF5DVdj11xk7evA66e Br8cw5rQCU/NfaHgsYSEQIHO1eHz/tEMDUHINStCpTofCf0DG2V0jWAJ70QjtELm3VE4 OXbaw7ZnlPyYP7q8/htDwqBck1VtULYfwo5m3mnfkiZ4MFO2SZZWGyC4YjLQ9IhS9FXa a0yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=3RKQV6ts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a170906505200b006f504076c29si3177641ejk.688.2022.05.17.10.39.25; Tue, 17 May 2022 10:39:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=3RKQV6ts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349793AbiEQPTZ (ORCPT + 99 others); Tue, 17 May 2022 11:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349759AbiEQPTX (ORCPT ); Tue, 17 May 2022 11:19:23 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99383B579 for ; Tue, 17 May 2022 08:19:22 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso2560405pjg.0 for ; Tue, 17 May 2022 08:19:22 -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=NtCVu5kwlt/0GeeCJHb+/bnS0itYTikVVYx8LL9uX0w=; b=3RKQV6tsbyrmUfidQNrHgRSDxahUsw5KwHXeTnnuzXwmOO18WyoB6EVhZRXSLdFM4j zhKtx7nP76meXVYhp6sQx/QMcfYgtsiaFpTnDO86tdqLDdvxA0bCTrmjvlmZISP5TF74 M6vIq8BT7levvC+TleV3x9XzZHcvBWx4E8V7E++SXUVQvSk+20pqNJeTU26CVDOe65Lm eKfT6swZRtxVqSSk5TDWZTCof+IXc0eiwsclaJWZ7VOyBUUwUZIvNxx6DzGSBUGog4O1 E93CV0Ocu5nWcuXRgZrxWu8sGpGTGuj0ygKK7NO9RR02tXT8ctEw8u+Sr1h1ovusMGW4 55Tw== 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=NtCVu5kwlt/0GeeCJHb+/bnS0itYTikVVYx8LL9uX0w=; b=LPJrOQegaO6kU6xH2ru8e08ud3fujGSyxSrV/9TRRRmMgFYBWDc70tWIJW8YR+21j/ 6ycFMUyJAG+wzq0BnfKm09P5Hrb1a8UdbAZtTKVCJxvGNSfz44mD8jPuXP4nKhg9O9Ug X7Hrd/1uwyVCaj6cpN6PKsr3QEQdrebQAn6+GCPsXCGodVxi0UUp1eZUhnZvnwJ+3EQX S+O3tMAc5U4utd9j2sw7krk2z8uwL1+RPixgtEZPCMF+wd0tFq/ClPGp0F7AhvoDFUJo ER6kBwJuFXMeZaIinIC/kv92lp0MmrujDu8EHrDe/Nk7Q3dTab1NzYRj9i3i68ChX8co rx8A== X-Gm-Message-State: AOAM530UFmVKyVIqLswr/lPqdRM1ffJcYkWinL5wpOgBr+GK4BmnAT2J +1vi7AhHafphRaj7GBwRozaflw== X-Received: by 2002:a17:903:248:b0:155:e660:b774 with SMTP id j8-20020a170903024800b00155e660b774mr22794133plh.174.1652800762271; Tue, 17 May 2022 08:19:22 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id z11-20020a1709027e8b00b0016144a84c31sm7127822pla.119.2022.05.17.08.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 08:19:21 -0700 (PDT) Date: Tue, 17 May 2022 08:19:18 -0700 From: Stephen Hemminger To: longli@linuxonhyperv.com Cc: longli@microsoft.com, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Jason Gunthorpe , Leon Romanovsky , linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH 03/12] net: mana: Handle vport sharing between devices Message-ID: <20220517081918.655fe626@hermes.local> In-Reply-To: <1652778276-2986-4-git-send-email-longli@linuxonhyperv.com> References: <1652778276-2986-1-git-send-email-longli@linuxonhyperv.com> <1652778276-2986-4-git-send-email-longli@linuxonhyperv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 May 2022 02:04:27 -0700 longli@linuxonhyperv.com wrote: > diff --git a/drivers/net/ethernet/microsoft/mana/mana.h b/drivers/net/ethernet/microsoft/mana/mana.h > index 51bff91b63ee..26f14fcb6a61 100644 > --- a/drivers/net/ethernet/microsoft/mana/mana.h > +++ b/drivers/net/ethernet/microsoft/mana/mana.h > @@ -375,6 +375,7 @@ struct mana_port_context { > unsigned int num_queues; > > mana_handle_t port_handle; > + atomic_t port_use_count; Could this be a refcount_t instead? The refcount_t has protections against under/overflow.