Skip to content

Commit 9878f60

Browse files
committed
Merge branch 'ena-bug-fixes'
Netanel Belgazal says: ==================== Bug Fixes in ENA driver Changes from V3: * Rebase patchset to master and solve merge conflicts. * Remove redundant bug fix (fix error handling when probe fails) ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b66a804 + 3e5d689 commit 9878f60

File tree

6 files changed

+172
-83
lines changed

6 files changed

+172
-83
lines changed

drivers/net/ethernet/amazon/ena/ena_admin_defs.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,22 +631,22 @@ enum ena_admin_flow_hash_proto {
631631
/* RSS flow hash fields */
632632
enum ena_admin_flow_hash_fields {
633633
/* Ethernet Dest Addr */
634-
ENA_ADMIN_RSS_L2_DA = 0,
634+
ENA_ADMIN_RSS_L2_DA = BIT(0),
635635

636636
/* Ethernet Src Addr */
637-
ENA_ADMIN_RSS_L2_SA = 1,
637+
ENA_ADMIN_RSS_L2_SA = BIT(1),
638638

639639
/* ipv4/6 Dest Addr */
640-
ENA_ADMIN_RSS_L3_DA = 2,
640+
ENA_ADMIN_RSS_L3_DA = BIT(2),
641641

642642
/* ipv4/6 Src Addr */
643-
ENA_ADMIN_RSS_L3_SA = 5,
643+
ENA_ADMIN_RSS_L3_SA = BIT(3),
644644

645645
/* tcp/udp Dest Port */
646-
ENA_ADMIN_RSS_L4_DP = 6,
646+
ENA_ADMIN_RSS_L4_DP = BIT(4),
647647

648648
/* tcp/udp Src Port */
649-
ENA_ADMIN_RSS_L4_SP = 7,
649+
ENA_ADMIN_RSS_L4_SP = BIT(5),
650650
};
651651

652652
struct ena_admin_proto_input {
@@ -873,6 +873,14 @@ struct ena_admin_aenq_link_change_desc {
873873
u32 flags;
874874
};
875875

876+
struct ena_admin_aenq_keep_alive_desc {
877+
struct ena_admin_aenq_common_desc aenq_common_desc;
878+
879+
u32 rx_drops_low;
880+
881+
u32 rx_drops_high;
882+
};
883+
876884
struct ena_admin_ena_mmio_req_read_less_resp {
877885
u16 req_id;
878886

drivers/net/ethernet/amazon/ena/ena_com.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
/*****************************************************************************/
3737

3838
/* Timeout in micro-sec */
39-
#define ADMIN_CMD_TIMEOUT_US (1000000)
39+
#define ADMIN_CMD_TIMEOUT_US (3000000)
4040

41-
#define ENA_ASYNC_QUEUE_DEPTH 4
41+
#define ENA_ASYNC_QUEUE_DEPTH 16
4242
#define ENA_ADMIN_QUEUE_DEPTH 32
4343

4444
#define MIN_ENA_VER (((ENA_COMMON_SPEC_VERSION_MAJOR) << \
@@ -784,7 +784,7 @@ static int ena_com_get_feature_ex(struct ena_com_dev *ena_dev,
784784
int ret;
785785

786786
if (!ena_com_check_supported_feature_id(ena_dev, feature_id)) {
787-
pr_info("Feature %d isn't supported\n", feature_id);
787+
pr_debug("Feature %d isn't supported\n", feature_id);
788788
return -EPERM;
789789
}
790790

@@ -1126,7 +1126,13 @@ int ena_com_execute_admin_command(struct ena_com_admin_queue *admin_queue,
11261126
comp_ctx = ena_com_submit_admin_cmd(admin_queue, cmd, cmd_size,
11271127
comp, comp_size);
11281128
if (unlikely(IS_ERR(comp_ctx))) {
1129-
pr_err("Failed to submit command [%ld]\n", PTR_ERR(comp_ctx));
1129+
if (comp_ctx == ERR_PTR(-ENODEV))
1130+
pr_debug("Failed to submit command [%ld]\n",
1131+
PTR_ERR(comp_ctx));
1132+
else
1133+
pr_err("Failed to submit command [%ld]\n",
1134+
PTR_ERR(comp_ctx));
1135+
11301136
return PTR_ERR(comp_ctx);
11311137
}
11321138

@@ -1895,7 +1901,7 @@ int ena_com_set_dev_mtu(struct ena_com_dev *ena_dev, int mtu)
18951901
int ret;
18961902

18971903
if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_MTU)) {
1898-
pr_info("Feature %d isn't supported\n", ENA_ADMIN_MTU);
1904+
pr_debug("Feature %d isn't supported\n", ENA_ADMIN_MTU);
18991905
return -EPERM;
19001906
}
19011907

@@ -1948,8 +1954,8 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
19481954

19491955
if (!ena_com_check_supported_feature_id(ena_dev,
19501956
ENA_ADMIN_RSS_HASH_FUNCTION)) {
1951-
pr_info("Feature %d isn't supported\n",
1952-
ENA_ADMIN_RSS_HASH_FUNCTION);
1957+
pr_debug("Feature %d isn't supported\n",
1958+
ENA_ADMIN_RSS_HASH_FUNCTION);
19531959
return -EPERM;
19541960
}
19551961

@@ -2112,7 +2118,8 @@ int ena_com_set_hash_ctrl(struct ena_com_dev *ena_dev)
21122118

21132119
if (!ena_com_check_supported_feature_id(ena_dev,
21142120
ENA_ADMIN_RSS_HASH_INPUT)) {
2115-
pr_info("Feature %d isn't supported\n", ENA_ADMIN_RSS_HASH_INPUT);
2121+
pr_debug("Feature %d isn't supported\n",
2122+
ENA_ADMIN_RSS_HASH_INPUT);
21162123
return -EPERM;
21172124
}
21182125

@@ -2184,7 +2191,7 @@ int ena_com_set_default_hash_ctrl(struct ena_com_dev *ena_dev)
21842191
hash_ctrl->selected_fields[ENA_ADMIN_RSS_IP4_FRAG].fields =
21852192
ENA_ADMIN_RSS_L3_SA | ENA_ADMIN_RSS_L3_DA;
21862193

2187-
hash_ctrl->selected_fields[ENA_ADMIN_RSS_IP4_FRAG].fields =
2194+
hash_ctrl->selected_fields[ENA_ADMIN_RSS_NOT_IP].fields =
21882195
ENA_ADMIN_RSS_L2_DA | ENA_ADMIN_RSS_L2_SA;
21892196

21902197
for (i = 0; i < ENA_ADMIN_RSS_PROTO_NUM; i++) {
@@ -2270,8 +2277,8 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
22702277

22712278
if (!ena_com_check_supported_feature_id(
22722279
ena_dev, ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG)) {
2273-
pr_info("Feature %d isn't supported\n",
2274-
ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG);
2280+
pr_debug("Feature %d isn't supported\n",
2281+
ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG);
22752282
return -EPERM;
22762283
}
22772284

@@ -2444,11 +2451,9 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
24442451

24452452
int ret;
24462453

2447-
if (!ena_com_check_supported_feature_id(ena_dev,
2448-
ENA_ADMIN_HOST_ATTR_CONFIG)) {
2449-
pr_warn("Set host attribute isn't supported\n");
2450-
return -EPERM;
2451-
}
2454+
/* Host attribute config is called before ena_com_get_dev_attr_feat
2455+
* so ena_com can't check if the feature is supported.
2456+
*/
24522457

24532458
memset(&cmd, 0x0, sizeof(cmd));
24542459
admin_queue = &ena_dev->admin_queue;
@@ -2542,8 +2547,8 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
25422547

25432548
if (rc) {
25442549
if (rc == -EPERM) {
2545-
pr_info("Feature %d isn't supported\n",
2546-
ENA_ADMIN_INTERRUPT_MODERATION);
2550+
pr_debug("Feature %d isn't supported\n",
2551+
ENA_ADMIN_INTERRUPT_MODERATION);
25472552
rc = 0;
25482553
} else {
25492554
pr_err("Failed to get interrupt moderation admin cmd. rc: %d\n",

drivers/net/ethernet/amazon/ena/ena_com.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#ifndef ENA_COM
3434
#define ENA_COM
3535

36+
#include <linux/compiler.h>
3637
#include <linux/delay.h>
3738
#include <linux/dma-mapping.h>
3839
#include <linux/gfp.h>

drivers/net/ethernet/amazon/ena/ena_eth_com.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static inline struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(
4545
cdesc = (struct ena_eth_io_rx_cdesc_base *)(io_cq->cdesc_addr.virt_addr
4646
+ (head_masked * io_cq->cdesc_entry_size_in_bytes));
4747

48-
desc_phase = (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK) >>
48+
desc_phase = (READ_ONCE(cdesc->status) & ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK) >>
4949
ENA_ETH_IO_RX_CDESC_BASE_PHASE_SHIFT;
5050

5151
if (desc_phase != expected_phase)
@@ -141,7 +141,7 @@ static inline u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
141141

142142
ena_com_cq_inc_head(io_cq);
143143
count++;
144-
last = (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >>
144+
last = (READ_ONCE(cdesc->status) & ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >>
145145
ENA_ETH_IO_RX_CDESC_BASE_LAST_SHIFT;
146146
} while (!last);
147147

@@ -489,13 +489,13 @@ int ena_com_tx_comp_req_id_get(struct ena_com_io_cq *io_cq, u16 *req_id)
489489
* expected, it mean that the device still didn't update
490490
* this completion.
491491
*/
492-
cdesc_phase = cdesc->flags & ENA_ETH_IO_TX_CDESC_PHASE_MASK;
492+
cdesc_phase = READ_ONCE(cdesc->flags) & ENA_ETH_IO_TX_CDESC_PHASE_MASK;
493493
if (cdesc_phase != expected_phase)
494494
return -EAGAIN;
495495

496496
ena_com_cq_inc_head(io_cq);
497497

498-
*req_id = cdesc->req_id;
498+
*req_id = READ_ONCE(cdesc->req_id);
499499

500500
return 0;
501501
}

0 commit comments

Comments
 (0)