Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/tnguy/next-queue

Tony Nguyen says:

====================
ice: support devlink subfunction

Michal Swiatkowski says:

Currently ice driver does not allow creating more than one networking
device per physical function. The only way to have more hardware backed
netdev is to use SR-IOV.

Following patchset adds support for devlink port API. For each new
pcisf type port, driver allocates new VSI, configures all resources
needed, including dynamically MSIX vectors, program rules and registers
new netdev.

This series supports only one Tx/Rx queue pair per subfunction.

Example commands:
devlink port add pci/0000:31:00.1 flavour pcisf pfnum 1 sfnum 1000
devlink port function set pci/0000:31:00.1/1 hw_addr 00:00:00:00:03:14
devlink port function set pci/0000:31:00.1/1 state active
devlink port function del pci/0000:31:00.1/1

Make the port representor and eswitch code generic to support
subfunction representor type.

VSI configuration is slightly different between VF and SF. It needs to
be reflected in the code.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: subfunction activation and base devlink ops
  ice: basic support for VLAN in subfunctions
  ice: support subfunction devlink Tx topology
  ice: implement netdevice ops for SF representor
  ice: check if SF is ready in ethtool ops
  ice: don't set target VSI for subfunction
  ice: create port representor for SF
  ice: make representor code generic
  ice: implement netdev for subfunction
  ice: base subfunction aux driver
  ice: allocate devlink for subfunction
  ice: treat subfunction VSI the same as PF VSI
  ice: add basic devlink subfunctions support
  ice: export ice ndo_ops functions
  ice: add new VSI type for subfunctions
====================

Link: https://patch.msgid.link/20240906223010.2194591-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Sep 11, 2024
2 parents 474bb1a + 13acc5c commit f3b6129
Show file tree
Hide file tree
Showing 26 changed files with 1,394 additions and 135 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ ice-y := ice_main.o \
ice_idc.o \
devlink/devlink.o \
devlink/devlink_port.o \
ice_sf_eth.o \
ice_sf_vsi_vlan_ops.o \
ice_ddp.o \
ice_fw_update.o \
ice_lag.o \
Expand Down
46 changes: 46 additions & 0 deletions drivers/net/ethernet/intel/ice/devlink/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
#include "ice.h"
#include "ice_lib.h"
#include "devlink.h"
#include "devlink_port.h"
#include "ice_eswitch.h"
#include "ice_fw_update.h"
#include "ice_dcb_lib.h"
#include "ice_sf_eth.h"

/* context for devlink info version reporting */
struct ice_info_ctx {
Expand Down Expand Up @@ -744,6 +746,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
struct ice_sched_node *tc_node, struct ice_pf *pf)
{
struct devlink_rate *rate_node = NULL;
struct ice_dynamic_port *sf;
struct ice_vf *vf;
int i;

Expand All @@ -755,6 +758,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
/* create root node */
rate_node = devl_rate_node_create(devlink, node, node->name, NULL);
} else if (node->vsi_handle &&
pf->vsi[node->vsi_handle]->type == ICE_VSI_VF &&
pf->vsi[node->vsi_handle]->vf) {
vf = pf->vsi[node->vsi_handle]->vf;
if (!vf->devlink_port.devlink_rate)
Expand All @@ -763,6 +767,16 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
*/
devl_rate_leaf_create(&vf->devlink_port, node,
node->parent->rate_node);
} else if (node->vsi_handle &&
pf->vsi[node->vsi_handle]->type == ICE_VSI_SF &&
pf->vsi[node->vsi_handle]->sf) {
sf = pf->vsi[node->vsi_handle]->sf;
if (!sf->devlink_port.devlink_rate)
/* leaf nodes doesn't have children
* so we don't set rate_node
*/
devl_rate_leaf_create(&sf->devlink_port, node,
node->parent->rate_node);
} else if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF &&
node->parent->rate_node) {
rate_node = devl_rate_node_create(devlink, node, node->name,
Expand Down Expand Up @@ -1277,8 +1291,12 @@ static const struct devlink_ops ice_devlink_ops = {

.rate_leaf_parent_set = ice_devlink_set_parent,
.rate_node_parent_set = ice_devlink_set_parent,

.port_new = ice_devlink_port_new,
};

static const struct devlink_ops ice_sf_devlink_ops;

static int
ice_devlink_enable_roce_get(struct devlink *devlink, u32 id,
struct devlink_param_gset_ctx *ctx)
Expand Down Expand Up @@ -1561,6 +1579,34 @@ struct ice_pf *ice_allocate_pf(struct device *dev)
return devlink_priv(devlink);
}

/**
* ice_allocate_sf - Allocate devlink and return SF structure pointer
* @dev: the device to allocate for
* @pf: pointer to the PF structure
*
* Allocate a devlink instance for SF.
*
* Return: ice_sf_priv pointer to allocated memory or ERR_PTR in case of error
*/
struct ice_sf_priv *ice_allocate_sf(struct device *dev, struct ice_pf *pf)
{
struct devlink *devlink;
int err;

devlink = devlink_alloc(&ice_sf_devlink_ops, sizeof(struct ice_sf_priv),
dev);
if (!devlink)
return ERR_PTR(-ENOMEM);

err = devl_nested_devlink_set(priv_to_devlink(pf), devlink);
if (err) {
devlink_free(devlink);
return ERR_PTR(err);
}

return devlink_priv(devlink);
}

/**
* ice_devlink_register - Register devlink interface for this PF
* @pf: the PF to register the devlink for.
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ice/devlink/devlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define _ICE_DEVLINK_H_

struct ice_pf *ice_allocate_pf(struct device *dev);
struct ice_sf_priv *ice_allocate_sf(struct device *dev, struct ice_pf *pf);

void ice_devlink_register(struct ice_pf *pf);
void ice_devlink_unregister(struct ice_pf *pf);
Expand Down
Loading

0 comments on commit f3b6129

Please sign in to comment.