Skip to content

Commit 9eaa403

Browse files
ahduyckNipaLocal
authored andcommitted
fbnic: Set correct supported modes and speeds based on FW setting
The fbnic driver was using the XLGMII link mode to enable phylink, however that mode wasn't the correct one to use as the NIC doesn't actually use XLGMII, it is using a combinations of 25G, 50G, and 100G interface modes and configuring those via pins exposed on the PCS, MAC, and PHY interfaces. To more accurately reflect that we should drop the uxe of XGMII and XLGMII and instead use the correct interface types. Signed-off-by: Alexander Duyck <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent aa0da27 commit 9eaa403

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_mac.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ static bool fbnic_pcs_get_link_asic(struct fbnic_dev *fbd)
540540
return link;
541541
}
542542

543-
static void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
543+
void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
544544
{
545545
/* Retrieve default speed from FW */
546546
switch (fbd->fw_cap.link_speed) {
@@ -580,15 +580,10 @@ static void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
580580

581581
static int fbnic_pcs_enable_asic(struct fbnic_dev *fbd)
582582
{
583-
struct fbnic_net *fbn = netdev_priv(fbd->netdev);
584-
585583
/* Mask and clear the PCS interrupt, will be enabled by link handler */
586584
wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, ~0);
587585
wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0);
588586

589-
/* Pull in settings from FW */
590-
fbnic_mac_get_fw_settings(fbd, &fbn->aui, &fbn->fec);
591-
592587
return 0;
593588
}
594589

drivers/net/ethernet/meta/fbnic/fbnic_mac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,5 @@ struct fbnic_mac {
9393
};
9494

9595
int fbnic_mac_init(struct fbnic_dev *fbd);
96+
void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec);
9697
#endif /* _FBNIC_MAC_H_ */

drivers/net/ethernet/meta/fbnic/fbnic_phylink.c

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
#include "fbnic_mac.h"
99
#include "fbnic_netdev.h"
1010

11+
static phy_interface_t fbnic_phylink_select_interface(u8 aui)
12+
{
13+
switch (aui) {
14+
case FBNIC_AUI_100GAUI2:
15+
return PHY_INTERFACE_MODE_100GBASEP;
16+
case FBNIC_AUI_50GAUI1:
17+
return PHY_INTERFACE_MODE_50GBASER;
18+
case FBNIC_AUI_LAUI2:
19+
return PHY_INTERFACE_MODE_LAUI;
20+
case FBNIC_AUI_25GAUI:
21+
return PHY_INTERFACE_MODE_25GBASER;
22+
}
23+
24+
return PHY_INTERFACE_MODE_NA;
25+
}
26+
1127
static struct fbnic_net *
1228
fbnic_pcs_to_net(struct phylink_pcs *pcs)
1329
{
@@ -128,25 +144,31 @@ static const struct phylink_mac_ops fbnic_phylink_mac_ops = {
128144
int fbnic_phylink_init(struct net_device *netdev)
129145
{
130146
struct fbnic_net *fbn = netdev_priv(netdev);
147+
struct fbnic_dev *fbd = fbn->fbd;
131148
struct phylink *phylink;
132149

133150
fbn->phylink_pcs.ops = &fbnic_phylink_pcs_ops;
134151

135152
fbn->phylink_config.dev = &netdev->dev;
136153
fbn->phylink_config.type = PHYLINK_NETDEV;
137154
fbn->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
138-
MAC_10000FD | MAC_25000FD |
139-
MAC_40000FD | MAC_50000FD |
155+
MAC_25000FD | MAC_50000FD |
140156
MAC_100000FD;
141157
fbn->phylink_config.default_an_inband = true;
142158

143-
__set_bit(PHY_INTERFACE_MODE_XGMII,
159+
__set_bit(PHY_INTERFACE_MODE_100GBASEP,
144160
fbn->phylink_config.supported_interfaces);
145-
__set_bit(PHY_INTERFACE_MODE_XLGMII,
161+
__set_bit(PHY_INTERFACE_MODE_50GBASER,
146162
fbn->phylink_config.supported_interfaces);
163+
__set_bit(PHY_INTERFACE_MODE_LAUI,
164+
fbn->phylink_config.supported_interfaces);
165+
__set_bit(PHY_INTERFACE_MODE_25GBASER,
166+
fbn->phylink_config.supported_interfaces);
167+
168+
fbnic_mac_get_fw_settings(fbd, &fbn->aui, &fbn->fec);
147169

148170
phylink = phylink_create(&fbn->phylink_config, NULL,
149-
PHY_INTERFACE_MODE_XLGMII,
171+
fbnic_phylink_select_interface(fbn->aui),
150172
&fbnic_phylink_mac_ops);
151173
if (IS_ERR(phylink))
152174
return PTR_ERR(phylink);

0 commit comments

Comments
 (0)