Skip to content

Commit a3116a4

Browse files
committed
Merge branch 'enic-set-link-speed-only-after-link-up'
John Daley says: ==================== enic: Set link speed only after link up ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 75f01bf + 8e0644e commit a3116a4

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

drivers/net/ethernet/cisco/enic/enic_main.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static struct enic_intr_mod_table mod_table[ENIC_MAX_COALESCE_TIMERS + 1] = {
109109
static struct enic_intr_mod_range mod_range[ENIC_MAX_LINK_SPEEDS] = {
110110
{0, 0}, /* 0 - 4 Gbps */
111111
{0, 3}, /* 4 - 10 Gbps */
112-
{3, 6}, /* 10 - 40 Gbps */
112+
{3, 6}, /* 10+ Gbps */
113113
};
114114

115115
static void enic_init_affinity_hint(struct enic *enic)
@@ -428,6 +428,36 @@ static void enic_mtu_check(struct enic *enic)
428428
}
429429
}
430430

431+
static void enic_set_rx_coal_setting(struct enic *enic)
432+
{
433+
unsigned int speed;
434+
int index = -1;
435+
struct enic_rx_coal *rx_coal = &enic->rx_coalesce_setting;
436+
437+
/* 1. Read the link speed from fw
438+
* 2. Pick the default range for the speed
439+
* 3. Update it in enic->rx_coalesce_setting
440+
*/
441+
speed = vnic_dev_port_speed(enic->vdev);
442+
if (speed > ENIC_LINK_SPEED_10G)
443+
index = ENIC_LINK_40G_INDEX;
444+
else if (speed > ENIC_LINK_SPEED_4G)
445+
index = ENIC_LINK_10G_INDEX;
446+
else
447+
index = ENIC_LINK_4G_INDEX;
448+
449+
rx_coal->small_pkt_range_start = mod_range[index].small_pkt_range_start;
450+
rx_coal->large_pkt_range_start = mod_range[index].large_pkt_range_start;
451+
rx_coal->range_end = ENIC_RX_COALESCE_RANGE_END;
452+
453+
/* Start with the value provided by UCSM */
454+
for (index = 0; index < enic->rq_count; index++)
455+
enic->cq[index].cur_rx_coal_timeval =
456+
enic->config.intr_timer_usec;
457+
458+
rx_coal->use_adaptive_rx_coalesce = 1;
459+
}
460+
431461
static void enic_link_check(struct enic *enic)
432462
{
433463
int link_status = vnic_dev_link_status(enic->vdev);
@@ -436,6 +466,7 @@ static void enic_link_check(struct enic *enic)
436466
if (link_status && !carrier_ok) {
437467
netdev_info(enic->netdev, "Link UP\n");
438468
netif_carrier_on(enic->netdev);
469+
enic_set_rx_coal_setting(enic);
439470
} else if (!link_status && carrier_ok) {
440471
netdev_info(enic->netdev, "Link DOWN\n");
441472
netif_carrier_off(enic->netdev);
@@ -1901,36 +1932,6 @@ static void enic_synchronize_irqs(struct enic *enic)
19011932
}
19021933
}
19031934

1904-
static void enic_set_rx_coal_setting(struct enic *enic)
1905-
{
1906-
unsigned int speed;
1907-
int index = -1;
1908-
struct enic_rx_coal *rx_coal = &enic->rx_coalesce_setting;
1909-
1910-
/* 1. Read the link speed from fw
1911-
* 2. Pick the default range for the speed
1912-
* 3. Update it in enic->rx_coalesce_setting
1913-
*/
1914-
speed = vnic_dev_port_speed(enic->vdev);
1915-
if (ENIC_LINK_SPEED_10G < speed)
1916-
index = ENIC_LINK_40G_INDEX;
1917-
else if (ENIC_LINK_SPEED_4G < speed)
1918-
index = ENIC_LINK_10G_INDEX;
1919-
else
1920-
index = ENIC_LINK_4G_INDEX;
1921-
1922-
rx_coal->small_pkt_range_start = mod_range[index].small_pkt_range_start;
1923-
rx_coal->large_pkt_range_start = mod_range[index].large_pkt_range_start;
1924-
rx_coal->range_end = ENIC_RX_COALESCE_RANGE_END;
1925-
1926-
/* Start with the value provided by UCSM */
1927-
for (index = 0; index < enic->rq_count; index++)
1928-
enic->cq[index].cur_rx_coal_timeval =
1929-
enic->config.intr_timer_usec;
1930-
1931-
rx_coal->use_adaptive_rx_coalesce = 1;
1932-
}
1933-
19341935
static int enic_dev_notify_set(struct enic *enic)
19351936
{
19361937
int err;
@@ -3063,7 +3064,6 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
30633064
timer_setup(&enic->notify_timer, enic_notify_timer, 0);
30643065

30653066
enic_rfs_flw_tbl_init(enic);
3066-
enic_set_rx_coal_setting(enic);
30673067
INIT_WORK(&enic->reset, enic_reset);
30683068
INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset);
30693069
INIT_WORK(&enic->change_mtu_work, enic_change_mtu_work);

0 commit comments

Comments
 (0)