lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230325163952.0eb18d3b@kernel.org>
Date:   Sat, 25 Mar 2023 16:39:52 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Shannon Nelson <shannon.nelson@....com>
Cc:     <brett.creeley@....com>, <davem@...emloft.net>,
        <netdev@...r.kernel.org>, <drivers@...sando.io>, <leon@...nel.org>,
        <jiri@...nulli.us>
Subject: Re: [PATCH v6 net-next 01/14] pds_core: initial framework for
 pds_core PF driver

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