public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel•org>
To: Shannon Nelson <shannon.nelson@amd•com>
Cc: <brett.creeley@amd•com>, <davem@davemloft•net>,
	<netdev@vger•kernel.org>, <drivers@pensando•io>,
	<leon@kernel•org>, <jiri@resnulli•us>
Subject: Re: [PATCH v6 net-next 01/14] pds_core: initial framework for pds_core PF driver
Date: Sat, 25 Mar 2023 16:39:52 -0700	[thread overview]
Message-ID: <20230325163952.0eb18d3b@kernel.org> (raw)
In-Reply-To: <20230324190243.27722-2-shannon.nelson@amd.com>

On Fri, 24 Mar 2023 12:02:30 -0700 Shannon Nelson wrote:
> This is the initial PCI driver framework for the new pds_core device
> driver and its family of devices.  This does the very basics of
> registering for the new PF PCI device 1dd8:100c, setting up debugfs
> entries, and registering with devlink.

> +	debugfs_create_file("state", 0400, pdsc->dentry,
> +			    pdsc, &core_state_fops);

debugfs_create_ulong() ?

> diff --git a/drivers/net/ethernet/amd/pds_core/devlink.c b/drivers/net/ethernet/amd/pds_core/devlink.c
> new file mode 100644
> index 000000000000..a9021bfe680a
> --- /dev/null
> +++ b/drivers/net/ethernet/amd/pds_core/devlink.c
> @@ -0,0 +1,51 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright(c) 2023 Advanced Micro Devices, Inc */
> +
> +#include <linux/kernel.h>
> +#include <linux/types.h>
> +#include <linux/errno.h>
> +#include <linux/pci.h>
> +
> +#include "core.h"
> +
> +static const struct devlink_ops pdsc_dl_ops = {
> +};
> +
> +static const struct devlink_ops pdsc_dl_vf_ops = {
> +};
> +
> +struct pdsc *pdsc_dl_alloc(struct device *dev, bool is_pf)
> +{
> +	const struct devlink_ops *ops;
> +	struct devlink *dl;
> +
> +	ops = is_pf ? &pdsc_dl_ops : &pdsc_dl_vf_ops;
> +	dl = devlink_alloc(ops, sizeof(struct pdsc), dev);
> +	if (!dl)
> +		return NULL;
> +
> +	return devlink_priv(dl);
> +}
> +
> +void pdsc_dl_free(struct pdsc *pdsc)
> +{
> +	struct devlink *dl = priv_to_devlink(pdsc);
> +
> +	devlink_free(dl);
> +}
> +
> +int pdsc_dl_register(struct pdsc *pdsc)
> +{
> +	struct devlink *dl = priv_to_devlink(pdsc);
> +
> +	devlink_register(dl);
> +
> +	return 0;
> +}
> +
> +void pdsc_dl_unregister(struct pdsc *pdsc)
> +{
> +	struct devlink *dl = priv_to_devlink(pdsc);
> +
> +	devlink_unregister(dl);

Don't put core devlink functionality in a separate file.
You're not wrapping all pci_* calls in your own wrappers, why are you
wrapping delvink? And use explicit locking, please. devl_* APIs.

  reply	other threads:[~2023-03-25 23:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 19:02 [PATCH v6 net-next 00/14] pds_core driver Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 01/14] pds_core: initial framework for pds_core PF driver Shannon Nelson
2023-03-25 23:39   ` Jakub Kicinski [this message]
2023-03-26  4:07     ` Shannon Nelson
2023-03-28  0:43       ` Jakub Kicinski
2023-03-28  6:19         ` Shannon Nelson
2023-03-28 22:17           ` Jakub Kicinski
2023-03-29 20:53             ` Shannon Nelson
2023-03-30  2:27               ` Jakub Kicinski
2023-03-30  7:02                 ` Leon Romanovsky
2023-03-30  7:43                 ` Shannon Nelson
2023-03-30 16:46                   ` Jakub Kicinski
2023-03-24 19:02 ` [PATCH v6 net-next 02/14] pds_core: add devcmd device interfaces Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 03/14] pds_core: health timer and workqueue Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 04/14] pds_core: add devlink health facilities Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 05/14] pds_core: set up device and adminq Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 06/14] pds_core: Add adminq processing and commands Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 07/14] pds_core: add FW update feature to devlink Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 08/14] pds_core: set up the VIF definitions and defaults Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 09/14] pds_core: add initial VF device handling Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 10/14] pds_core: add auxiliary_bus devices Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 11/14] pds_core: devlink params for enabling VIF support Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 12/14] pds_core: add the aux client API Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 13/14] pds_core: publish events to the clients Shannon Nelson
2023-03-24 19:02 ` [PATCH v6 net-next 14/14] pds_core: Kconfig and pds_core.rst Shannon Nelson
2023-03-25 20:40   ` kernel test robot

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=20230325163952.0eb18d3b@kernel.org \
    --to=kuba@kernel$(echo .)org \
    --cc=brett.creeley@amd$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=drivers@pensando$(echo .)io \
    --cc=jiri@resnulli$(echo .)us \
    --cc=leon@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=shannon.nelson@amd$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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