Remove the hardware offload overrides for the dummy datapaths.
We will re-add them later to provide the same test functionality.

Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/netdev-dummy.c | 182 +--------------------------------------------
 1 file changed, 1 insertion(+), 181 deletions(-)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 0e5239eeb..8ae1151ea 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -141,8 +141,6 @@ struct netdev_dummy {
     struct ovs_list addrs OVS_GUARDED;
     struct ovs_list rxes OVS_GUARDED; /* List of child "netdev_rxq_dummy"s. */
 
-    struct hmap offloaded_flows OVS_GUARDED;
-
     /* The following properties are for dummy-pmd and they cannot be changed
      * when a device is running, so we remember the request and update them
      * next time netdev_dummy_reconfigure() is called. */
@@ -754,7 +752,6 @@ netdev_dummy_construct(struct netdev *netdev_)
 
     ovs_list_init(&netdev->rxes);
     ovs_list_init(&netdev->addrs);
-    hmap_init(&netdev->offloaded_flows);
     ovs_mutex_unlock(&netdev->mutex);
 
     ovs_mutex_lock(&dummy_list_mutex);
@@ -768,7 +765,6 @@ static void
 netdev_dummy_destruct(struct netdev *netdev_)
 {
     struct netdev_dummy *netdev = netdev_dummy_cast(netdev_);
-    struct offloaded_flow *off_flow;
 
     ovs_mutex_lock(&dummy_list_mutex);
     ovs_list_remove(&netdev->list_node);
@@ -786,10 +782,6 @@ netdev_dummy_destruct(struct netdev *netdev_)
     dummy_packet_conn_close(&netdev->conn);
     netdev->conn.type = NONE;
 
-    HMAP_FOR_EACH_POP (off_flow, node, &netdev->offloaded_flows) {
-        free(off_flow);
-    }
-    hmap_destroy(&netdev->offloaded_flows);
     addr_list_delete(&netdev->addrs);
 
     ovs_mutex_unlock(&netdev->mutex);
@@ -1673,129 +1665,6 @@ netdev_dummy_update_flags(struct netdev *netdev_,
     return error;
 }
 
-/* Flow offload API. */
-static uint32_t
-netdev_dummy_flow_hash(const ovs_u128 *ufid)
-{
-    return ufid->u32[0];
-}
-
-static struct offloaded_flow *
-find_offloaded_flow(const struct hmap *offloaded_flows, const ovs_u128 *ufid)
-{
-    uint32_t hash = netdev_dummy_flow_hash(ufid);
-    struct offloaded_flow *data;
-
-    HMAP_FOR_EACH_WITH_HASH (data, node, hash, offloaded_flows) {
-        if (ovs_u128_equals(*ufid, data->ufid)) {
-            return data;
-        }
-    }
-
-    return NULL;
-}
-
-static int
-netdev_dummy_flow_put(struct netdev *netdev, struct match *match,
-                      struct nlattr *actions OVS_UNUSED,
-                      size_t actions_len OVS_UNUSED,
-                      const ovs_u128 *ufid, struct offload_info *info,
-                      struct dpif_flow_stats *stats)
-{
-    struct netdev_dummy *dev = netdev_dummy_cast(netdev);
-    struct offloaded_flow *off_flow;
-    bool modify = true;
-
-    ovs_mutex_lock(&dev->mutex);
-
-    off_flow = find_offloaded_flow(&dev->offloaded_flows, ufid);
-    if (!off_flow) {
-        /* Create new offloaded flow. */
-        off_flow = xzalloc(sizeof *off_flow);
-        memcpy(&off_flow->ufid, ufid, sizeof *ufid);
-        hmap_insert(&dev->offloaded_flows, &off_flow->node,
-                    netdev_dummy_flow_hash(ufid));
-        modify = false;
-    }
-
-    off_flow->mark = info->flow_mark;
-    memcpy(&off_flow->match, match, sizeof *match);
-
-    /* As we have per-netdev 'offloaded_flows', we don't need to match
-     * the 'in_port' for received packets. This will also allow offloading for
-     * packets passed to 'receive' command without specifying the 'in_port'. */
-    off_flow->match.wc.masks.in_port.odp_port = 0;
-
-    ovs_mutex_unlock(&dev->mutex);
-
-    if (VLOG_IS_DBG_ENABLED()) {
-        struct ds ds = DS_EMPTY_INITIALIZER;
-
-        ds_put_format(&ds, "%s: flow put[%s]: ", netdev_get_name(netdev),
-                      modify ? "modify" : "create");
-        odp_format_ufid(ufid, &ds);
-        ds_put_cstr(&ds, " flow match: ");
-        match_format(match, NULL, &ds, OFP_DEFAULT_PRIORITY);
-        ds_put_format(&ds, ", mark: %"PRIu32, info->flow_mark);
-
-        VLOG_DBG("%s", ds_cstr(&ds));
-        ds_destroy(&ds);
-    }
-
-    if (stats) {
-        memset(stats, 0, sizeof *stats);
-    }
-    return 0;
-}
-
-static int
-netdev_dummy_flow_del(struct netdev *netdev, const ovs_u128 *ufid,
-                      struct dpif_flow_stats *stats)
-{
-    struct netdev_dummy *dev = netdev_dummy_cast(netdev);
-    struct offloaded_flow *off_flow;
-    const char *error = NULL;
-    uint32_t mark;
-
-    ovs_mutex_lock(&dev->mutex);
-
-    off_flow = find_offloaded_flow(&dev->offloaded_flows, ufid);
-    if (!off_flow) {
-        error = "No such flow.";
-        goto exit;
-    }
-
-    mark = off_flow->mark;
-    hmap_remove(&dev->offloaded_flows, &off_flow->node);
-    free(off_flow);
-
-exit:
-    ovs_mutex_unlock(&dev->mutex);
-
-    if (error || VLOG_IS_DBG_ENABLED()) {
-        struct ds ds = DS_EMPTY_INITIALIZER;
-
-        ds_put_format(&ds, "%s: ", netdev_get_name(netdev));
-        if (error) {
-            ds_put_cstr(&ds, "failed to ");
-        }
-        ds_put_cstr(&ds, "flow del: ");
-        odp_format_ufid(ufid, &ds);
-        if (error) {
-            ds_put_format(&ds, " error: %s", error);
-        } else {
-            ds_put_format(&ds, " mark: %"PRIu32, mark);
-        }
-        VLOG(error ? VLL_WARN : VLL_DBG, "%s", ds_cstr(&ds));
-        ds_destroy(&ds);
-    }
-
-    if (stats) {
-        memset(stats, 0, sizeof *stats);
-    }
-    return error ? -1 : 0;
-}
-
 #define NETDEV_DUMMY_CLASS_COMMON                       \
     .run = netdev_dummy_run,                            \
     .wait = netdev_dummy_wait,                          \
@@ -1847,19 +1716,6 @@ static const struct netdev_class dummy_pmd_class = {
     .reconfigure = netdev_dummy_reconfigure
 };
 
-static int
-netdev_dummy_offloads_init_flow_api(struct netdev *netdev)
-{
-    return is_dummy_netdev_class(netdev->netdev_class) ? 0 : EOPNOTSUPP;
-}
-
-static const struct netdev_flow_api netdev_offload_dummy = {
-    .type = "dummy",
-    .flow_put = netdev_dummy_flow_put,
-    .flow_del = netdev_dummy_flow_del,
-    .init_flow_api = netdev_dummy_offloads_init_flow_api,
-};
-
 
 /* Helper functions. */
 
@@ -1953,49 +1809,15 @@ netdev_dummy_queue_packet__(struct netdev_rxq_dummy 
*rx, struct dp_packet *packe
 
 static void
 netdev_dummy_queue_packet(struct netdev_dummy *dummy, struct dp_packet *packet,
-                          struct flow *flow, int queue_id)
+                          struct flow *flow OVS_UNUSED, int queue_id)
     OVS_REQUIRES(dummy->mutex)
 {
     struct netdev_rxq_dummy *rx, *prev;
-    struct offloaded_flow *data;
-    struct flow packet_flow;
 
     if (dummy->rxq_pcap) {
         ovs_pcap_write(dummy->rxq_pcap, packet);
     }
 
-    if (!flow) {
-        flow = &packet_flow;
-        flow_extract(packet, flow);
-    }
-    HMAP_FOR_EACH (data, node, &dummy->offloaded_flows) {
-        if (flow_equal_except(flow, &data->match.flow, &data->match.wc)) {
-
-            dp_packet_set_flow_mark(packet, data->mark);
-
-            if (VLOG_IS_DBG_ENABLED()) {
-                struct ds ds = DS_EMPTY_INITIALIZER;
-
-                ds_put_format(&ds, "%s: packet: ",
-                              netdev_get_name(&dummy->up));
-                /* 'flow' does not contain proper port number here.
-                 * Let's just clear it as it wildcarded anyway. */
-                flow->in_port.ofp_port = 0;
-                flow_format(&ds, flow, NULL);
-
-                ds_put_cstr(&ds, " matches with flow: ");
-                odp_format_ufid(&data->ufid, &ds);
-                ds_put_cstr(&ds, " ");
-                match_format(&data->match, NULL, &ds, OFP_DEFAULT_PRIORITY);
-                ds_put_format(&ds, " with mark: %"PRIu32, data->mark);
-
-                VLOG_DBG("%s", ds_cstr(&ds));
-                ds_destroy(&ds);
-            }
-            break;
-        }
-    }
-
     prev = NULL;
     LIST_FOR_EACH (rx, node, &dummy->rxes) {
         if (rx->up.queue_id == queue_id &&
@@ -2330,7 +2152,5 @@ netdev_dummy_register(enum dummy_level level)
     netdev_register_provider(&dummy_internal_class);
     netdev_register_provider(&dummy_pmd_class);
 
-    netdev_register_flow_api_provider(&netdev_offload_dummy);
-
     netdev_vport_tunnel_register();
 }
-- 
2.50.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to