mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
netdev-offload: Set 'miss_api_supported' to be under netdev.
Cited commit introduced a flag in dpif-netdev level, to optimize
performance and avoid hw_miss_packet_recover() for devices with no such
support.
However, there is a race condition between traffic processing and
assigning a 'flow_api' object to the netdev. In such case, EOPNOTSUPP is
returned by netdev_hw_miss_packet_recover() in netdev-offload.c layer
because 'flow_api' is not yet initialized. As a result, the flag is
falsely disabled, and subsequent packets won't be recovered, though they
should.
In order to fix it, move the flag to be in netdev-offload layer, to
avoid that race.
Fixes: 6e50c16518
("dpif-netdev: Avoid hw_miss_packet_recover() for devices with no support.")
Signed-off-by: Eli Britstein <elibr@nvidia.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
31db0e0431
commit
76ab364ea8
@@ -431,7 +431,6 @@ struct dp_netdev_rxq {
|
||||
unsigned intrvl_idx; /* Write index for 'cycles_intrvl'. */
|
||||
struct dp_netdev_pmd_thread *pmd; /* pmd thread that polls this queue. */
|
||||
bool is_vhost; /* Is rxq of a vhost port. */
|
||||
bool hw_miss_api_supported; /* hw_miss_packet_recover() supported.*/
|
||||
|
||||
/* Counters of cycles spent successfully polling and processing pkts. */
|
||||
atomic_ullong cycles[RXQ_N_CYCLES];
|
||||
@@ -5416,7 +5415,6 @@ port_reconfigure(struct dp_netdev_port *port)
|
||||
|
||||
port->rxqs[i].port = port;
|
||||
port->rxqs[i].is_vhost = !strncmp(port->type, "dpdkvhost", 9);
|
||||
port->rxqs[i].hw_miss_api_supported = true;
|
||||
|
||||
err = netdev_rxq_open(netdev, &port->rxqs[i].rx, i);
|
||||
if (err) {
|
||||
@@ -8034,17 +8032,15 @@ dp_netdev_hw_flow(const struct dp_netdev_pmd_thread *pmd,
|
||||
#ifdef ALLOW_EXPERIMENTAL_API /* Packet restoration API required. */
|
||||
/* Restore the packet if HW processing was terminated before completion. */
|
||||
struct dp_netdev_rxq *rxq = pmd->ctx.last_rxq;
|
||||
bool miss_api_supported;
|
||||
|
||||
if (rxq->hw_miss_api_supported) {
|
||||
atomic_read_relaxed(&rxq->port->netdev->hw_info.miss_api_supported,
|
||||
&miss_api_supported);
|
||||
if (miss_api_supported) {
|
||||
int err = netdev_hw_miss_packet_recover(rxq->port->netdev, packet);
|
||||
if (err) {
|
||||
if (err != EOPNOTSUPP) {
|
||||
COVERAGE_INC(datapath_drop_hw_miss_recover);
|
||||
return -1;
|
||||
} else {
|
||||
/* API unsupported by the port; avoid subsequent calls. */
|
||||
rxq->hw_miss_api_supported = false;
|
||||
}
|
||||
if (err && err != EOPNOTSUPP) {
|
||||
COVERAGE_INC(datapath_drop_hw_miss_recover);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user