From: wangze <wang...@chinatelecom.cn> When doing set_queue action, skb_priority is marked in userspace, but there is no further processing in datapath dpdk. This patch add set_queue support in datapath dpdk, sending skbs from specific queues according to the skb_priority.
The enqueue action can be applied to the scenario of double-sending arp packets in bond, usage: ovs-ofctl add-flow br-ext "priority=10000,in_port=LOCAL,arp actions=push_vlan: 0x8100,set_field:4397->vlan_vid,set_queue:1,output:bond1,pop_queue,set_queue:2, output:bond1,pop_queue" -Oopenflow13 Signed-off-by: wangze <wang...@chinatelecom.cn> Reviewed-by: wenxu <we...@chinatelecom.cn> --- lib/dpif-netdev.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 924f10c..cec756e 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -6526,6 +6526,28 @@ pmd_perf_metrics_enabled(const struct dp_netdev_pmd_thread *pmd OVS_UNUSED) #endif static int +dp_netdev_pmd_flush_txqs_on_port(struct dp_netdev_pmd_thread *pmd, + struct tx_port *p) +{ + int i; + int output_cnt = 0; + + int n_txq = netdev_n_txq(p->port->netdev); + + for (i = 0; i < n_txq; i++) { + if (dp_packet_batch_is_empty(&p->txq_pkts[i])) { + continue; + } + output_cnt += dp_packet_batch_size(&p->txq_pkts[i]); + netdev_send(p->port->netdev, i, &p->txq_pkts[i], true); + dp_packet_batch_init(&p->txq_pkts[i]); + } + + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SENT_PKTS, output_cnt); + return output_cnt; +} + +static int dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd, struct tx_port *p) { @@ -9010,13 +9032,11 @@ dp_netdev_add_port_tx_to_pmd(struct dp_netdev_pmd_thread *pmd, tx->flush_time = 0LL; dp_packet_batch_init(&tx->output_pkts); - if (tx->port->txq_mode == TXQ_MODE_XPS_HASH) { - int i, n_txq = netdev_n_txq(tx->port->netdev); + int i, n_txq = netdev_n_txq(tx->port->netdev); - tx->txq_pkts = xzalloc(n_txq * sizeof *tx->txq_pkts); - for (i = 0; i < n_txq; i++) { - dp_packet_batch_init(&tx->txq_pkts[i]); - } + tx->txq_pkts = xzalloc(n_txq * sizeof *tx->txq_pkts); + for (i = 0; i < n_txq; i++) { + dp_packet_batch_init(&tx->txq_pkts[i]); } hmap_insert(&pmd->tx_ports, &tx->node, hash_port_no(tx->port->port_no)); @@ -11756,6 +11776,7 @@ dp_execute_output_action(struct dp_netdev_pmd_thread *pmd, } dp_packet_batch_apply_cutlen(packets_); #ifdef DPDK_NETDEV + dp_netdev_pmd_flush_txqs_on_port(pmd, p); if (OVS_UNLIKELY(!dp_packet_batch_is_empty(&p->output_pkts) && packets_->packets[0]->source != p->output_pkts.packets[0]->source)) { @@ -11775,9 +11796,14 @@ dp_execute_output_action(struct dp_netdev_pmd_thread *pmd, } struct dp_packet *packet; + int n_txq = netdev_n_txq(p->port->netdev); DP_PACKET_BATCH_FOR_EACH (i, packet, packets_) { p->output_pkts_rxqs[dp_packet_batch_size(&p->output_pkts)] = pmd->ctx.last_rxq; + if (packet->md.skb_priority) { + dp_packet_batch_add(&p->txq_pkts[packet->md.skb_priority%n_txq - 1],packet); + continue; + } dp_packet_batch_add(&p->output_pkts, packet); } return true; -- 1.8.3.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev