Message ID | 20211203211215.186062-1-i.maximets@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] dpif-netdev: Use PMD context to get the port for HW miss recovery. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
Acked-by: Eli Britstein <elibr@nvidia.com> On 12/3/2021 11:12 PM, Ilya Maximets wrote: > External email: Use caution opening links or attachments > > > Last RX queue, from which the packet got received, is already stored > in the PMD context. So, we can get the netdev from it without the > expensive hash map lookup. > > In my V2V testing this patch improves performance in case HW offload > and experimental APIs are enabled by about 3%. That narrows down the > performance difference with the case with experimental API disabled > to about 0.5%, which is way within a margin of error for that setup. > > Signed-off-by: Ilya Maximets <i.maximets@ovn.org> > --- > lib/dpif-netdev-avx512.c | 2 +- > lib/dpif-netdev-private.h | 1 - > lib/dpif-netdev.c | 20 +++++++------------- > 3 files changed, 8 insertions(+), 15 deletions(-) > > diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c > index 544d36903..3980960ba 100644 > --- a/lib/dpif-netdev-avx512.c > +++ b/lib/dpif-netdev-avx512.c > @@ -186,7 +186,7 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, > > /* Check for a partial hardware offload match. */ > if (hwol_enabled) { > - if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, in_port, packet, &f))) { > + if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, packet, &f))) { > /* Packet restoration failed and it was dropped, do not > * continue processing. */ > continue; > diff --git a/lib/dpif-netdev-private.h b/lib/dpif-netdev-private.h > index 4593649bd..029b23a22 100644 > --- a/lib/dpif-netdev-private.h > +++ b/lib/dpif-netdev-private.h > @@ -46,7 +46,6 @@ dp_netdev_batch_execute(struct dp_netdev_pmd_thread *pmd, > > int > dp_netdev_hw_flow(const struct dp_netdev_pmd_thread *pmd, > - odp_port_t port_no, > struct dp_packet *packet, > struct dp_netdev_flow **flow); > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c > index 69d7ec26e..a790df5fd 100644 > --- a/lib/dpif-netdev.c > +++ b/lib/dpif-netdev.c > @@ -7322,28 +7322,22 @@ smc_lookup_single(struct dp_netdev_pmd_thread *pmd, > return NULL; > } > > -static struct tx_port * pmd_send_port_cache_lookup( > - const struct dp_netdev_pmd_thread *pmd, odp_port_t port_no); > - > inline int > dp_netdev_hw_flow(const struct dp_netdev_pmd_thread *pmd, > - odp_port_t port_no OVS_UNUSED, > struct dp_packet *packet, > struct dp_netdev_flow **flow) > { > - struct tx_port *p OVS_UNUSED; > uint32_t mark; > > #ifdef ALLOW_EXPERIMENTAL_API /* Packet restoration API required. */ > /* Restore the packet if HW processing was terminated before completion. */ > - p = pmd_send_port_cache_lookup(pmd, port_no); > - if (OVS_LIKELY(p)) { > - int err = netdev_hw_miss_packet_recover(p->port->netdev, packet); > + struct dp_netdev_rxq *rxq = pmd->ctx.last_rxq; > + int err; > > - if (err && err != EOPNOTSUPP) { > - COVERAGE_INC(datapath_drop_hw_miss_recover); > - return -1; > - } > + err = netdev_hw_miss_packet_recover(rxq->port->netdev, packet); > + if (err && err != EOPNOTSUPP) { > + COVERAGE_INC(datapath_drop_hw_miss_recover); > + return -1; > } > #endif > > @@ -7420,7 +7414,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd, > } > > if (netdev_flow_api && recirc_depth == 0) { > - if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, port_no, packet, &flow))) { > + if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, packet, &flow))) { > /* Packet restoration failed and it was dropped, do not > * continue processing. > */ > -- > 2.31.1 >
On 12/5/21 07:13, Eli Britstein wrote: > Acked-by: Eli Britstein <elibr@nvidia.com> Thanks! Applied. Best regards, Ilya Maximets. > > On 12/3/2021 11:12 PM, Ilya Maximets wrote: >> External email: Use caution opening links or attachments >> >> >> Last RX queue, from which the packet got received, is already stored >> in the PMD context. So, we can get the netdev from it without the >> expensive hash map lookup. >> >> In my V2V testing this patch improves performance in case HW offload >> and experimental APIs are enabled by about 3%. That narrows down the >> performance difference with the case with experimental API disabled >> to about 0.5%, which is way within a margin of error for that setup. >> >> Signed-off-by: Ilya Maximets <i.maximets@ovn.org> >> ---
diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c index 544d36903..3980960ba 100644 --- a/lib/dpif-netdev-avx512.c +++ b/lib/dpif-netdev-avx512.c @@ -186,7 +186,7 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, /* Check for a partial hardware offload match. */ if (hwol_enabled) { - if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, in_port, packet, &f))) { + if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, packet, &f))) { /* Packet restoration failed and it was dropped, do not * continue processing. */ continue; diff --git a/lib/dpif-netdev-private.h b/lib/dpif-netdev-private.h index 4593649bd..029b23a22 100644 --- a/lib/dpif-netdev-private.h +++ b/lib/dpif-netdev-private.h @@ -46,7 +46,6 @@ dp_netdev_batch_execute(struct dp_netdev_pmd_thread *pmd, int dp_netdev_hw_flow(const struct dp_netdev_pmd_thread *pmd, - odp_port_t port_no, struct dp_packet *packet, struct dp_netdev_flow **flow); diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 69d7ec26e..a790df5fd 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -7322,28 +7322,22 @@ smc_lookup_single(struct dp_netdev_pmd_thread *pmd, return NULL; } -static struct tx_port * pmd_send_port_cache_lookup( - const struct dp_netdev_pmd_thread *pmd, odp_port_t port_no); - inline int dp_netdev_hw_flow(const struct dp_netdev_pmd_thread *pmd, - odp_port_t port_no OVS_UNUSED, struct dp_packet *packet, struct dp_netdev_flow **flow) { - struct tx_port *p OVS_UNUSED; uint32_t mark; #ifdef ALLOW_EXPERIMENTAL_API /* Packet restoration API required. */ /* Restore the packet if HW processing was terminated before completion. */ - p = pmd_send_port_cache_lookup(pmd, port_no); - if (OVS_LIKELY(p)) { - int err = netdev_hw_miss_packet_recover(p->port->netdev, packet); + struct dp_netdev_rxq *rxq = pmd->ctx.last_rxq; + int err; - if (err && err != EOPNOTSUPP) { - COVERAGE_INC(datapath_drop_hw_miss_recover); - return -1; - } + err = netdev_hw_miss_packet_recover(rxq->port->netdev, packet); + if (err && err != EOPNOTSUPP) { + COVERAGE_INC(datapath_drop_hw_miss_recover); + return -1; } #endif @@ -7420,7 +7414,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd, } if (netdev_flow_api && recirc_depth == 0) { - if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, port_no, packet, &flow))) { + if (OVS_UNLIKELY(dp_netdev_hw_flow(pmd, packet, &flow))) { /* Packet restoration failed and it was dropped, do not * continue processing. */
Last RX queue, from which the packet got received, is already stored in the PMD context. So, we can get the netdev from it without the expensive hash map lookup. In my V2V testing this patch improves performance in case HW offload and experimental APIs are enabled by about 3%. That narrows down the performance difference with the case with experimental API disabled to about 0.5%, which is way within a margin of error for that setup. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> --- lib/dpif-netdev-avx512.c | 2 +- lib/dpif-netdev-private.h | 1 - lib/dpif-netdev.c | 20 +++++++------------- 3 files changed, 8 insertions(+), 15 deletions(-)