aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorPiotr Pietruszewski <piotr.pietruszewski@intel.com>2023-07-11 16:14:26 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2024-11-27 01:14:56 +0000
commita4eee3fa6043bb619e136f6d4df7feb7027ba1fc (patch)
tree1a4ff82f44eab1da116196840873fa0dfa4f8d86 /sys/dev
parent8de3ffc1c78009162dbcfe0c82f56526394bc884 (diff)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ixgbe/if_ix.c3
-rw-r--r--sys/dev/ixgbe/if_ixv.c2
-rw-r--r--sys/dev/ixgbe/ixgbe.h2
-rw-r--r--sys/dev/ixgbe/ixgbe_osdep.c33
4 files changed, 38 insertions, 2 deletions
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 3639adc0feba..0fa66ef2055c 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -3880,7 +3880,8 @@ ixgbe_if_update_admin_status(if_ctx_t ctx)
/* Update DMA coalescing config */
ixgbe_config_dmac(sc);
/* should actually be negotiated value */
- iflib_link_state_change(ctx, LINK_STATE_UP, IF_Gbps(10));
+ iflib_link_state_change(ctx, LINK_STATE_UP,
+ ixgbe_link_speed_to_baudrate(adapter->link_speed));
if (sc->feat_en & IXGBE_FEATURE_SRIOV)
ixgbe_ping_all_vfs(sc);
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index 23381dcbe809..6e97e50c1914 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -941,7 +941,7 @@ ixv_if_update_admin_status(if_ctx_t ctx)
"Full Duplex");
sc->link_active = true;
iflib_link_state_change(ctx, LINK_STATE_UP,
- IF_Gbps(10));
+ ixgbe_link_speed_to_baudrate(adapter->link_speed));
}
} else { /* Link down */
if (sc->link_active == true) {
diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h
index 5141e9d27003..341d4ebfcebc 100644
--- a/sys/dev/ixgbe/ixgbe.h
+++ b/sys/dev/ixgbe/ixgbe.h
@@ -533,6 +533,8 @@ ixv_check_ether_addr(u8 *addr)
return (status);
}
+uint64_t ixgbe_link_speed_to_baudrate(ixgbe_link_speed speed);
+
/* Shared Prototypes */
int ixgbe_allocate_queues(struct ixgbe_softc *);
diff --git a/sys/dev/ixgbe/ixgbe_osdep.c b/sys/dev/ixgbe/ixgbe_osdep.c
index 57403b0b2f6c..2fa651df8936 100644
--- a/sys/dev/ixgbe/ixgbe_osdep.c
+++ b/sys/dev/ixgbe/ixgbe_osdep.c
@@ -75,3 +75,36 @@ ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg, u32 offset, u32 val)
((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_handle,
reg + (offset << 2), val);
}
+
+uint64_t
+ixgbe_link_speed_to_baudrate(ixgbe_link_speed speed)
+{
+ uint64_t baudrate;
+
+ switch (speed) {
+ case IXGBE_LINK_SPEED_10GB_FULL:
+ baudrate = IF_Gbps(10);
+ break;
+ case IXGBE_LINK_SPEED_5GB_FULL:
+ baudrate = IF_Gbps(5);
+ break;
+ case IXGBE_LINK_SPEED_2_5GB_FULL:
+ baudrate = IF_Mbps(2500);
+ break;
+ case IXGBE_LINK_SPEED_1GB_FULL:
+ baudrate = IF_Gbps(1);
+ break;
+ case IXGBE_LINK_SPEED_100_FULL:
+ baudrate = IF_Mbps(100);
+ break;
+ case IXGBE_LINK_SPEED_10_FULL:
+ baudrate = IF_Mbps(10);
+ break;
+ case IXGBE_LINK_SPEED_UNKNOWN:
+ default:
+ baudrate = 0;
+ break;
+ }
+
+ return baudrate;
+}