summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/handle_nat.c')
-rw-r--r--VNFs/DPPD-PROX/handle_nat.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/VNFs/DPPD-PROX/handle_nat.c b/VNFs/DPPD-PROX/handle_nat.c
index 23d7ad87..ad0fcf45 100644
--- a/VNFs/DPPD-PROX/handle_nat.c
+++ b/VNFs/DPPD-PROX/handle_nat.c
@@ -45,9 +45,9 @@ struct task_nat {
};
struct pkt_eth_ipv4 {
- struct ether_hdr ether_hdr;
- struct ipv4_hdr ipv4_hdr;
-} __attribute__((packed));
+ prox_rte_ether_hdr ether_hdr;
+ prox_rte_ipv4_hdr ipv4_hdr;
+} __attribute__((packed)) __attribute__((__aligned__(2)));
static int handle_nat(struct task_nat *task, struct rte_mbuf *mbuf)
{
@@ -71,7 +71,7 @@ static int handle_nat(struct task_nat *task, struct rte_mbuf *mbuf)
return OUT_DISCARD;
*ip_addr = task->entries[ret];
- prox_ip_udp_cksum(mbuf, &pkt->ipv4_hdr, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), task->offload_crc);
+ prox_ip_udp_cksum(mbuf, &pkt->ipv4_hdr, sizeof(prox_rte_ether_hdr), sizeof(prox_rte_ipv4_hdr), task->offload_crc);
return 0;
}
@@ -123,6 +123,7 @@ static int lua_to_hash_nat(struct lua_State *L, enum lua_place from, const char
.key_len = sizeof(ip_from),
.hash_func = rte_hash_crc,
.hash_func_init_val = 0,
+ .socket_id = socket,
};
ret_hash = rte_hash_create(&hash_params);
@@ -171,7 +172,7 @@ static void init_task_nat(struct task_base *tbase, struct task_args *targ)
PROX_PANIC(ret != 0, "Failed to load NAT table from lua:\n%s\n", get_lua_to_errors());
struct prox_port_cfg *port = find_reachable_port(targ);
if (port) {
- task->offload_crc = port->capabilities.tx_offload_cksum;
+ task->offload_crc = port->requested_tx_offload & (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM);
}
}
@@ -182,12 +183,11 @@ static struct task_init task_init_nat = {
.init = init_task_nat,
.handle = handle_nat_bulk,
#ifdef SOFT_CRC
- .flag_features = TASK_FEATURE_TXQ_FLAGS_NOOFFLOADS|TASK_FEATURE_TXQ_FLAGS_NOMULTSEGS,
+ .flag_features = TASK_FEATURE_TXQ_FLAGS_NOOFFLOADS,
#else
- .flag_features = TASK_FEATURE_TXQ_FLAGS_NOMULTSEGS,
+ .flag_features = 0,
#endif
.size = sizeof(struct task_nat),
- .mbuf_size = 2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM,
};
__attribute__((constructor)) static void reg_task_nat(void)