Skip to content

Commit e933055

Browse files
ahduyckNipaLocal
authored andcommitted
fbnic: Replace link_mode with AUI
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 <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent d4b66e1 commit e933055

File tree

4 files changed

+27
-29
lines changed

4 files changed

+27
-29
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,14 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
468468
return false;
469469

470470
/* Define the expected lane mask for the status bits we need to check */
471-
switch (fbn->link_mode) {
472-
case FBNIC_LINK_100R2:
471+
switch (fbn->aui) {
472+
case FBNIC_AUI_100GAUI2:
473473
lane_mask = 0xf;
474474
break;
475-
case FBNIC_LINK_50R1:
475+
case FBNIC_AUI_50GAUI1:
476476
lane_mask = 3;
477477
break;
478-
case FBNIC_LINK_50R2:
478+
case FBNIC_AUI_LAUI2:
479479
switch (fbn->fec) {
480480
case FBNIC_FEC_OFF:
481481
lane_mask = 0x63;
@@ -488,7 +488,7 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
488488
break;
489489
}
490490
break;
491-
case FBNIC_LINK_25R1:
491+
case FBNIC_AUI_25GAUI:
492492
lane_mask = 1;
493493
break;
494494
}
@@ -540,27 +540,26 @@ static bool fbnic_pcs_get_link_asic(struct fbnic_dev *fbd)
540540
return link;
541541
}
542542

543-
static void
544-
fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *link_mode, u8 *fec)
543+
static void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
545544
{
546545
/* Retrieve default speed from FW */
547546
switch (fbd->fw_cap.link_speed) {
548547
case FBNIC_FW_LINK_SPEED_25R1:
549-
*link_mode = FBNIC_LINK_25R1;
548+
*aui = FBNIC_AUI_25GAUI;
550549
break;
551550
case FBNIC_FW_LINK_SPEED_50R2:
552-
*link_mode = FBNIC_LINK_50R2;
551+
*aui = FBNIC_AUI_LAUI2;
553552
break;
554553
case FBNIC_FW_LINK_SPEED_50R1:
555-
*link_mode = FBNIC_LINK_50R1;
554+
*aui = FBNIC_AUI_50GAUI1;
556555
*fec = FBNIC_FEC_RS;
557556
return;
558557
case FBNIC_FW_LINK_SPEED_100R2:
559-
*link_mode = FBNIC_LINK_100R2;
558+
*aui = FBNIC_AUI_100GAUI2;
560559
*fec = FBNIC_FEC_RS;
561560
return;
562561
default:
563-
*link_mode = FBNIC_LINK_UNKONWN;
562+
*aui = FBNIC_AUI_UNKNOWN;
564563
return;
565564
}
566565

@@ -588,7 +587,7 @@ static int fbnic_pcs_enable_asic(struct fbnic_dev *fbd)
588587
wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0);
589588

590589
/* Pull in settings from FW */
591-
fbnic_mac_get_fw_settings(fbd, &fbn->link_mode, &fbn->fec);
590+
fbnic_mac_get_fw_settings(fbd, &fbn->aui, &fbn->fec);
592591

593592
return 0;
594593
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ enum {
2727
FBNIC_FEC_BASER = 2,
2828
};
2929

30-
/* Treat the link modes as a set of modulation/lanes bitmask:
30+
/* Treat the AUI modes as a modulation/lanes bitmask:
3131
* Bit 0: Lane Count, 0 = R1, 1 = R2
3232
* Bit 1: Modulation, 0 = NRZ, 1 = PAM4
33-
* Bit 2: Retrieve link mode from FW
33+
* Bit 2: Unknown Modulation/Lane Configuration
3434
*/
3535
enum {
36-
FBNIC_LINK_25R1 = 0,
37-
FBNIC_LINK_50R2 = 1,
38-
FBNIC_LINK_50R1 = 2,
39-
FBNIC_LINK_100R2 = 3,
40-
FBNIC_LINK_UNKONWN = 4,
36+
FBNIC_AUI_25GAUI = 0, /* 25.7812GBd 25.78125 * 1 */
37+
FBNIC_AUI_LAUI2 = 1, /* 51.5625GBd 25.78128 * 2 */
38+
FBNIC_AUI_50GAUI1 = 2, /* 53.125GBd 53.125 * 1 */
39+
FBNIC_AUI_100GAUI2 = 3, /* 106.25GBd 53.125 * 2 */
40+
FBNIC_AUI_UNKNOWN = 4,
4141
};
4242

43-
#define FBNIC_LINK_MODE_R2 (FBNIC_LINK_50R2)
44-
#define FBNIC_LINK_MODE_PAM4 (FBNIC_LINK_50R1)
43+
#define FBNIC_AUI_MODE_R2 (FBNIC_AUI_LAUI2)
44+
#define FBNIC_AUI_MODE_PAM4 (FBNIC_AUI_50GAUI1)
4545

4646
enum fbnic_sensor_id {
4747
FBNIC_SENSOR_TEMP, /* Temp in millidegrees Centigrade */

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ struct fbnic_net {
4242
struct phylink_config phylink_config;
4343
struct phylink_pcs phylink_pcs;
4444

45-
/* TBD: Remove these when phylink supports FEC and lane config */
45+
u8 aui;
4646
u8 fec;
47-
u8 link_mode;
4847

4948
/* Cached top bits of the HW time counter for 40b -> 64b conversion */
5049
u32 time_high;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ fbnic_phylink_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
2121
struct fbnic_net *fbn = fbnic_pcs_to_net(pcs);
2222
struct fbnic_dev *fbd = fbn->fbd;
2323

24-
switch (fbn->link_mode) {
25-
case FBNIC_LINK_25R1:
24+
switch (fbn->aui) {
25+
case FBNIC_AUI_25GAUI:
2626
state->speed = SPEED_25000;
2727
break;
28-
case FBNIC_LINK_50R2:
29-
case FBNIC_LINK_50R1:
28+
case FBNIC_AUI_LAUI2:
29+
case FBNIC_AUI_50GAUI1:
3030
state->speed = SPEED_50000;
3131
break;
32-
case FBNIC_LINK_100R2:
32+
case FBNIC_AUI_100GAUI2:
3333
state->speed = SPEED_100000;
3434
break;
3535
default:

0 commit comments

Comments
 (0)