Skip to content

Commit 1c6e171

Browse files
authored
[Update] DPDK 20.05, Pktgen 20.03 updates for Ubuntu 20.04
This PR updates DPDK and Pktgen to new versions. This update also ensures compatibility with Ubuntu 20.04. Commit log: * dpdk: Update ONVM to use DPDK v20.05 * onvm: Update onvm to use updated DPDK APIs * Update the onvm manager, nflib and examples to use the updated DPDK APIs. * Update install.sh to enable the igb_uio module build (CONFIG_RTE_EAL_IGB_UIO is disabled by default since v20.02) * switch strncpy to memcpy strncpy raises (precautionary) werrors during onvm compilation with ubuntu 20 compiler (gcc 9); gnu/gcc recommends use of memcpy to avoid warning * update pktgen-dpdk submodule to v20.03 * pktgen submodule updates * pktgen submodule to 807b4d * modify pktgen config args lua pktgen.set_mac() now takes three args: port, src|dst, mac addr * remove pktgen blacklist blacklists outdated as of pktgen v2.7.0 * c linter fixes * shell linter fixes
1 parent 324fef6 commit 1c6e171

File tree

37 files changed

+245
-235
lines changed

37 files changed

+245
-235
lines changed

.gitmodules

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
path = tools/Pktgen/pktgen-dpdk
88
url = http://dpdk.org/git/apps/pktgen-dpdk
99
branch = master
10-
commit = 4199555481cd08fe08e32986c94e59836ca1cd4f
10+
commit = 807b4d2cfcc8ded46ece85353cefe5d655674de3
11+

dpdk

Submodule dpdk updated from 0da7f44 to e2a2344

