nfp: flower: turn on recirc and merge hint support in firmware
authorJohn Hurley <john.hurley@netronome.com>
Mon, 15 Apr 2019 14:55:53 +0000 (16:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Apr 2019 22:45:36 +0000 (15:45 -0700)
Write to a FW symbol to indicate that the driver supports flow merging. If
this symbol does not exist then flow merging and recirculation is not
supported on the FW. If support is available, add a stub to deal with FW
to kernel merge hint messages.

Full flow merging requires the firmware to support of flow mods. If it
does not, then do not attempt to 'turn on' flow merging.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/cmsg.c
drivers/net/ethernet/netronome/nfp/flower/cmsg.h
drivers/net/ethernet/netronome/nfp/flower/main.c
drivers/net/ethernet/netronome/nfp/flower/main.h

index cf9e111..e1ffbce 100644 (file)
@@ -222,6 +222,10 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb)
        case NFP_FLOWER_CMSG_TYPE_PORT_MOD:
                nfp_flower_cmsg_portmod_rx(app, skb);
                break;
+       case NFP_FLOWER_CMSG_TYPE_MERGE_HINT:
+               if (app_priv->flower_ext_feats & NFP_FL_FEATS_FLOW_MERGE)
+                       break;
+               goto err_default;
        case NFP_FLOWER_CMSG_TYPE_NO_NEIGH:
                nfp_tunnel_request_route(app, skb);
                break;
@@ -235,6 +239,7 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb)
                }
                /* fall through */
        default:
+err_default:
                nfp_flower_cmsg_warn(app, "Cannot handle invalid repr control type %u\n",
                                     type);
                goto out;
index 0ed51e7..cf4ab10 100644 (file)
@@ -407,6 +407,7 @@ enum nfp_flower_cmsg_type_port {
        NFP_FLOWER_CMSG_TYPE_PORT_REIFY =       6,
        NFP_FLOWER_CMSG_TYPE_MAC_REPR =         7,
        NFP_FLOWER_CMSG_TYPE_PORT_MOD =         8,
+       NFP_FLOWER_CMSG_TYPE_MERGE_HINT =       9,
        NFP_FLOWER_CMSG_TYPE_NO_NEIGH =         10,
        NFP_FLOWER_CMSG_TYPE_TUN_MAC =          11,
        NFP_FLOWER_CMSG_TYPE_ACTIVE_TUNS =      12,
index 4080891..1569fb6 100644 (file)
@@ -641,11 +641,28 @@ static int nfp_flower_init(struct nfp_app *app)
                goto err_cleanup_metadata;
        }
 
+       if (app_priv->flower_ext_feats & NFP_FL_FEATS_FLOW_MOD) {
+               /* Tell the firmware that the driver supports flow merging. */
+               err = nfp_rtsym_write_le(app->pf->rtbl,
+                                        "_abi_flower_merge_hint_enable", 1);
+               if (!err)
+                       app_priv->flower_ext_feats |= NFP_FL_FEATS_FLOW_MERGE;
+               else if (err == -ENOENT)
+                       nfp_warn(app->cpp, "Flow merge not supported by FW.\n");
+               else
+                       goto err_lag_clean;
+       } else {
+               nfp_warn(app->cpp, "Flow mod/merge not supported by FW.\n");
+       }
+
        INIT_LIST_HEAD(&app_priv->indr_block_cb_priv);
        INIT_LIST_HEAD(&app_priv->non_repr_priv);
 
        return 0;
 
+err_lag_clean:
+       if (app_priv->flower_ext_feats & NFP_FL_FEATS_LAG)
+               nfp_flower_lag_cleanup(&app_priv->nfp_lag);
 err_cleanup_metadata:
        nfp_flower_metadata_cleanup(app);
 err_free_app_priv:
index f6ca8dc..f557008 100644 (file)
@@ -39,6 +39,8 @@ struct nfp_app;
 #define NFP_FL_NBI_MTU_SETTING         BIT(1)
 #define NFP_FL_FEATS_GENEVE_OPT                BIT(2)
 #define NFP_FL_FEATS_VLAN_PCP          BIT(3)
+#define NFP_FL_FEATS_FLOW_MOD          BIT(5)
+#define NFP_FL_FEATS_FLOW_MERGE                BIT(30)
 #define NFP_FL_FEATS_LAG               BIT(31)
 
 struct nfp_fl_mask_id {