Skip to content

Commit b672ea1

Browse files
committed
dpif-offload: Move provider priority to interface level.
The original series allowed the provider priority to be configured on the port using the other-config:hw-offload-priority option. However, this is not the correct level. The configuration should be applied at the interface level, allowing, for example, specific bond members to have different configurations. This patch moves the configuration from the port to the interface. Fixes: 5c9b96e ("dpif-offload: Allow per-port offload provider priority config.") Acked-by: Ilya Maximets <i.maximets@ovn.org> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
1 parent e7d7d33 commit b672ea1

File tree

4 files changed

+54
-40
lines changed

4 files changed

+54
-40
lines changed

NEWS

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ v3.7.0 - xx xxx xxxx
2323
* New global configuration option 'other-config:hw-offload-priority'
2424
that allows to set the order of the hardware offload providers
2525
to try when multiple exist for a given datapath implementation.
26-
* New per-port configuration option 'other-config:hw-offload-priority'
27-
that allows to set order of the hardware offload providers or disable
28-
flow offloading on a particular port.
26+
* New per-interface configuration option
27+
'other-config:hw-offload-priority' that allows to set order of the
28+
hardware offload providers or disable flow offloading on a particular
29+
interface.
2930
- OVSDB-IDL:
3031
* New ovsdb_idl_txn_assert_read_only() interface to mark transactions
3132
as read-only and trigger assertion failure when application attempts

lib/dpif-offload.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static const struct dpif_offload_class *base_dpif_offload_classes[] = {
5959
static char *dpif_offload_provider_priority_list = NULL;
6060
static atomic_bool offload_global_enabled = false;
6161
static atomic_bool offload_rebalance_policy = false;
62-
static struct smap port_order_cfg = SMAP_INITIALIZER(&port_order_cfg);
62+
static struct smap iface_order_cfg = SMAP_INITIALIZER(&iface_order_cfg);
6363

6464
static int
6565
dpif_offload_register_provider__(const struct dpif_offload_class *class)
@@ -527,7 +527,7 @@ dpif_offload_port_add(struct dpif *dpif, struct netdev *netdev,
527527
odp_port_t port_no)
528528
{
529529
struct dpif_offload_provider_collection *collection;
530-
const char *port_priority = smap_get(&port_order_cfg,
530+
const char *port_priority = smap_get(&iface_order_cfg,
531531
netdev_get_name(netdev));
532532
struct dpif_offload *offload;
533533

@@ -773,21 +773,26 @@ dpif_offload_set_global_cfg(const struct ovsrec_open_vswitch *cfg)
773773
}
774774
}
775775

776-
/* Filter out the 'hw-offload-priority' per port setting we need it before
777-
* ports are added, so we can assign the correct offload-provider.
776+
/* Filter out the 'hw-offload-priority' per interface setting. We need it
777+
* before ports are added, so we can assign the correct offload-provider.
778778
* Note that we can safely rebuild the map here, as we only access this
779779
* from the same (main) thread. */
780-
smap_clear(&port_order_cfg);
780+
smap_clear(&iface_order_cfg);
781781
for (int i = 0; i < cfg->n_bridges; i++) {
782782
const struct ovsrec_bridge *br_cfg = cfg->bridges[i];
783783

784784
for (int j = 0; j < br_cfg->n_ports; j++) {
785785
const struct ovsrec_port *port_cfg = br_cfg->ports[j];
786786

787-
priority = smap_get(&port_cfg->other_config,
788-
"hw-offload-priority");
789-
if (priority) {
790-
smap_add(&port_order_cfg, port_cfg->name, priority);
787+
for (int k = 0; k < port_cfg->n_interfaces; k++) {
788+
const struct ovsrec_interface *iface_cfg;
789+
790+
iface_cfg = port_cfg->interfaces[k];
791+
priority = smap_get(&iface_cfg->other_config,
792+
"hw-offload-priority");
793+
if (priority) {
794+
smap_add(&iface_order_cfg, iface_cfg->name, priority);
795+
}
791796
}
792797
}
793798
}

tests/ofproto-dpif.at

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10242,16 +10242,16 @@ AT_SETUP([ofproto-dpif - offload - port priority order])
1024210242
AT_KEYWORDS([dpif-offload])
1024310243
OVS_VSWITCHD_START([add-port br0 p1 -- \
1024410244
set Interface p1 type=dummy ofport_request=1 -- \
10245-
set port p1 other_config:hw-offload-priority=dummy_x,dummy -- \
10245+
set Interface p1 other_config:hw-offload-priority=dummy_x,dummy -- \
1024610246
add-port br0 p2 -- \
1024710247
set Interface p2 type=dummy ofport_request=2 -- \
10248-
set port p2 other_config:hw-offload-priority=none -- \
10248+
set Interface p2 other_config:hw-offload-priority=none -- \
1024910249
add-port br0 p3 -- \
1025010250
set Interface p3 type=dummy ofport_request=3 -- \
10251-
set port p3 other_config:hw-offload-priority=dummy_x -- \
10251+
set Interface p3 other_config:hw-offload-priority=dummy_x -- \
1025210252
add-port br0 p4 -- \
1025310253
set Interface p4 type=dummy ofport_request=4 -- \
10254-
set port p4 other_config:hw-offload-priority=dummy])
10254+
set Interface p4 other_config:hw-offload-priority=dummy])
1025510255