examples/NFD/dns_amplification_mitigation/DNSAmplificationMitigation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ do_stats_display(struct rte_mbuf *pkt) {
253253
const char clr[] = {27, '[', '2', 'J', '\0'};
254254
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
255255
static uint64_t pkt_process = 0;
256-
struct ipv4_hdr *ip;
256+
struct rte_ipv4_hdr *ip;
257257

258258
pkt_process += print_delay;
259259

examples/NFD/heavy_hitter_detection/HHD.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ do_stats_display(struct rte_mbuf *pkt) {
260260
const char clr[] = {27, '[', '2', 'J', '\0'};
261261
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
262262
static uint64_t pkt_process = 0;
263-
struct ipv4_hdr *ip;
263+
struct rte_ipv4_hdr *ip;
264264

265265
pkt_process += print_delay;
266266

examples/NFD/napt/NAPT.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ do_stats_display(struct rte_mbuf *pkt) {
267267
const char clr[] = {27, '[', '2', 'J', '\0'};
268268
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
269269
static uint64_t pkt_process = 0;
270-
struct ipv4_hdr *ip;
270+
struct rte_ipv4_hdr *ip;
271271

272272
pkt_process += print_delay;
273273

examples/NFD/stateful_firewall/stateful_firewall.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ do_stats_display(struct rte_mbuf *pkt) {
234234
const char clr[] = {27, '[', '2', 'J', '\0'};
235235
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
236236
static uint64_t pkt_process = 0;
237-
struct ipv4_hdr *ip;
237+
struct rte_ipv4_hdr *ip;
238238

239239
pkt_process += print_delay;
240240

examples/NFD/stateless_firewall/stateless_firewall.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ do_stats_display(struct rte_mbuf *pkt) {
227227
const char clr[] = {27, '[', '2', 'J', '\0'};
228228
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
229229
static uint64_t pkt_process = 0;
230-
struct ipv4_hdr *ip;
230+
struct rte_ipv4_hdr *ip;
231231

232232
pkt_process += print_delay;
233233

examples/NFD/super_spreader_detection/SSD.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ do_stats_display(struct rte_mbuf *pkt) {
266266
const char clr[] = {27, '[', '2', 'J', '\0'};
267267
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
268268
static uint64_t pkt_process = 0;
269-
struct ipv4_hdr *ip;
269+
struct rte_ipv4_hdr *ip;
270270

271271
pkt_process += print_delay;
272272

examples/NFD/syn_flood_detection/SYNFloodDetection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ do_stats_display(struct rte_mbuf *pkt) {
264264
const char clr[] = {27, '[', '2', 'J', '\0'};
265265
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
266266
static uint64_t pkt_process = 0;
267-
struct ipv4_hdr *ip;
267+
struct rte_ipv4_hdr *ip;
268268

269269
pkt_process += print_delay;
270270

examples/NFD/udp_flood_mitigation/UDPFloodMitagation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ do_stats_display(struct rte_mbuf *pkt) {
259259
const char clr[] = {27, '[', '2', 'J', '\0'};
260260
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
261261
static uint64_t pkt_process = 0;
262-
struct ipv4_hdr *ip;
262+
struct rte_ipv4_hdr *ip;
263263

264264
pkt_process += print_delay;
265265

examples/aes_decrypt/aesdecrypt.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ do_stats_display(struct rte_mbuf *pkt) {
138138
const char clr[] = {27, '[', '2', 'J', '\0'};
139139
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
140140
static uint64_t pkt_process = 0;
141-
struct ipv4_hdr *ip;
141+
struct rte_ipv4_hdr *ip;
142142

143143
pkt_process += print_delay;
144144

@@ -154,14 +154,14 @@ do_stats_display(struct rte_mbuf *pkt) {
154154

155155
ip = onvm_pkt_ipv4_hdr(pkt);
156156
if (ip != NULL) {
157-
struct udp_hdr *udp;
157+
struct rte_udp_hdr *udp;
158158

159159
onvm_pkt_print(pkt);
160160
/* Check if we have a valid UDP packet */
161161
udp = onvm_pkt_udp_hdr(pkt);
162162
if (udp != NULL) {
163163
uint8_t *pkt_data;
164-
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
164+
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
165165
printf("Payload : %.32s\n", pkt_data);
166166
}
167167
} else {
@@ -172,7 +172,7 @@ do_stats_display(struct rte_mbuf *pkt) {
172172
static int
173173
packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
174174
__attribute__((unused)) struct onvm_nf_local_ctx *nf_local_ctx) {
175-
struct udp_hdr *udp;
175+
struct rte_udp_hdr *udp;
176176
static uint32_t counter = 0;
177177

178178
/* Check if we have a valid UDP packet */
@@ -184,7 +184,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
184184
uint16_t hlen;
185185

186186
/* Get at the payload */
187-
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
187+
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
188188
/* Calculate length */
189189
eth = rte_pktmbuf_mtod(pkt, uint8_t *);
190190
hlen = pkt_data - eth;
@@ -196,7 +196,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
196196
aes_decrypt_ctr(pkt_data, plen, pkt_data, key_schedule, 256, iv[0]);
197197
if (counter == 0) {
198198
printf("Decrypted %d bytes at offset %d (%ld)\n", plen, hlen,
199-
sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr));
199+
sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr));
200200
}
201201
}
202202

examples/aes_encrypt/aesencrypt.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ do_stats_display(struct rte_mbuf *pkt) {
138138
const char clr[] = {27, '[', '2', 'J', '\0'};
139139
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
140140
static uint64_t pkt_process = 0;
141-
struct ipv4_hdr *ip;
141+
struct rte_ipv4_hdr *ip;
142142

143143
pkt_process += print_delay;
144144

@@ -154,14 +154,14 @@ do_stats_display(struct rte_mbuf *pkt) {
154154

155155
ip = onvm_pkt_ipv4_hdr(pkt);
156156
if (ip != NULL) {
157-
struct udp_hdr *udp;
157+
struct rte_udp_hdr *udp;
158158

159159
onvm_pkt_print(pkt);
160160
/* Check if we have a valid UDP packet */
161161
udp = onvm_pkt_udp_hdr(pkt);
162162
if (udp != NULL) {
163163
uint8_t *pkt_data;
164-
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
164+
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
165165
printf("Payload : %.32s\n", pkt_data);
166166
}
167167
} else {
@@ -172,7 +172,7 @@ do_stats_display(struct rte_mbuf *pkt) {
172172
static int
173173
packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
174174
__attribute__((unused)) struct onvm_nf_local_ctx *nf_local_ctx) {
175-
struct udp_hdr *udp;
175+
struct rte_udp_hdr *udp;
176176

177177
static uint32_t counter = 0;
178178
if (++counter == print_delay) {
@@ -189,7 +189,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
189189
uint16_t hlen;
190190

191191
/* Get at the payload */
192-
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
192+
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
193193
/* Calculate length */
194194
eth = rte_pktmbuf_mtod(pkt, uint8_t *);
195195
hlen = pkt_data - eth;
@@ -201,7 +201,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
201201
aes_encrypt_ctr(pkt_data, plen, pkt_data, key_schedule, 256, iv[0]);
202202
if (counter == 0) {
203203
printf("Encrypted %d bytes at offset %d (%ld)\n", plen, hlen,
204-
sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr));
204+
sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr));
205205
}
206206
}
207207

examples/arp_response/arp_response.c

+24-23
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ parse_app_args(int argc, char *argv[], const char *progname) {
211211
* For RFC about ARP, see https://tools.ietf.org/html/rfc826
212212
* RETURNS 0 if success, -1 otherwise */
213213
static int
214-
send_arp_reply(int port, struct ether_addr *tha, uint32_t tip, struct onvm_nf *nf) {
214+
send_arp_reply(int port, struct rte_ether_addr *tha, uint32_t tip, struct onvm_nf *nf) {
215215
struct rte_mbuf *out_pkt = NULL;
216216
struct onvm_pkt_meta *pmeta = NULL;
217-
struct ether_hdr *eth_hdr = NULL;
218-
struct arp_hdr *out_arp_hdr = NULL;
217+
struct rte_ether_hdr *eth_hdr = NULL;
218+
struct rte_arp_hdr *out_arp_hdr = NULL;
219219

220220
size_t pkt_size = 0;
221221

@@ -229,30 +229,30 @@ send_arp_reply(int port, struct ether_addr *tha, uint32_t tip, struct onvm_nf *n
229229
return -1;
230230
}
231231

232-
pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr);
232+
pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr);
233233
out_pkt->data_len = pkt_size;
234234
out_pkt->pkt_len = pkt_size;
235235

236236
// SET ETHER HEADER INFO
237237
eth_hdr = onvm_pkt_ether_hdr(out_pkt);
238-
ether_addr_copy(&ports->mac[port], &eth_hdr->s_addr);
239-
eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP);
240-
ether_addr_copy(tha, &eth_hdr->d_addr);
238+
rte_ether_addr_copy(&ports->mac[port], &eth_hdr->s_addr);
239+
eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP);
240+
rte_ether_addr_copy(tha, &eth_hdr->d_addr);
241241

242242
// SET ARP HDR INFO
243-
out_arp_hdr = rte_pktmbuf_mtod_offset(out_pkt, struct arp_hdr *, sizeof(struct ether_hdr));
243+
out_arp_hdr = rte_pktmbuf_mtod_offset(out_pkt, struct rte_arp_hdr *, sizeof(struct rte_ether_hdr));
244244

245-
out_arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER);
246-
out_arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
247-
out_arp_hdr->arp_hln = 6;
248-
out_arp_hdr->arp_pln = sizeof(uint32_t);
249-
out_arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY);
245+
out_arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
246+
out_arp_hdr->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
247+
out_arp_hdr->arp_hlen = 6;
248+
out_arp_hdr->arp_plen = sizeof(uint32_t);
249+
out_arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY);
250250

251-
ether_addr_copy(&ports->mac[port], &out_arp_hdr->arp_data.arp_sha);
251+
rte_ether_addr_copy(&ports->mac[port], &out_arp_hdr->arp_data.arp_sha);
252252
out_arp_hdr->arp_data.arp_sip = state_info->source_ips[ports->id[port]];
253253

254254
out_arp_hdr->arp_data.arp_tip = tip;
255-
ether_addr_copy(tha, &out_arp_hdr->arp_data.arp_tha);
255+
rte_ether_addr_copy(tha, &out_arp_hdr->arp_data.arp_tha);
256256

257257
// SEND PACKET OUT/SET METAINFO
258258
pmeta = onvm_get_pkt_meta(out_pkt);
@@ -265,8 +265,8 @@ send_arp_reply(int port, struct ether_addr *tha, uint32_t tip, struct onvm_nf *n
265265
static int
266266
packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
267267
__attribute__((unused)) struct onvm_nf_local_ctx *nf_local_ctx) {
268-
struct ether_hdr *eth_hdr = onvm_pkt_ether_hdr(pkt);
269-
struct arp_hdr *in_arp_hdr = NULL;
268+
struct rte_ether_hdr *eth_hdr = onvm_pkt_ether_hdr(pkt);
269+
struct rte_arp_hdr *in_arp_hdr = NULL;
270270
int result = -1;
271271

272272
/*
@@ -276,10 +276,10 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
276276
* If its an ARP REPLY send to dest
277277
* Ignore (fwd to dest) other opcodes
278278
*/
279-
if (rte_cpu_to_be_16(eth_hdr->ether_type) == ETHER_TYPE_ARP) {
280-
in_arp_hdr = rte_pktmbuf_mtod_offset(pkt, struct arp_hdr *, sizeof(struct ether_hdr));
281-
switch (rte_cpu_to_be_16(in_arp_hdr->arp_op)) {
282-
case ARP_OP_REQUEST:
279+
if (rte_cpu_to_be_16(eth_hdr->ether_type) == RTE_ETHER_TYPE_ARP) {
280+
in_arp_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_arp_hdr *, sizeof(struct rte_ether_hdr));
281+
switch (rte_cpu_to_be_16(in_arp_hdr->arp_opcode)) {
282+
case RTE_ARP_OP_REQUEST:
283283
if (rte_be_to_cpu_32(in_arp_hdr->arp_data.arp_tip) ==
284284
state_info->source_ips[ports->id[pkt->port]]) {
285285
result = send_arp_reply(pkt->port, &eth_hdr->s_addr,
@@ -292,13 +292,14 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
292292
return 0;
293293
}
294294
break;
295-
case ARP_OP_REPLY:
295+
case RTE_ARP_OP_REPLY:
296296
/* Here we can potentially save the information */
297297
break;
298298
default:
299299
if (state_info->print_flag) {
300300
printf("ARP with opcode %d, port %d (ID %d) DROPPED\n",
301-
rte_cpu_to_be_16(in_arp_hdr->arp_op), pkt->port, ports->id[pkt->port]);
301+
rte_cpu_to_be_16(in_arp_hdr->arp_opcode),
302+
pkt->port, ports->id[pkt->port]);
302303
}
303304
}
304305
}

examples/basic_monitor/monitor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ do_stats_display(struct rte_mbuf *pkt) {
122122
const char clr[] = {27, '[', '2', 'J', '\0'};
123123
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
124124
static uint64_t pkt_process = 0;
125-
struct ipv4_hdr *ip;
125+
struct rte_ipv4_hdr *ip;
126126

127127
pkt_process += print_delay;
128128

examples/bridge/bridge.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ do_stats_display(struct rte_mbuf *pkt) {
114114
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
115115
static uint64_t pkt_process = 0;
116116

117-
struct ipv4_hdr *ip;
117+
struct rte_ipv4_hdr *ip;
118118

119119
pkt_process += print_delay;
120120

examples/firewall/firewall.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ do_stats_display(void) {
197197
static int
198198
packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
199199
__attribute__((unused)) struct onvm_nf_local_ctx *nf_local_ctx) {
200-
struct ipv4_hdr *ipv4_hdr;
200+
struct rte_ipv4_hdr *ipv4_hdr;
201201
static uint32_t counter = 0;
202202
int ret;
203203
uint32_t rule = 0;

examples/flow_table/flow_table.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ do_stats_display(struct rte_mbuf *pkt, int32_t tbl_index) {
168168
printf("\n\n");
169169

170170
#ifdef DEBUG_PRINT
171-
struct ipv4_hdr *ip;
171+
struct rte_ipv4_hdr *ip;
172172
ip = onvm_pkt_ipv4_hdr(pkt);
173173
if (ip != NULL) {
174174
onvm_pkt_print(pkt);

0 commit comments

Comments
 (0)