]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fbnic: Replace link_mode with AUI
authorAlexander Duyck <alexanderduyck@fb.com>
Wed, 18 Jun 2025 22:07:42 +0000 (15:07 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 24 Jun 2025 07:31:45 +0000 (09:31 +0200)
The way we were using "link_mode" was really more to describe the interface
between the attachment unit interface(s) we were using on the device.
Specifically the AUI is describing the modulation and the number of lanes
we are using. So we can simplify this by replacing link_mode with aui.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/175028446219.625704.8050098629750896117.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/meta/fbnic/fbnic_mac.c
drivers/net/ethernet/meta/fbnic/fbnic_mac.h
drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
drivers/net/ethernet/meta/fbnic/fbnic_phylink.c

index 56b429c96a7c6cbeafabbe50d40f107458cc0ee9..0528724011c1533c734c512bf4af6b43c0be94c3 100644 (file)
@@ -468,14 +468,14 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
                return false;
 
        /* Define the expected lane mask for the status bits we need to check */
-       switch (fbn->link_mode) {
-       case FBNIC_LINK_100R2:
+       switch (fbn->aui) {
+       case FBNIC_AUI_100GAUI2:
                lane_mask = 0xf;
                break;
-       case FBNIC_LINK_50R1:
+       case FBNIC_AUI_50GAUI1:
                lane_mask = 3;
                break;
-       case FBNIC_LINK_50R2:
+       case FBNIC_AUI_LAUI2:
                switch (fbn->fec) {
                case FBNIC_FEC_OFF:
                        lane_mask = 0x63;
@@ -488,7 +488,7 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
                        break;
                }
                break;
-       case FBNIC_LINK_25R1:
+       case FBNIC_AUI_25GAUI:
                lane_mask = 1;
                break;
        }
@@ -540,27 +540,26 @@ 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 *link_mode, u8 *fec)
+static 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) {
        case FBNIC_FW_LINK_SPEED_25R1:
-               *link_mode = FBNIC_LINK_25R1;
+               *aui = FBNIC_AUI_25GAUI;
                break;
        case FBNIC_FW_LINK_SPEED_50R2:
-               *link_mode = FBNIC_LINK_50R2;
+               *aui = FBNIC_AUI_LAUI2;
                break;
        case FBNIC_FW_LINK_SPEED_50R1:
-               *link_mode = FBNIC_LINK_50R1;
+               *aui = FBNIC_AUI_50GAUI1;
                *fec = FBNIC_FEC_RS;
                return;
        case FBNIC_FW_LINK_SPEED_100R2:
-               *link_mode = FBNIC_LINK_100R2;
+               *aui = FBNIC_AUI_100GAUI2;
                *fec = FBNIC_FEC_RS;
                return;
        default:
-               *link_mode = FBNIC_LINK_UNKONWN;
+               *aui = FBNIC_AUI_UNKNOWN;
                return;
        }
 
@@ -588,7 +587,7 @@ static int fbnic_pcs_enable_asic(struct fbnic_dev *fbd)
        wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0);
 
        /* Pull in settings from FW */
-       fbnic_mac_get_fw_settings(fbd, &fbn->link_mode, &fbn->fec);
+       fbnic_mac_get_fw_settings(fbd, &fbn->aui, &fbn->fec);
 
        return 0;
 }
index f4e75530a939e0925de67623e5e7a74fe416e8da..151d785116cb736c03ba3090cca3b12d5bac7598 100644 (file)
@@ -27,21 +27,21 @@ enum {
        FBNIC_FEC_BASER         = 2,
 };
 
-/* Treat the link modes as a set of modulation/lanes bitmask:
+/* Treat the AUI modes as a modulation/lanes bitmask:
  * Bit 0: Lane Count, 0 = R1, 1 = R2
  * Bit 1: Modulation, 0 = NRZ, 1 = PAM4
- * Bit 2: Retrieve link mode from FW
+ * Bit 2: Unknown Modulation/Lane Configuration
  */
 enum {
-       FBNIC_LINK_25R1         = 0,
-       FBNIC_LINK_50R2         = 1,
-       FBNIC_LINK_50R1         = 2,
-       FBNIC_LINK_100R2        = 3,
-       FBNIC_LINK_UNKONWN      = 4,
+       FBNIC_AUI_25GAUI        = 0,    /* 25.7812GBd   25.78125 * 1 */
+       FBNIC_AUI_LAUI2         = 1,    /* 51.5625GBd   25.78128 * 2 */
+       FBNIC_AUI_50GAUI1       = 2,    /* 53.125GBd    53.125   * 1 */
+       FBNIC_AUI_100GAUI2      = 3,    /* 106.25GBd    53.125   * 2 */
+       FBNIC_AUI_UNKNOWN       = 4,
 };
 
-#define FBNIC_LINK_MODE_R2     (FBNIC_LINK_50R2)
-#define FBNIC_LINK_MODE_PAM4   (FBNIC_LINK_50R1)
+#define FBNIC_AUI_MODE_R2      (FBNIC_AUI_LAUI2)
+#define FBNIC_AUI_MODE_PAM4    (FBNIC_AUI_50GAUI1)
 
 enum fbnic_sensor_id {
        FBNIC_SENSOR_TEMP,              /* Temp in millidegrees Centigrade */
index 561837e80ec809cded1202d4e36148a9871af86f..c30c060b72e0e655c9dd792b565cbce9a54bebe2 100644 (file)
@@ -42,9 +42,8 @@ struct fbnic_net {
        struct phylink_config phylink_config;
        struct phylink_pcs phylink_pcs;
 
-       /* TBD: Remove these when phylink supports FEC and lane config */
+       u8 aui;
        u8 fec;
-       u8 link_mode;
 
        /* Cached top bits of the HW time counter for 40b -> 64b conversion */
        u32 time_high;
index cb375a3dafe8c701a7454f976d0406bc4284d657..edd8738c981a292e18352ab82eb8f5666f810de7 100644 (file)
@@ -21,15 +21,15 @@ fbnic_phylink_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
        struct fbnic_net *fbn = fbnic_pcs_to_net(pcs);
        struct fbnic_dev *fbd = fbn->fbd;
 
-       switch (fbn->link_mode) {
-       case FBNIC_LINK_25R1:
+       switch (fbn->aui) {
+       case FBNIC_AUI_25GAUI:
                state->speed = SPEED_25000;
                break;
-       case FBNIC_LINK_50R2:
-       case FBNIC_LINK_50R1:
+       case FBNIC_AUI_LAUI2:
+       case FBNIC_AUI_50GAUI1:
                state->speed = SPEED_50000;
                break;
-       case FBNIC_LINK_100R2:
+       case FBNIC_AUI_100GAUI2:
                state->speed = SPEED_100000;
                break;
        default: