diff options
author | 2018-12-18 15:06:09 +0000 | |
---|---|---|
committer | 2018-12-18 15:06:09 +0000 | |
commit | a9f8ae63f7b3b5cdc566bdaaf4521658779a86f7 (patch) | |
tree | fb61926040ef05d2283ba901e9a63fd2d7e83c0e /VNFs/DPPD-PROX/tx_pkt.c | |
parent | b14294c202c380a8520f19179d4f96bd6becc55e (diff) | |
parent | 63b9e164a14d48acc37d325c0cb5387602d8e631 (diff) |
Merge changes from topic 'fix_multiple_arp_issues'
* changes:
Fix arp handling when master core is on socket 1
Add support for zero packet loss in PROX L3 mode.
Fix issue in l3 mode when no arp reply was received
Clean up debugging messages
Diffstat (limited to 'VNFs/DPPD-PROX/tx_pkt.c')
-rw-r--r-- | VNFs/DPPD-PROX/tx_pkt.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/VNFs/DPPD-PROX/tx_pkt.c b/VNFs/DPPD-PROX/tx_pkt.c index 49f46898..c5047e56 100644 --- a/VNFs/DPPD-PROX/tx_pkt.c +++ b/VNFs/DPPD-PROX/tx_pkt.c @@ -55,22 +55,39 @@ int tx_pkt_l3(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts, uint32_t ip_dst; int first = 0, ret, ok = 0, rc; const struct port_queue *port_queue = &tbase->tx_params_hw.tx_port_queue[0]; + struct rte_mbuf *arp_mbuf = NULL; // used when one need to send both an ARP and a mbuf for (int j = 0; j < n_pkts; j++) { if ((out) && (out[j] >= OUT_HANDLED)) continue; - if (unlikely((rc = write_dst_mac(tbase, mbufs[j], &ip_dst)) < 0)) { + if (unlikely((rc = write_dst_mac(tbase, mbufs[j], &ip_dst)) != SEND_MBUF)) { if (j - first) { ret = tbase->aux->tx_pkt_l2(tbase, mbufs + first, j - first, out); ok += ret; } first = j + 1; - if (rc == -1) { + switch(rc) { + case SEND_ARP: + // We re-use the mbuf - no need to create a arp_mbuf and delete the existing mbuf mbufs[j]->port = tbase->l3.reachable_port_id; tx_ring_cti(tbase, tbase->l3.ctrl_plane_ring, REQ_MAC_TO_CTRL, mbufs[j], tbase->l3.core_id, tbase->l3.task_id, ip_dst); - } else if (rc == -2) { + break; + case SEND_MBUF_AND_ARP: + // We send the mbuf and an ARP - we need to allocate another mbuf for ARP + ret = rte_mempool_get(tbase->l3.arp_pool, (void **)&arp_mbuf); + if (likely(ret == 0)) { + arp_mbuf->port = tbase->l3.reachable_port_id; + tx_ring_cti(tbase, tbase->l3.ctrl_plane_ring, REQ_MAC_TO_CTRL, arp_mbuf, tbase->l3.core_id, tbase->l3.task_id, ip_dst); + } else { + plog_err("Failed to get a mbuf from arp mempool\n"); + // We still send the initial mbuf + } + ret = tbase->aux->tx_pkt_l2(tbase, mbufs + j, 1, out); + break; + case DROP_MBUF: tx_drop(mbufs[j]); TASK_STATS_ADD_DROP_DISCARD(&tbase->aux->stats, 1); + break; } } } @@ -757,10 +774,10 @@ static inline int tx_ring_all(struct task_base *tbase, struct rte_ring *ring, ui void tx_ring_cti(struct task_base *tbase, struct rte_ring *ring, uint16_t command, struct rte_mbuf *mbuf, uint8_t core_id, uint8_t task_id, uint32_t ip) { - plogx_dbg("\tSending command %s with ip %x to ring %p using mbuf %p, core %d and task %d - ring size now %d\n", actions_string[command], ip, ring, mbuf, core_id, task_id, rte_ring_free_count(ring)); + plogx_dbg("\tSending command %s with ip %d.%d.%d.%d to ring %p using mbuf %p, core %d and task %d - ring size now %d\n", actions_string[command], IP4(ip), ring, mbuf, core_id, task_id, rte_ring_free_count(ring)); int ret = tx_ring_all(tbase, ring, command, mbuf, core_id, task_id, ip); if (unlikely(ret != 0)) { - plogx_dbg("\tFail to send command %s with ip %x to ring %p using mbuf %p, core %d and task %d - ring size now %d\n", actions_string[command], ip, ring, mbuf, core_id, task_id, rte_ring_free_count(ring)); + plogx_dbg("\tFail to send command %s with ip %d.%d.%d.%d to ring %p using mbuf %p, core %d and task %d - ring size now %d\n", actions_string[command], IP4(ip), ring, mbuf, core_id, task_id, rte_ring_free_count(ring)); TASK_STATS_ADD_DROP_DISCARD(&tbase->aux->stats, 1); rte_pktmbuf_free(mbuf); } @@ -768,10 +785,10 @@ void tx_ring_cti(struct task_base *tbase, struct rte_ring *ring, uint16_t comman void tx_ring_ip(struct task_base *tbase, struct rte_ring *ring, uint16_t command, struct rte_mbuf *mbuf, uint32_t ip) { - plogx_dbg("\tSending command %s with ip %x to ring %p using mbuf %p - ring size now %d\n", actions_string[command], ip, ring, mbuf, rte_ring_free_count(ring)); + plogx_dbg("\tSending command %s with ip %d.%d.%d.%d to ring %p using mbuf %p - ring size now %d\n", actions_string[command], IP4(ip), ring, mbuf, rte_ring_free_count(ring)); int ret = tx_ring_all(tbase, ring, command, mbuf, 0, 0, ip); if (unlikely(ret != 0)) { - plogx_dbg("\tFail to send command %s with ip %x to ring %p using mbuf %p - ring size now %d\n", actions_string[command], ip, ring, mbuf, rte_ring_free_count(ring)); + plogx_dbg("\tFail to send command %s with ip %d.%d.%d.%d to ring %p using mbuf %p - ring size now %d\n", actions_string[command], IP4(ip), ring, mbuf, rte_ring_free_count(ring)); TASK_STATS_ADD_DROP_DISCARD(&tbase->aux->stats, 1); rte_pktmbuf_free(mbuf); } |