1 |
From b8ead875afa1b93bd3c80e3b663224d803b9a024 Mon Sep 17 00:00:00 2001 |
2 |
From: Ryan C Goodfellow <rgoodfel@isi.edu> |
3 |
Date: Fri, 12 Oct 2018 11:09:01 -0700 |
4 |
Subject: [PATCH 010/145] nfp: devlink port split support for 1x100G CXP NIC |
5 |
|
6 |
[ Upstream commit 5948185b97fa1f83d7855e638a72982a1073ebf5 ] |
7 |
|
8 |
This commit makes it possible to use devlink to split the 100G CXP |
9 |
Netronome into two 40G interfaces. Currently when you ask for 2 |
10 |
interfaces, the math in src/nfp_devlink.c:nfp_devlink_port_split |
11 |
calculates that you want 5 lanes per port because for some reason |
12 |
eth_port.port_lanes=10 (shouldn't this be 12 for CXP?). What we really |
13 |
want when asking for 2 breakout interfaces is 4 lanes per port. This |
14 |
commit makes that happen by calculating based on 8 lanes if 10 are |
15 |
present. |
16 |
|
17 |
Signed-off-by: Ryan C Goodfellow <rgoodfel@isi.edu> |
18 |
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> |
19 |
Reviewed-by: Greg Weeks <greg.weeks@netronome.com> |
20 |
Signed-off-by: David S. Miller <davem@davemloft.net> |
21 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
22 |
--- |
23 |
.../net/ethernet/netronome/nfp/nfp_devlink.c | 17 ++++++++++++++--- |
24 |
1 file changed, 14 insertions(+), 3 deletions(-) |
25 |
|
26 |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c |
27 |
index db463e20a876..e9a4179e7e48 100644 |
28 |
--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c |
29 |
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c |
30 |
@@ -96,6 +96,7 @@ nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index, |
31 |
{ |
32 |
struct nfp_pf *pf = devlink_priv(devlink); |
33 |
struct nfp_eth_table_port eth_port; |
34 |
+ unsigned int lanes; |
35 |
int ret; |
36 |
|
37 |
if (count < 2) |
38 |
@@ -114,8 +115,12 @@ nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index, |
39 |
goto out; |
40 |
} |
41 |
|
42 |
- ret = nfp_devlink_set_lanes(pf, eth_port.index, |
43 |
- eth_port.port_lanes / count); |
44 |
+ /* Special case the 100G CXP -> 2x40G split */ |
45 |
+ lanes = eth_port.port_lanes / count; |
46 |
+ if (eth_port.lanes == 10 && count == 2) |
47 |
+ lanes = 8 / count; |
48 |
+ |
49 |
+ ret = nfp_devlink_set_lanes(pf, eth_port.index, lanes); |
50 |
out: |
51 |
mutex_unlock(&pf->lock); |
52 |
|
53 |
@@ -128,6 +133,7 @@ nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index, |
54 |
{ |
55 |
struct nfp_pf *pf = devlink_priv(devlink); |
56 |
struct nfp_eth_table_port eth_port; |
57 |
+ unsigned int lanes; |
58 |
int ret; |
59 |
|
60 |
mutex_lock(&pf->lock); |
61 |
@@ -143,7 +149,12 @@ nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index, |
62 |
goto out; |
63 |
} |
64 |
|
65 |
- ret = nfp_devlink_set_lanes(pf, eth_port.index, eth_port.port_lanes); |
66 |
+ /* Special case the 100G CXP -> 2x40G unsplit */ |
67 |
+ lanes = eth_port.port_lanes; |
68 |
+ if (eth_port.port_lanes == 8) |
69 |
+ lanes = 10; |
70 |
+ |
71 |
+ ret = nfp_devlink_set_lanes(pf, eth_port.index, lanes); |
72 |
out: |
73 |
mutex_unlock(&pf->lock); |
74 |
|
75 |
-- |
76 |
2.19.1 |
77 |
|