> -----Original Message----- > From: EXT Zoltan Kiss [mailto:[email protected]] > Sent: Thursday, January 28, 2016 1:13 PM > To: Elo, Matias (Nokia - FI/Espoo) <[email protected]>; lng- > [email protected] > Subject: Re: [lng-odp] [API-NEXT PATCH 04/11] linux-generic: dpdk: add rx/tx > locking > > linux-generic pktio has now separate rx/tx locks, what's the purpose of > this extra locking?
The new MQ pktio odp_pktio_recv_queue() and odp_pktio_send_queue() don't have locks anymore. > > On 28/01/16 07:03, Matias Elo wrote: > > Add locking support to dpdk_recv_queue() and > > dpdk_send_queue(). > > > > Reviewed-by: Petri Savolainen <[email protected]> > > Signed-off-by: Matias Elo <[email protected]> > > --- > > platform/linux-generic/include/odp_packet_dpdk.h | 5 +++++ > > platform/linux-generic/pktio/dpdk.c | 19 +++++++++++++++++++ > > 2 files changed, 24 insertions(+) > > > > diff --git a/platform/linux-generic/include/odp_packet_dpdk.h > b/platform/linux-generic/include/odp_packet_dpdk.h > > index 5676f4c..659f08d 100644 > > --- a/platform/linux-generic/include/odp_packet_dpdk.h > > +++ b/platform/linux-generic/include/odp_packet_dpdk.h > > @@ -9,6 +9,7 @@ > > > > #include <odp/packet_io.h> > > #include <odp/pool.h> > > +#include <odp/ticketlock.h> > > > > #include <net/if.h> > > > > @@ -38,6 +39,10 @@ typedef struct { > > /** DPDK packet pool name (pktpool_<ifname>) */ > > char pool_name[IF_NAMESIZE + 8]; > > uint8_t port_id; /**< DPDK port identifier */ > > + odp_bool_t lockless_rx; /**< no locking for rx */ > > + odp_bool_t lockless_tx; /**< no locking for tx */ > > + odp_ticketlock_t rx_lock[PKTIO_MAX_QUEUES]; /**< RX queue locks */ > > + odp_ticketlock_t tx_lock[PKTIO_MAX_QUEUES]; /**< TX queue locks */ > > } pkt_dpdk_t; > > > > #endif > > diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux- > generic/pktio/dpdk.c > > index aad4066..7a82b07 100644 > > --- a/platform/linux-generic/pktio/dpdk.c > > +++ b/platform/linux-generic/pktio/dpdk.c > > @@ -277,6 +277,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, > > struct rte_mempool *pkt_pool; > > odp_pool_info_t pool_info; > > uint16_t data_room; > > + int i; > > > > if (getenv("ODP_PKTIO_DISABLE_DPDK")) > > return -1; > > @@ -338,6 +339,11 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, > > RTE_PKTMBUF_HEADROOM; > > pkt_dpdk->data_room = RTE_MIN(pool_info.params.pkt.len, > data_room); > > > > + for (i = 0; i < PKTIO_MAX_QUEUES; i++) { > > + odp_ticketlock_init(&pkt_dpdk->rx_lock[i]); > > + odp_ticketlock_init(&pkt_dpdk->tx_lock[i]); > > + } > > + > > return 0; > > } > > > > @@ -497,16 +503,23 @@ static int dpdk_recv_queue(pktio_entry_t > *pktio_entry, > > odp_packet_t pkt_table[], > > int num) > > { > > + pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk; > > uint16_t nb_rx; > > > > struct rte_mbuf *rx_mbufs[num]; > > > > + if (!pkt_dpdk->lockless_rx) > > + odp_ticketlock_lock(&pkt_dpdk->rx_lock[index]); > > + > > nb_rx = rte_eth_rx_burst(pktio_entry->s.pkt_dpdk.port_id, index, > > rx_mbufs, num); > > > > if (nb_rx > 0) > > nb_rx = mbuf_to_pkt(pktio_entry, pkt_table, rx_mbufs, nb_rx); > > > > + if (!pktio_entry->s.pkt_dpdk.lockless_rx) > > + odp_ticketlock_unlock(&pkt_dpdk->rx_lock[index]); > > + > > return nb_rx; > > } > > > > @@ -528,6 +541,9 @@ static int dpdk_send_queue(pktio_entry_t > *pktio_entry, > > int i; > > int mbufs; > > > > + if (!pktio_entry->s.pkt_dpdk.lockless_tx) > > + odp_ticketlock_lock(&pkt_dpdk->tx_lock[index]); > > + > > mbufs = pkt_to_mbuf(pktio_entry, tx_mbufs, pkt_table, num); > > > > tx_pkts = rte_eth_tx_burst(pkt_dpdk->port_id, index, > > @@ -540,6 +556,9 @@ static int dpdk_send_queue(pktio_entry_t > *pktio_entry, > > > > odp_packet_free_multi(pkt_table, tx_pkts); > > > > + if (!pktio_entry->s.pkt_dpdk.lockless_tx) > > + odp_ticketlock_unlock(&pkt_dpdk->tx_lock[index]); > > + > > if (odp_unlikely(tx_pkts == 0 && __odp_errno != 0)) > > return -1; > > > > _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
