From: Jakub Kicinski <kuba@kernel.org>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: andrew.gospodarek@broadcom.com, davem@davemloft.net,
edumazet@google.com, jgg@ziepe.ca, leon@kernel.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
michael.chan@broadcom.com, netdev@vger.kernel.org,
pabeni@redhat.com, selvin.xavier@broadcom.com,
Leon Romanovsky <leonro@nvidia.com>
Subject: Re: [PATCH net-next v7 1/8] bnxt_en: Add auxiliary driver support
Date: Fri, 13 Jan 2023 22:10:42 -0800 [thread overview]
Message-ID: <20230113221042.5d24bdde@kernel.org> (raw)
In-Reply-To: <20230112202939.19562-2-ajit.khaparde@broadcom.com>
On Thu, 12 Jan 2023 12:29:32 -0800 Ajit Khaparde wrote:
> Add auxiliary driver support.
> An auxiliary device will be created if the hardware indicates
> support for RDMA.
> The bnxt_ulp_probe() function has been removed and a new
> bnxt_rdma_aux_device_add() function has been added.
> The bnxt_free_msix_vecs() and bnxt_req_msix_vecs() will now hold
> the RTNL lock when they call the bnxt_close_nic()and bnxt_open_nic()
> since the device close and open need to be protected under RTNL lock.
> The operations between the bnxt_en and bnxt_re will be protected
> using the en_ops_lock.
> This will be used by the bnxt_re driver in a follow-on patch
> to create ROCE interfaces.
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -13178,6 +13178,9 @@ static void bnxt_remove_one(struct pci_dev *pdev)
> struct net_device *dev = pci_get_drvdata(pdev);
> struct bnxt *bp = netdev_priv(dev);
>
> + bnxt_rdma_aux_device_uninit(bp);
> + bnxt_aux_dev_free(bp);
You still free bp->aux_dev synchronously..
> +void bnxt_aux_dev_free(struct bnxt *bp)
> +{
> + kfree(bp->aux_dev);
.. here. Which is called on .remove of the PCI device.
> + bp->aux_dev = NULL;
> +}
> +
> +static struct bnxt_aux_dev *bnxt_aux_dev_alloc(struct bnxt *bp)
> +{
> + return kzalloc(sizeof(struct bnxt_aux_dev), GFP_KERNEL);
> +}
> +
> +void bnxt_rdma_aux_device_uninit(struct bnxt *bp)
> +{
> + struct bnxt_aux_dev *bnxt_adev;
> + struct auxiliary_device *adev;
> +
> + /* Skip if no auxiliary device init was done. */
> + if (!(bp->flags & BNXT_FLAG_ROCE_CAP))
> + return;
> +
> + bnxt_adev = bp->aux_dev;
> + adev = &bnxt_adev->aux_dev;
> + auxiliary_device_delete(adev);
> + auxiliary_device_uninit(adev);
> + if (bnxt_adev->id >= 0)
> + ida_free(&bnxt_aux_dev_ids, bnxt_adev->id);
> +}
> +
> +static void bnxt_aux_dev_release(struct device *dev)
> +{
> + struct bnxt_aux_dev *bnxt_adev =
> + container_of(dev, struct bnxt_aux_dev, aux_dev.dev);
> + struct bnxt *bp = netdev_priv(bnxt_adev->edev->net);
> +
> + bnxt_adev->edev->en_ops = NULL;
> + kfree(bnxt_adev->edev);
And yet the reference counted "release" function accesses the bp->adev
like it must exist.
This seems odd to me - why do we need refcounting on devices at all
if we can free them synchronously? To be clear - I'm not sure this is
wrong, just seems odd.
> + bnxt_adev->edev = NULL;
> + bp->edev = NULL;
> +}
next prev parent reply other threads:[~2023-01-14 6:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 20:29 [PATCH net-next v7 0/8] Add Auxiliary driver support Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 1/8] bnxt_en: Add auxiliary " Ajit Khaparde
2023-01-14 6:10 ` Jakub Kicinski [this message]
2023-01-14 20:39 ` Ajit Khaparde
2023-01-17 4:56 ` Jakub Kicinski
2023-01-17 12:31 ` Leon Romanovsky
2023-01-17 17:18 ` Leon Romanovsky
2023-01-17 19:33 ` Ajit Khaparde
2023-01-18 6:32 ` Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 2/8] RDMA/bnxt_re: Use auxiliary driver interface Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 3/8] bnxt_en: Remove usage of ulp_id Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 4/8] bnxt_en: Use direct API instead of indirection Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 5/8] bnxt_en: Use auxiliary bus calls over proprietary calls Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 6/8] bnxt_en: Remove struct bnxt access from RoCE driver Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 7/8] RDMA/bnxt_re: Remove the sriov config callback Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 8/8] bnxt_en: Remove runtime interrupt vector allocation Ajit Khaparde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230113221042.5d24bdde@kernel.org \
--to=kuba@kernel.org \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=selvin.xavier@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).