forked from amzn/amzn-drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0015-net-ena-get-device-info-statically.patch
135 lines (118 loc) · 4.8 KB
/
0015-net-ena-get-device-info-statically.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
From 2b83153af74ba5661c3b65164a48d14aa043b01c Mon Sep 17 00:00:00 2001
From: Michal Krawczyk <[email protected]>
Date: Fri, 15 Feb 2019 09:36:39 +0100
Subject: [PATCH 15/27] net/ena: get device info statically
[ upstream commit 117ba4a60488a0f96a5737f38ddba6d0f9a728b6 ]
Whenever the app is calling rte_eth_dev_info_get(), it shouldn't use the
admin command. It was causing problems, if it was called from the
secondary process - the main process was crashing, and the secondary app
wasn't getting any result, as the admin request couldn't be processed by
the process which was requesting the data.
To fix that, the data is being written to the adapter structure during
device initialization routine.
Change-Id: I94f61f51223725602f70ac9795acf02b7b014984
Signed-off-by: Michal Krawczyk <[email protected]>
---
drivers/net/ena/ena_ethdev.c | 35 ++++++++++++++---------------------
drivers/net/ena/ena_ethdev.h | 8 +++++++-
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 26316fa752..05624cc646 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1604,9 +1604,14 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
/* Set max MTU for this device */
adapter->max_mtu = get_feat_ctx.dev_attr.max_mtu;
- /* set device support for TSO */
- adapter->tso4_supported = get_feat_ctx.offload.tx &
- ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK;
+ /* set device support for offloads */
+ adapter->offloads.tso4_supported = (get_feat_ctx.offload.tx &
+ ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK) != 0;
+ adapter->offloads.tx_csum_supported = (get_feat_ctx.offload.tx &
+ ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK) != 0;
+ adapter->offloads.tx_csum_supported =
+ (get_feat_ctx.offload.rx_supported &
+ ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) != 0;
/* Copy MAC address and point DPDK to it */
eth_dev->data->mac_addrs = (struct ether_addr *)adapter->mac_addr;
@@ -1746,9 +1751,7 @@ static void ena_infos_get(struct rte_eth_dev *dev,
{
struct ena_adapter *adapter;
struct ena_com_dev *ena_dev;
- struct ena_com_dev_get_features_ctx feat;
uint64_t rx_feat = 0, tx_feat = 0;
- int rc = 0;
ena_assert_msg(dev->data != NULL, "Uninitialized device");
ena_assert_msg(dev->data->dev_private != NULL, "Uninitialized device");
@@ -1767,26 +1770,16 @@ static void ena_infos_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G;
- /* Get supported features from HW */
- rc = ena_com_get_dev_attr_feat(ena_dev, &feat);
- if (unlikely(rc)) {
- RTE_LOG(ERR, PMD,
- "Cannot get attribute for ena device rc= %d\n", rc);
- return;
- }
-
/* Set Tx & Rx features available for device */
- if (feat.offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK)
+ if (adapter->offloads.tso4_supported)
tx_feat |= DEV_TX_OFFLOAD_TCP_TSO;
- if (feat.offload.tx &
- ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK)
+ if (adapter->offloads.tx_csum_supported)
tx_feat |= DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
DEV_TX_OFFLOAD_TCP_CKSUM;
- if (feat.offload.rx_supported &
- ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK)
+ if (adapter->offloads.rx_csum_supported)
rx_feat |= DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM |
DEV_RX_OFFLOAD_TCP_CKSUM;
@@ -1819,9 +1812,9 @@ static void ena_infos_get(struct rte_eth_dev *dev,
dev_info->tx_desc_lim.nb_max = ENA_MAX_RING_DESC;
dev_info->tx_desc_lim.nb_min = ENA_MIN_RING_DESC;
dev_info->tx_desc_lim.nb_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS,
- feat.max_queues.max_packet_tx_descs);
+ adapter->max_tx_sgl_size);
dev_info->tx_desc_lim.nb_mtu_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS,
- feat.max_queues.max_packet_tx_descs);
+ adapter->max_tx_sgl_size);
}
static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -1966,7 +1959,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
/* If IPv4 header has DF flag enabled and TSO support is
* disabled, partial chcecksum should not be calculated.
*/
- if (!tx_ring->adapter->tso4_supported)
+ if (!tx_ring->adapter->offloads.tso4_supported)
continue;
}
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 8eb8543c21..982ad7854e 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -160,6 +160,12 @@ struct ena_stats_rx {
u64 small_copy_len_pkt;
};
+struct ena_offloads {
+ bool tso4_supported;
+ bool tx_csum_supported;
+ bool rx_csum_supported;
+};
+
/* board specific private data structure */
struct ena_adapter {
/* OS defined structs */
@@ -180,7 +186,7 @@ struct ena_adapter {
u16 num_queues;
u16 max_mtu;
- u8 tso4_supported;
+ struct ena_offloads offloads;
int id_number;
char name[ENA_NAME_MAX_LEN];
--
2.20.1