Skip to content

Commit f3b6129

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 474bb1a + 13acc5c commit f3b6129

26 files changed

+1394
-135
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ ice-y := ice_main.o \
3333
ice_idc.o \
3434
devlink/devlink.o \
3535
devlink/devlink_port.o \
36+
ice_sf_eth.o \
37+
ice_sf_vsi_vlan_ops.o \
3638
ice_ddp.o \
3739
ice_fw_update.o \
3840
ice_lag.o \

drivers/net/ethernet/intel/ice/devlink/devlink.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
#include "ice.h"
77
#include "ice_lib.h"
88
#include "devlink.h"
9+
#include "devlink_port.h"
910
#include "ice_eswitch.h"
1011
#include "ice_fw_update.h"
1112
#include "ice_dcb_lib.h"
13+
#include "ice_sf_eth.h"
1214

1315
/* context for devlink info version reporting */
1416
struct ice_info_ctx {
@@ -744,6 +746,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
744746
struct ice_sched_node *tc_node, struct ice_pf *pf)
745747
{
746748
struct devlink_rate *rate_node = NULL;
749+
struct ice_dynamic_port *sf;
747750
struct ice_vf *vf;
748751
int i;
749752

@@ -755,6 +758,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
755758
/* create root node */
756759
rate_node = devl_rate_node_create(devlink, node, node->name, NULL);
757760
} else if (node->vsi_handle &&
761+
pf->vsi[node->vsi_handle]->type == ICE_VSI_VF &&
758762
pf->vsi[node->vsi_handle]->vf) {
759763
vf = pf->vsi[node->vsi_handle]->vf;
760764
if (!vf->devlink_port.devlink_rate)
@@ -763,6 +767,16 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
763767
*/
764768
devl_rate_leaf_create(&vf->devlink_port, node,
765769
node->parent->rate_node);
770+
} else if (node->vsi_handle &&
771+
pf->vsi[node->vsi_handle]->type == ICE_VSI_SF &&
772+
pf->vsi[node->vsi_handle]->sf) {
773+
sf = pf->vsi[node->vsi_handle]->sf;
774+
if (!sf->devlink_port.devlink_rate)
775+
/* leaf nodes doesn't have children
776+
* so we don't set rate_node
777+
*/
778+
devl_rate_leaf_create(&sf->devlink_port, node,
779+
node->parent->rate_node);
766780
} else if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF &&
767781
node->parent->rate_node) {
768782
rate_node = devl_rate_node_create(devlink, node, node->name,
@@ -1277,8 +1291,12 @@ static const struct devlink_ops ice_devlink_ops = {
12771291

12781292
.rate_leaf_parent_set = ice_devlink_set_parent,
12791293
.rate_node_parent_set = ice_devlink_set_parent,
1294+
1295+
.port_new = ice_devlink_port_new,
12801296
};
12811297

1298+
static const struct devlink_ops ice_sf_devlink_ops;
1299+
12821300
static int
12831301
ice_devlink_enable_roce_get(struct devlink *devlink, u32 id,
12841302
struct devlink_param_gset_ctx *ctx)
@@ -1561,6 +1579,34 @@ struct ice_pf *ice_allocate_pf(struct device *dev)
15611579
return devlink_priv(devlink);
15621580
}
15631581

1582+
/**
1583+
* ice_allocate_sf - Allocate devlink and return SF structure pointer
1584+
* @dev: the device to allocate for
1585+
* @pf: pointer to the PF structure
1586+
*
1587+
* Allocate a devlink instance for SF.
1588+
*
1589+
* Return: ice_sf_priv pointer to allocated memory or ERR_PTR in case of error
1590+
*/
1591+
struct ice_sf_priv *ice_allocate_sf(struct device *dev, struct ice_pf *pf)
1592+
{
1593+
struct devlink *devlink;
1594+
int err;
1595+
1596+
devlink = devlink_alloc(&ice_sf_devlink_ops, sizeof(struct ice_sf_priv),
1597+
dev);
1598+
if (!devlink)
1599+
return ERR_PTR(-ENOMEM);
1600+
1601+
err = devl_nested_devlink_set(priv_to_devlink(pf), devlink);
1602+
if (err) {
1603+
devlink_free(devlink);
1604+
return ERR_PTR(err);
1605+
}
1606+
1607+
return devlink_priv(devlink);
1608+
}
1609+
15641610
/**
15651611
* ice_devlink_register - Register devlink interface for this PF
15661612
* @pf: the PF to register the devlink for.

drivers/net/ethernet/intel/ice/devlink/devlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define _ICE_DEVLINK_H_
66

77
struct ice_pf *ice_allocate_pf(struct device *dev);
8+
struct ice_sf_priv *ice_allocate_sf(struct device *dev, struct ice_pf *pf);
89

910
void ice_devlink_register(struct ice_pf *pf);
1011
void ice_devlink_unregister(struct ice_pf *pf);

0 commit comments

Comments
 (0)