Commit 2951868e authored by Ryan C Goodfellow's avatar Ryan C Goodfellow Committed by Greg Kroah-Hartman

nfp: devlink port split support for 1x100G CXP NIC

[ Upstream commit 5948185b ]

This commit makes it possible to use devlink to split the 100G CXP
Netronome into two 40G interfaces. Currently when you ask for 2
interfaces, the math in src/nfp_devlink.c:nfp_devlink_port_split
calculates that you want 5 lanes per port because for some reason
eth_port.port_lanes=10 (shouldn't this be 12 for CXP?). What we really
want when asking for 2 breakout interfaces is 4 lanes per port. This
commit makes that happen by calculating based on 8 lanes if 10 are
present.
Signed-off-by: default avatarRyan C Goodfellow <rgoodfel@isi.edu>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarGreg Weeks <greg.weeks@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3d7d10b9
...@@ -96,6 +96,7 @@ nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index, ...@@ -96,6 +96,7 @@ nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index,
{ {
struct nfp_pf *pf = devlink_priv(devlink); struct nfp_pf *pf = devlink_priv(devlink);
struct nfp_eth_table_port eth_port; struct nfp_eth_table_port eth_port;
unsigned int lanes;
int ret; int ret;
if (count < 2) if (count < 2)
...@@ -114,8 +115,12 @@ nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index, ...@@ -114,8 +115,12 @@ nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index,
goto out; goto out;
} }
ret = nfp_devlink_set_lanes(pf, eth_port.index, /* Special case the 100G CXP -> 2x40G split */
eth_port.port_lanes / count); lanes = eth_port.port_lanes / count;
if (eth_port.lanes == 10 && count == 2)
lanes = 8 / count;
ret = nfp_devlink_set_lanes(pf, eth_port.index, lanes);
out: out:
mutex_unlock(&pf->lock); mutex_unlock(&pf->lock);
...@@ -128,6 +133,7 @@ nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index, ...@@ -128,6 +133,7 @@ nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index,
{ {
struct nfp_pf *pf = devlink_priv(devlink); struct nfp_pf *pf = devlink_priv(devlink);
struct nfp_eth_table_port eth_port; struct nfp_eth_table_port eth_port;
unsigned int lanes;
int ret; int ret;
mutex_lock(&pf->lock); mutex_lock(&pf->lock);
...@@ -143,7 +149,12 @@ nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index, ...@@ -143,7 +149,12 @@ nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index,
goto out; goto out;
} }
ret = nfp_devlink_set_lanes(pf, eth_port.index, eth_port.port_lanes); /* Special case the 100G CXP -> 2x40G unsplit */
lanes = eth_port.port_lanes;
if (eth_port.port_lanes == 8)
lanes = 10;
ret = nfp_devlink_set_lanes(pf, eth_port.index, lanes);
out: out:
mutex_unlock(&pf->lock); mutex_unlock(&pf->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment