Skip to content

Commit 759e5e5

Browse files
davidarinzonSuraj Jitindar Singh
authored and
Suraj Jitindar Singh
committed
AL2 5.10 Update ENA driver to 2.11.0g
Signed-off-by: David Arinzon <darinzon@amazon.com>
1 parent d61e4c1 commit 759e5e5

File tree

9 files changed

+90
-36
lines changed

9 files changed

+90
-36
lines changed

drivers/amazon/net/ena/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Makefile for the Elastic Network Adapter (ENA) device drivers.
33
# ENA Source is: https://github.com/amzn/amzn-drivers.
4-
# Current ENA source is based on ena_linux_2.10.0 tag.
4+
# Current ENA source is based on ena_linux_2.11.0 tag.
55
#
66

77
obj-$(CONFIG_AMAZON_ENA_ETHERNET) += ena.o

drivers/amazon/net/ena/ena_admin_defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@ struct ena_admin_feature_llq_desc {
696696
*/
697697
u8 entry_size_recommended;
698698

699-
/* reserved */
700-
u8 reserved1[2];
699+
/* max depth of wide llq, or 0 for N/A */
700+
u16 max_wide_llq_depth;
701701

702702
/* accelerated low latency queues requirement. driver needs to
703703
* support those requirements in order to use accelerated llq

drivers/amazon/net/ena/ena_com.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
810810
spin_unlock_irqrestore(&admin_queue->q_lock, flags);
811811

812812
if (comp_ctx->status == ENA_CMD_COMPLETED) {
813+
admin_queue->is_missing_admin_interrupt = true;
813814
netdev_err(admin_queue->ena_dev->net_device,
814815
"The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d), autopolling mode is %s\n",
815816
comp_ctx->cmd_opcode,
@@ -2127,6 +2128,7 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev,
21272128

21282129
admin_queue->ena_dev = ena_dev;
21292130
admin_queue->running_state = true;
2131+
admin_queue->is_missing_admin_interrupt = false;
21302132

21312133
return 0;
21322134
error:

drivers/amazon/net/ena/ena_com.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ struct ena_com_admin_queue {
253253
*/
254254
bool running_state;
255255

256+
bool is_missing_admin_interrupt;
257+
256258
/* Count the number of outstanding admin commands */
257259
atomic_t outstanding_cmds;
258260

@@ -1091,6 +1093,16 @@ int ena_com_config_dev_mode(struct ena_com_dev *ena_dev,
10911093
struct ena_admin_feature_llq_desc *llq_features,
10921094
struct ena_llq_configurations *llq_default_config);
10931095

1096+
/* ena_com_get_missing_admin_interrupt - Return if there is a missing admin interrupt
1097+
* @ena_dev: ENA communication layer struct
1098+
*
1099+
* @return - true if there is a missing admin interrupt or false otherwise
1100+
*/
1101+
static inline bool ena_com_get_missing_admin_interrupt(struct ena_com_dev *ena_dev)
1102+
{
1103+
return ena_dev->admin_queue.is_missing_admin_interrupt;
1104+
}
1105+
10941106
/* ena_com_io_sq_to_ena_dev - Extract ena_com_dev using contained field io_sq.
10951107
* @io_sq: IO submit queue struct
10961108
*

drivers/amazon/net/ena/ena_ethtool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ static const struct ena_stats ena_stats_global_strings[] = {
8080
ENA_STAT_GLOBAL_ENTRY(tx_desc_malformed),
8181
ENA_STAT_GLOBAL_ENTRY(invalid_state),
8282
ENA_STAT_GLOBAL_ENTRY(os_netdev_wd),
83+
ENA_STAT_GLOBAL_ENTRY(missing_admin_interrupt),
84+
ENA_STAT_GLOBAL_ENTRY(admin_to),
8385
ENA_STAT_GLOBAL_ENTRY(suspend),
8486
ENA_STAT_GLOBAL_ENTRY(resume),
8587
ENA_STAT_GLOBAL_ENTRY(interface_down),
@@ -1287,7 +1289,6 @@ static int ena_set_channels(struct net_device *netdev,
12871289
NETDEV_XDP_ACT_REDIRECT);
12881290
}
12891291

1290-
12911292
if (count > adapter->max_num_io_queues)
12921293
return -EINVAL;
12931294
if (count != adapter->num_io_queues && ena_is_zc_q_exist(adapter)) {

drivers/amazon/net/ena/ena_netdev.c

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
15611561

15621562
#ifdef ENA_XDP_SUPPORT
15631563
if (xdp_flags & ENA_XDP_REDIRECT)
1564-
xdp_do_flush_map();
1564+
xdp_do_flush();
15651565
if (xdp_flags & ENA_XDP_TX)
15661566
ena_ring_tx_doorbell(rx_ring->xdp_ring);
15671567
#endif
@@ -3462,15 +3462,21 @@ static int ena_calc_io_queue_size(struct ena_adapter *adapter,
34623462
{
34633463
struct ena_admin_feature_llq_desc *llq = &get_feat_ctx->llq;
34643464
struct ena_com_dev *ena_dev = adapter->ena_dev;
3465-
u32 tx_queue_size = ENA_DEFAULT_RING_SIZE;
34663465
u32 max_tx_queue_size;
34673466
u32 max_rx_queue_size;
3467+
u32 tx_queue_size;
34683468

34693469
/* If this function is called after driver load, the ring sizes have already
34703470
* been configured. Take it into account when recalculating ring size.
34713471
*/
3472-
if (adapter->tx_ring->ring_size)
3472+
if (adapter->tx_ring->ring_size) {
34733473
tx_queue_size = adapter->tx_ring->ring_size;
3474+
} else if (adapter->llq_policy == ENA_LLQ_HEADER_SIZE_POLICY_LARGE &&
3475+
ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
3476+
tx_queue_size = ENA_DEFAULT_WIDE_LLQ_RING_SIZE;
3477+
} else {
3478+
tx_queue_size = ENA_DEFAULT_RING_SIZE;
3479+
}
34743480

34753481
if (adapter->rx_ring->ring_size)
34763482
rx_queue_size = adapter->rx_ring->ring_size;
@@ -3513,6 +3519,33 @@ static int ena_calc_io_queue_size(struct ena_adapter *adapter,
35133519
max_queues->max_packet_rx_descs);
35143520
}
35153521