1025610256
AT_CHECK([ovs-appctl --format json --pretty dpif/offload/show], [0], [dnl
1025710257
{

vswitchd/vswitch.xml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,30 +2600,6 @@
26002600
e.g. <code>fake-bridge-bridge-id</code>.
26012601
</column>
26022602

2603-
<column name="other_config" key="hw-offload-priority"
2604-
type='{"type": "string"}'>
2605-
<p>
2606-
This configuration sets an explicit list of hardware offload
2607-
providers to try on this port. The argument should be a
2608-
comma-separated list of hardware offload provider names, or the
2609-
word <code>none</code>.
2610-
</p>
2611-
<p>
2612-
If <code>none</code> is encountered in the list, further trying of
2613-
offload providers is stopped. For example, if the list only contains
2614-
<code>none</code>, hardware offload is disabled on this port even if
2615-
it is globally enabled. Note that unknown hardware offload provider
2616-
names are ignored.
2617-
</p>
2618-
<p>
2619-
If not set, uses the global
2620-
<ref table="Open_vSwitch" column="other_config"
2621-
key="hw-offload-priority"/>
2622-
configuration. Changing this value after offload enablement requires
2623-
restarting the daemon.
2624-
</p>
2625-
</column>
2626-
26272603
<column name="other_config" key="transient"
26282604
type='{"type": "boolean"}'>
26292605
<p>
@@ -4681,6 +4657,38 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \
46814657
</column>
46824658
</group>
46834659

4660+
<group title="Hardware Offload Configuration">
4661+
<column name="other_config" key="hw-offload-priority"
4662+
type='{"type": "string"}'>
4663+
<p>
4664+
This configuration sets an explicit list of hardware offload
4665+
providers to try on this Interface. The argument should be a
4666+
comma-separated list of hardware offload provider names, or the
4667+
word <code>none</code>.
4668+
</p>
4669+
<p>
4670+
If <code>none</code> is encountered in the list, further trying of
4671+
offload providers is stopped. For example, if the list only contains
4672+
<code>none</code>, hardware offload is disabled on this interface
4673+
even if it is globally enabled. Note that unknown hardware offload
4674+
provider names are ignored.
4675+
</p>
4676+
<p>
4677+
If not set, uses the global
4678+
<ref table="Open_vSwitch" column="other_config"
4679+
key="hw-offload-priority"/>
4680+
configuration. Changing this value after offload enablement requires
4681+
restarting the daemon. To avoid restarting the daemon, set this
4682+
option in the same transaction that adds the port. For example:
4683+
</p>
4684+
4685+
<pre>
4686+
ovs-vsctl add-port br0 p1 -- \
4687+
set Interface p1 other_config:hw-offload-priority=none
4688+
</pre>
4689+
</column>
4690+
</group>
4691+
46844692
<group title="Common Columns">
46854693
The overall purpose of these columns is described under <code>Common
46864694
Columns</code> at the beginning of this document.

0 commit comments

Comments
 (0)