Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9438d27a authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'nfp-FW-app-build-name-reporting'



Jakub Kicinski says:

====================
nfp: FW app build name reporting

This series adds reporting FW build name in ethtool -i.  Most
of the patches are restructuring where information caching is
done.  There is also a minor error path fix.

These are last few patches finishing the basic nfp_app support.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7fa13653 76abc0f6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <linux/slab.h>

#include "nfpcore/nfp_cpp.h"
#include "nfpcore/nfp_nffw.h"
#include "nfp_app.h"
#include "nfp_main.h"

@@ -43,6 +44,13 @@ static const struct nfp_app_type *apps[] = {
	&app_bpf,
};

const char *nfp_app_mip_name(struct nfp_app *app)
{
	if (!app || !app->pf->mip)
		return "";
	return nfp_mip_name(app->pf->mip);
}

struct sk_buff *nfp_app_ctrl_msg_alloc(struct nfp_app *app, unsigned int size)
{
	struct sk_buff *skb;
+1 −0
Original line number Diff line number Diff line
@@ -216,6 +216,7 @@ static inline void nfp_app_ctrl_rx(struct nfp_app *app, struct sk_buff *skb)
	app->type->ctrl_msg_rx(app, skb);
}

const char *nfp_app_mip_name(struct nfp_app *app);
struct sk_buff *nfp_app_ctrl_msg_alloc(struct nfp_app *app, unsigned int size);

struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id);
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ int nfp_app_nic_vnic_init(struct nfp_app *app, struct nfp_net *nn,
	if (err)
		return err < 0 ? err : 0;

	nfp_net_get_mac_addr(nn, app->cpp, id);
	nfp_net_get_mac_addr(app->pf, nn, id);

	return 0;
}
+20 −9
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ static int nfp_pcie_sriov_read_nfd_limit(struct nfp_pf *pf)
{
	int err;

	pf->limit_vfs = nfp_rtsym_read_le(pf->cpp, "nfd_vf_cfg_max_vfs", &err);
	pf->limit_vfs = nfp_rtsym_read_le(pf->rtbl, "nfd_vf_cfg_max_vfs", &err);
	if (!err)
		return pci_sriov_set_totalvfs(pf->pdev, pf->limit_vfs);

@@ -170,7 +170,7 @@ nfp_net_fw_find(struct pci_dev *pdev, struct nfp_pf *pf)
		return NULL;
	}

	fw_model = nfp_hwinfo_lookup(pf->cpp, "assembly.partno");
	fw_model = nfp_hwinfo_lookup(pf->hwinfo, "assembly.partno");
	if (!fw_model) {
		dev_err(&pdev->dev, "Error: can't read part number\n");
		return NULL;
@@ -358,21 +358,26 @@ static int nfp_pci_probe(struct pci_dev *pdev,
		goto err_disable_msix;
	}

	pf->hwinfo = nfp_hwinfo_read(pf->cpp);

	dev_info(&pdev->dev, "Assembly: %s%s%s-%s CPLD: %s\n",
		 nfp_hwinfo_lookup(pf->cpp, "assembly.vendor"),
		 nfp_hwinfo_lookup(pf->cpp, "assembly.partno"),
		 nfp_hwinfo_lookup(pf->cpp, "assembly.serial"),
		 nfp_hwinfo_lookup(pf->cpp, "assembly.revision"),
		 nfp_hwinfo_lookup(pf->cpp, "cpld.version"));
		 nfp_hwinfo_lookup(pf->hwinfo, "assembly.vendor"),
		 nfp_hwinfo_lookup(pf->hwinfo, "assembly.partno"),
		 nfp_hwinfo_lookup(pf->hwinfo, "assembly.serial"),
		 nfp_hwinfo_lookup(pf->hwinfo, "assembly.revision"),
		 nfp_hwinfo_lookup(pf->hwinfo, "cpld.version"));

	err = devlink_register(devlink, &pdev->dev);
	if (err)
		goto err_cpp_free;
		goto err_hwinfo_free;

	err = nfp_nsp_init(pdev, pf);
	if (err)
		goto err_devlink_unreg;

	pf->mip = nfp_mip_open(pf->cpp);
	pf->rtbl = __nfp_rtsym_table_read(pf->cpp, pf->mip);

	err = nfp_pcie_sriov_read_nfd_limit(pf);
	if (err)
		goto err_fw_unload;
@@ -394,13 +399,16 @@ static int nfp_pci_probe(struct pci_dev *pdev,
err_sriov_unlimit:
	pci_sriov_set_totalvfs(pf->pdev, 0);
err_fw_unload:
	kfree(pf->rtbl);
	nfp_mip_close(pf->mip);
	if (pf->fw_loaded)
		nfp_fw_unload(pf);
	kfree(pf->eth_tbl);
	kfree(pf->nspi);
err_devlink_unreg:
	devlink_unregister(devlink);
err_cpp_free:
err_hwinfo_free:
	kfree(pf->hwinfo);
	nfp_cpp_free(pf->cpp);
err_disable_msix:
	pci_set_drvdata(pdev, NULL);
@@ -430,10 +438,13 @@ static void nfp_pci_remove(struct pci_dev *pdev)

	devlink_unregister(devlink);

	kfree(pf->rtbl);
	nfp_mip_close(pf->mip);
	if (pf->fw_loaded)
		nfp_fw_unload(pf);

	pci_set_drvdata(pdev, NULL);
	kfree(pf->hwinfo);
	nfp_cpp_free(pf->cpp);

	kfree(pf->eth_tbl);
+10 −1
Original line number Diff line number Diff line
@@ -54,8 +54,11 @@ struct pci_dev;
struct nfp_cpp;
struct nfp_cpp_area;
struct nfp_eth_table;
struct nfp_hwinfo;
struct nfp_mip;
struct nfp_net;
struct nfp_nsp_identify;
struct nfp_rtsym_table;

/**
 * struct nfp_pf - NFP PF-specific device structure
@@ -70,6 +73,9 @@ struct nfp_nsp_identify;
 * @num_vfs:		Number of SR-IOV VFs enabled
 * @fw_loaded:		Is the firmware loaded?
 * @ctrl_vnic:		Pointer to the control vNIC if available
 * @mip:		MIP handle
 * @rtbl:		RTsym table
 * @hwinfo:		HWInfo table
 * @eth_tbl:		NSP ETH table
 * @nspi:		NSP identification info
 * @hwmon_dev:		pointer to hwmon device
@@ -101,6 +107,9 @@ struct nfp_pf {

	struct nfp_net *ctrl_vnic;

	const struct nfp_mip *mip;
	struct nfp_rtsym_table *rtbl;
	struct nfp_hwinfo *hwinfo;
	struct nfp_eth_table *eth_tbl;
	struct nfp_nsp_identify *nspi;

@@ -130,7 +139,7 @@ void nfp_hwmon_unregister(struct nfp_pf *pf);
struct nfp_eth_table_port *
nfp_net_find_port(struct nfp_eth_table *eth_tbl, unsigned int id);
void
nfp_net_get_mac_addr(struct nfp_net *nn, struct nfp_cpp *cpp, unsigned int id);
nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id);

bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb);

Loading