3522+
if (adapter->llq_policy == ENA_LLQ_HEADER_SIZE_POLICY_LARGE) {
3523+
if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
3524+
u32 max_wide_llq_size = max_tx_queue_size;
3525+
3526+
if (llq->max_wide_llq_depth == 0) {
3527+
/* if there is no large llq max depth from device, we divide
3528+
* the queue size by 2, leaving the amount of memory
3529+
* used by the queues unchanged.
3530+
*/
3531+
max_wide_llq_size /= 2;
3532+
} else if (llq->max_wide_llq_depth < max_wide_llq_size) {
3533+
max_wide_llq_size = llq->max_wide_llq_depth;
3534+
}
3535+
if (max_wide_llq_size != max_tx_queue_size) {
3536+
max_tx_queue_size = max_wide_llq_size;
3537+
dev_info(&adapter->pdev->dev,
3538+
"Forcing large headers and decreasing maximum TX queue size to %d\n",
3539+
max_tx_queue_size);
3540+
}
3541+
} else {
3542+
dev_err(&adapter->pdev->dev,
3543+
"Forcing large headers failed: LLQ is disabled or device does not support large headers\n");
3544+
3545+
adapter->llq_policy = ENA_LLQ_HEADER_SIZE_POLICY_NORMAL;
3546+
}
3547+
}
3548+
35163549
max_tx_queue_size = rounddown_pow_of_two(max_tx_queue_size);
35173550
max_rx_queue_size = rounddown_pow_of_two(max_rx_queue_size);
35183551

@@ -3528,23 +3561,6 @@ static int ena_calc_io_queue_size(struct ena_adapter *adapter,
35283561
return -EFAULT;
35293562
}
35303563

