mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netdev: Create multiple pmd threads by default.
With this commit, ovs by default will create one pmd thread for each numa node and pin the pmd thread to available cpu core on the numa node. NON_PMD_CORE_ID (currently 0) is used to reserve a particular cpu core for the I/O of all non-pmd threads. No pmd thread can be pinned to this reserved core. As side-effects of this commit: - pmd thread will not be created, if there is no dpdk interface from the corresponding numa node added to ovs. - the exact-match cache for non-pmd threads is removed from 'struct dp_netdev'. Instead, all non-pmd threads will use the exact-match cache defined in the 'struct dp_netdev_pmd_thread' for NON_PMD_CORE_ID. - the rx packet processing functions are refactored to use 'struct dp_netdev_pmd_thread' as input. - the 'netdev_send()' function will be called with the proper queue id. - both pmd and non-pmd threads can call the dpif_netdev_execute(). so, use a per-thread key to help recognize the calling thread. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
@@ -493,8 +493,7 @@ netdev_dpdk_init(struct netdev *netdev_, unsigned int port_no)
|
||||
|
||||
ovs_mutex_lock(&netdev->mutex);
|
||||
|
||||
/* XXX: need to discover device node at run time. */
|
||||
netdev->socket_id = SOCKET0;
|
||||
netdev->socket_id = rte_eth_dev_socket_id(port_no);
|
||||
netdev_dpdk_set_txq(netdev, NR_QUEUE);
|
||||
netdev->port_id = port_no;
|
||||
netdev->flags = 0;
|
||||
@@ -860,8 +859,6 @@ netdev_dpdk_send(struct netdev *netdev, int qid, struct dpif_packet **pkts,
|
||||
int next_tx_idx = 0;
|
||||
int dropped = 0;
|
||||
|
||||
qid = rte_lcore_id();
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
int size = ofpbuf_size(&pkts[i]->ofpbuf);
|
||||
if (OVS_UNLIKELY(size > dev->max_packet_len)) {
|
||||
@@ -1518,7 +1515,8 @@ pmd_thread_setaffinity_cpu(int cpu)
|
||||
return err;
|
||||
}
|
||||
/* lcore_id 0 is reseved for use by non pmd threads. */
|
||||
RTE_PER_LCORE(_lcore_id) = cpu + 1;
|
||||
ovs_assert(cpu);
|
||||
RTE_PER_LCORE(_lcore_id) = cpu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1526,9 +1524,6 @@ pmd_thread_setaffinity_cpu(int cpu)
|
||||
void
|
||||
thread_set_nonpmd(void)
|
||||
{
|
||||
/* We cannot have RTE_MAX_LCORE pmd threads, because lcore_id 0 is reserved
|
||||
* for non pmd threads */
|
||||
BUILD_ASSERT(NR_PMD_THREADS < RTE_MAX_LCORE);
|
||||
/* We have to use 0 to allow non pmd threads to perform certain DPDK
|
||||
* operations, like rte_eth_dev_configure(). */
|
||||
RTE_PER_LCORE(_lcore_id) = 0;
|
||||
|
Reference in New Issue
Block a user