mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
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 <alexanderduyck@fb.com> Link: https://patch.msgid.link/175028447568.625704.17971496887030109107.stgit@ahduyck-xeon-server.home.arpa Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
0853d8521b
commit
22780f69fb
|
|
@ -540,7 +540,7 @@ static bool fbnic_pcs_get_link_asic(struct fbnic_dev *fbd)
|
|||
return link;
|
||||
}
|
||||
|
||||
static void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
|
||||
void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
|
||||
{
|
||||
/* Retrieve default speed from FW */
|
||||
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)
|
|||
|
||||
static int fbnic_pcs_enable_asic(struct fbnic_dev *fbd)
|
||||
{
|
||||
struct fbnic_net *fbn = netdev_priv(fbd->netdev);
|
||||
|
||||
/* Mask and clear the PCS interrupt, will be enabled by link handler */
|
||||
wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, ~0);
|
||||
wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0);
|
||||
|
||||
/* Pull in settings from FW */
|
||||
fbnic_mac_get_fw_settings(fbd, &fbn->aui, &fbn->fec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,4 +93,5 @@ struct fbnic_mac {
|
|||
};
|
||||
|
||||
int fbnic_mac_init(struct fbnic_dev *fbd);
|
||||
void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec);
|
||||
#endif /* _FBNIC_MAC_H_ */
|
||||
|
|
|
|||
|
|
@ -8,6 +8,22 @@
|
|||
#include "fbnic_mac.h"
|
||||
#include "fbnic_netdev.h"
|
||||
|
||||
static phy_interface_t fbnic_phylink_select_interface(u8 aui)
|
||||
{
|
||||
switch (aui) {
|
||||
case FBNIC_AUI_100GAUI2:
|
||||
return PHY_INTERFACE_MODE_100GBASEP;
|
||||
case FBNIC_AUI_50GAUI1:
|
||||
return PHY_INTERFACE_MODE_50GBASER;
|
||||
case FBNIC_AUI_LAUI2:
|
||||
return PHY_INTERFACE_MODE_LAUI;
|
||||
case FBNIC_AUI_25GAUI:
|
||||
return PHY_INTERFACE_MODE_25GBASER;
|
||||
}
|
||||
|
||||
return PHY_INTERFACE_MODE_NA;
|
||||
}
|
||||
|
||||
static struct fbnic_net *
|
||||
fbnic_pcs_to_net(struct phylink_pcs *pcs)
|
||||
{
|
||||
|
|
@ -128,6 +144,7 @@ static const struct phylink_mac_ops fbnic_phylink_mac_ops = {
|
|||
int fbnic_phylink_init(struct net_device *netdev)
|
||||
{
|
||||
struct fbnic_net *fbn = netdev_priv(netdev);
|
||||
struct fbnic_dev *fbd = fbn->fbd;
|
||||
struct phylink *phylink;
|
||||
|
||||
fbn->phylink_pcs.ops = &fbnic_phylink_pcs_ops;
|
||||
|
|
@ -135,18 +152,23 @@ int fbnic_phylink_init(struct net_device *netdev)
|
|||
fbn->phylink_config.dev = &netdev->dev;
|
||||
fbn->phylink_config.type = PHYLINK_NETDEV;
|
||||
fbn->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
|
||||
MAC_10000FD | MAC_25000FD |
|
||||
MAC_40000FD | MAC_50000FD |
|
||||
MAC_25000FD | MAC_50000FD |
|
||||
MAC_100000FD;
|
||||
fbn->phylink_config.default_an_inband = true;
|
||||
|
||||
__set_bit(PHY_INTERFACE_MODE_XGMII,
|
||||
__set_bit(PHY_INTERFACE_MODE_100GBASEP,
|
||||
fbn->phylink_config.supported_interfaces);
|
||||
__set_bit(PHY_INTERFACE_MODE_XLGMII,
|
||||
__set_bit(PHY_INTERFACE_MODE_50GBASER,
|
||||
fbn->phylink_config.supported_interfaces);
|
||||
__set_bit(PHY_INTERFACE_MODE_LAUI,
|
||||
fbn->phylink_config.supported_interfaces);
|
||||
__set_bit(PHY_INTERFACE_MODE_25GBASER,
|
||||
fbn->phylink_config.supported_interfaces);
|
||||
|
||||
fbnic_mac_get_fw_settings(fbd, &fbn->aui, &fbn->fec);
|
||||
|
||||
phylink = phylink_create(&fbn->phylink_config, NULL,
|
||||
PHY_INTERFACE_MODE_XLGMII,
|
||||
fbnic_phylink_select_interface(fbn->aui),
|
||||
&fbnic_phylink_mac_ops);
|
||||
if (IS_ERR(phylink))
|
||||
return PTR_ERR(phylink);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user