3531-
/* When forcing large headers, we multiply the entry size by 2, and therefore divide
3532-
* the queue size by 2, leaving the amount of memory used by the queues unchanged.
3533-
*/
3534-
if (adapter->llq_policy == ENA_LLQ_HEADER_SIZE_POLICY_LARGE) {
3535-
if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
3536-
max_tx_queue_size /= 2;
3537-
dev_info(&adapter->pdev->dev,
3538-
"Forcing large headers and decreasing maximum TX queue size to %d\n",
3539-
max_tx_queue_size);
3540-
} else {
3541-
dev_err(&adapter->pdev->dev,
3542-
"Forcing large headers failed: LLQ is disabled or device does not support large headers\n");
3543-
3544-
adapter->llq_policy = ENA_LLQ_HEADER_SIZE_POLICY_NORMAL;
3545-
}
3546-
}
3547-
35483564
tx_queue_size = clamp_val(tx_queue_size, ENA_MIN_RING_SIZE,
35493565
max_tx_queue_size);
35503566
rx_queue_size = clamp_val(rx_queue_size, ENA_MIN_RING_SIZE,
@@ -3808,6 +3824,11 @@ static int ena_device_init(struct ena_adapter *adapter, struct pci_dev *pdev,
38083824
if (unlikely(rc))
38093825
goto err_admin_init;
38103826

3827+
if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV)
3828+
dev_info(&pdev->dev, "ENA Large LLQ is %s\n",
3829+
adapter->llq_policy == ENA_LLQ_HEADER_SIZE_POLICY_LARGE ?
3830+
"enabled" : "disabled");
3831+
38113832
/* Turned on features shouldn't change due to reset. */
38123833
prev_netdev_features = adapter->netdev->features;
38133834
ena_set_dev_offloads(get_feat_ctx, adapter->netdev);
@@ -4070,11 +4091,11 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter, struct en
40704091
struct net_device *netdev = adapter->netdev;
40714092
unsigned long jiffies_since_last_napi;
40724093
unsigned long jiffies_since_last_intr;
4094+
u32 missed_tx = 0, new_missed_tx = 0;
40734095
unsigned long graceful_timeout;
40744096
struct ena_tx_buffer *tx_buf;
40754097
unsigned long timeout;
40764098
int napi_scheduled;
4077-
u32 missed_tx = 0;
40784099
bool is_expired;
40794100
int i, rc = 0;
40804101

@@ -4117,20 +4138,24 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter, struct en
41174138
reset_reason = ENA_REGS_RESET_SUSPECTED_POLL_STARVATION;
41184139
}
41194140

4141+
missed_tx++;
4142+
41204143
if (tx_buf->print_once)
41214144
continue;
41224145

4146+
/* Add new TX completions which are missed */
4147+
new_missed_tx++;
4148+
41234149
netif_notice(adapter, tx_err, netdev,
41244150
"TX hasn't completed, qid %d, index %d. %u msecs since last interrupt, %u msecs since last napi execution, napi scheduled: %d\n",
41254151
tx_ring->qid, i, jiffies_to_msecs(jiffies_since_last_intr),
41264152
jiffies_to_msecs(jiffies_since_last_napi), napi_scheduled);
41274153

4128-
missed_tx++;
41294154
tx_buf->print_once = 1;
41304155
}
41314156
}
41324157

4133-
/* Checking if this TX ring got to max missing TX completes */
4158+
/* Checking if this TX ring missing TX completions have passed the threshold */
41344159
if (unlikely(missed_tx > missed_tx_thresh)) {
41354160
jiffies_since_last_intr = jiffies - READ_ONCE(ena_napi->last_intr_jiffies);
41364161
jiffies_since_last_napi = jiffies - READ_ONCE(tx_ring->tx_stats.last_napi_jiffies);
@@ -4156,7 +4181,8 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter, struct en
41564181
rc = -EIO;
41574182
}
41584183

4159-
ena_increase_stat(&tx_ring->tx_stats.missed_tx, missed_tx, &tx_ring->syncp);
4184+
/* Add the newly discovered missing TX completions */
4185+
ena_increase_stat(&tx_ring->tx_stats.missed_tx, new_missed_tx, &tx_ring->syncp);
41604186

41614187
return rc;
41624188
}
@@ -4288,7 +4314,12 @@ static void check_for_admin_com_state(struct ena_adapter *adapter)
42884314
if (unlikely(!ena_com_get_admin_running_state(adapter->ena_dev))) {
42894315
netif_err(adapter, drv, adapter->netdev,
42904316
"ENA admin queue is not in running state!\n");
4291-
ena_reset_device(adapter, ENA_REGS_RESET_ADMIN_TO);
4317+
ena_increase_stat(&adapter->dev_stats.admin_q_pause, 1,
4318+
&adapter->syncp);
4319+
if (ena_com_get_missing_admin_interrupt(adapter->ena_dev))
4320+
ena_reset_device(adapter, ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT);
4321+
else
4322+
ena_reset_device(adapter, ENA_REGS_RESET_ADMIN_TO);
42924323
}
42934324
}
42944325

