[ovs-dev] [PATCH V9 09/31] dpif-netlink: Flush added ports using netdev flow api
Roi Dayan
roid at mellanox.com
Sun Jun 4 14:16:58 UTC 2017
On 02/06/2017 17:46, Flavio Leitner wrote:
> On Sun, May 28, 2017 at 02:59:51PM +0300, Roi Dayan wrote:
>> From: Paul Blakey <paulb at mellanox.com>
>>
>> If netdev flow offloading is enabled, flush all
>> added ports using netdev flow api.
>>
>> Signed-off-by: Paul Blakey <paulb at mellanox.com>
>> Reviewed-by: Roi Dayan <roid at mellanox.com>
>> Reviewed-by: Simon Horman <simon.horman at netronome.com>
>> Acked-by: Flavio Leitner <fbl at sysclose.org>
>> ---
>> lib/dpif-netlink.c | 5 +++++
>> lib/netdev.c | 12 ++++++++++++
>> lib/netdev.h | 1 +
>> 3 files changed, 18 insertions(+)
>>
>> diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
>> index e275247..c82e2e1 100644
>> --- a/lib/dpif-netlink.c
>> +++ b/lib/dpif-netlink.c
>> @@ -1087,6 +1087,11 @@ dpif_netlink_flow_flush(struct dpif *dpif_)
>> dpif_netlink_flow_init(&flow);
>> flow.cmd = OVS_FLOW_CMD_DEL;
>> flow.dp_ifindex = dpif->dp_ifindex;
>> +
>> + if (netdev_is_flow_api_enabled()) {
>> + netdev_ports_flow_flush(DPIF_HMAP_KEY(dpif_));
>> + }
>> +
>> return dpif_netlink_flow_transact(&flow, NULL, NULL);
>> }
>>
>> diff --git a/lib/netdev.c b/lib/netdev.c
>> index 88a0a61..5ae8644 100644
>> --- a/lib/netdev.c
>> +++ b/lib/netdev.c
>> @@ -2239,6 +2239,18 @@ netdev_ifindex_to_odp_port(int ifindex)
>> return ret;
>> }
>>
>> +void
>> +netdev_ports_flow_flush(const void *obj)
>> +{
>> + struct port_to_netdev_data *data;
>> +
>
> Why it doesn't need to lock netdev_hmap_mutex?
> Wouldn't this race with netdev_ports_remove() or netdev_ports_insert()?
right. I'll verify and fix. thanks.
seems we have a lock in insert/get/remove port from the hmap but
missing it in flush/dump/del/get flow where we lookup an hmap item.
netdev_ports_flow_flush
netdev_ports_flow_dump_create
netdev_ports_flow_del
netdev_ports_flow_get
>
>
>> + HMAP_FOR_EACH(data, node, &port_to_netdev) {
>> + if (data->obj == obj) {
>> + netdev_flow_flush(data->netdev);
>> + }
>> + }
>> +}
>> +
>> #ifdef __linux__
>> void
>> netdev_set_flow_api_enabled(const struct smap *ovs_other_config)
>> diff --git a/lib/netdev.h b/lib/netdev.h
>> index 7628397..faa2958 100644
>> --- a/lib/netdev.h
>> +++ b/lib/netdev.h
>> @@ -186,6 +186,7 @@ int netdev_ports_insert(struct netdev *, const void *obj, struct dpif_port *);
>> struct netdev *netdev_ports_get(odp_port_t port, const void *obj);
>> int netdev_ports_remove(odp_port_t port, const void *obj);
>> odp_port_t netdev_ifindex_to_odp_port(int ifindex);
>> +void netdev_ports_flow_flush(const void *obj);
>>
>> /* native tunnel APIs */
>> /* Structure to pass parameters required to build a tunnel header. */
>> --
>> 2.7.4
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
More information about the dev
mailing list