drivers/amazon/net/ena/ena_netdev.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "ena_eth_com.h"
3232

3333
#define DRV_MODULE_GEN_MAJOR 2
34-
#define DRV_MODULE_GEN_MINOR 10
34+
#define DRV_MODULE_GEN_MINOR 11
3535
#define DRV_MODULE_GEN_SUBMINOR 0
3636

3737
#define DRV_MODULE_NAME "ena"
@@ -65,8 +65,9 @@
6565
#define ENA_MEM_BAR 2
6666
#define ENA_BAR_MASK (BIT(ENA_REG_BAR) | BIT(ENA_MEM_BAR))
6767

68-
#define ENA_DEFAULT_RING_SIZE (1024)
69-
#define ENA_MIN_RING_SIZE (256)
68+
#define ENA_DEFAULT_RING_SIZE (1024)
69+
#define ENA_DEFAULT_WIDE_LLQ_RING_SIZE (512)
70+
#define ENA_MIN_RING_SIZE (256)
7071

7172
#define ENA_MIN_RX_BUF_SIZE (2048)
7273

@@ -377,6 +378,8 @@ struct ena_stats_dev {
377378
u64 tx_desc_malformed;
378379
u64 invalid_state;
379380
u64 os_netdev_wd;
381+
u64 missing_admin_interrupt;
382+
u64 admin_to;
380383
};
381384

382385
enum ena_flags_t {
@@ -509,7 +512,7 @@ struct ena_reset_stats_offset {
509512

510513
static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_RESET_LAST] = {
511514
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_KEEP_ALIVE_TO, wd_expired),
512-
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_ADMIN_TO, admin_q_pause),
515+
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_ADMIN_TO, admin_to),
513516
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISS_TX_CMPL, missing_tx_cmpl),
514517
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_INV_RX_REQ_ID, bad_rx_req_id),
515518
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_INV_TX_REQ_ID, bad_tx_req_id),
@@ -520,6 +523,7 @@ static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_R
520523
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_SUSPECTED_POLL_STARVATION, suspected_poll_starvation),
521524
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED, rx_desc_malformed),
522525
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED, tx_desc_malformed),
526+
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT, missing_admin_interrupt),
523527
};
524528

525529
void ena_set_ethtool_ops(struct net_device *netdev);

drivers/amazon/net/ena/ena_regs_defs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ enum ena_regs_reset_reason_types {
2424
ENA_REGS_RESET_SUSPECTED_POLL_STARVATION = 15,
2525
ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED = 16,
2626
ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED = 17,
27+
ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT = 18,
2728
ENA_REGS_RESET_LAST,
2829
};
2930

drivers/amazon/net/ena/kcompat.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync
531531
static inline bool ena_u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
532532
unsigned int start)
533533
{
534-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
534+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) && \
535+
!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,3))
535536
return u64_stats_fetch_retry_irq(syncp, start);
536537
#else
537538
return u64_stats_fetch_retry(syncp, start);
@@ -540,7 +541,8 @@ static inline bool ena_u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
540541

541542
static inline unsigned int ena_u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
542543
{
543-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
544+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) && \
545+
!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,3))
544546
return u64_stats_fetch_begin_irq(syncp);
545547
#else
546548
return u64_stats_fetch_begin(syncp);
@@ -957,7 +959,8 @@ static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue)
957959
#define NAPIF_STATE_SCHED BIT(NAPI_STATE_SCHED)
958960
#endif
959961

960-
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
962+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) && \
963+
!(defined(IS_UEK) && ENA_KERNEL_VERSION_GTE(5, 15, 0, 100, 96, 32))
961964
#define bpf_warn_invalid_xdp_action(netdev, xdp_prog, verdict) \
962965
bpf_warn_invalid_xdp_action(verdict)
963966
#endif

0 commit comments

Comments
 (0)