1 /*
2  * Copyright (C) 2017 Netronome Systems, Inc.
3  *
4  * This software is dual licensed under the GNU General License Version 2,
5  * June 1991 as shown in the file COPYING in the top-level directory of this
6  * source tree or the BSD 2-Clause License provided below.  You have the
7  * option to license this software under the complete terms of either license.
8  *
9  * The BSD 2-Clause License:
10  *
11  *     Redistribution and use in source and binary forms, with or
12  *     without modification, are permitted provided that the following
13  *     conditions are met:
14  *
15  *      1. Redistributions of source code must retain the above
16  *         copyright notice, this list of conditions and the following
17  *         disclaimer.
18  *
19  *      2. Redistributions in binary form must reproduce the above
20  *         copyright notice, this list of conditions and the following
21  *         disclaimer in the documentation and/or other materials
22  *         provided with the distribution.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31  * SOFTWARE.
32  */
33 
34 #include <linux/etherdevice.h>
35 #include <linux/lockdep.h>
36 #include <linux/pci.h>
37 #include <linux/skbuff.h>
38 #include <linux/vmalloc.h>
39 #include <net/devlink.h>
40 #include <net/dst_metadata.h>
41 
42 #include "main.h"
43 #include "../nfpcore/nfp_cpp.h"
44 #include "../nfpcore/nfp_nffw.h"
45 #include "../nfpcore/nfp_nsp.h"
46 #include "../nfp_app.h"
47 #include "../nfp_main.h"
48 #include "../nfp_net.h"
49 #include "../nfp_net_repr.h"
50 #include "../nfp_port.h"
51 #include "./cmsg.h"
52 
53 #define NFP_FLOWER_ALLOWED_VER 0x0001000000010000UL
54 
55 static const char *nfp_flower_extra_cap(struct nfp_app *app, struct nfp_net *nn)
56 {
57 	return "FLOWER";
58 }
59 
60 static enum devlink_eswitch_mode eswitch_mode_get(struct nfp_app *app)
61 {
62 	return DEVLINK_ESWITCH_MODE_SWITCHDEV;
63 }
64 
65 static enum nfp_repr_type
66 nfp_flower_repr_get_type_and_port(struct nfp_app *app, u32 port_id, u8 *port)
67 {
68 	switch (FIELD_GET(NFP_FLOWER_CMSG_PORT_TYPE, port_id)) {
69 	case NFP_FLOWER_CMSG_PORT_TYPE_PHYS_PORT:
70 		*port = FIELD_GET(NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM,
71 				  port_id);
72 		return NFP_REPR_TYPE_PHYS_PORT;
73 
74 	case NFP_FLOWER_CMSG_PORT_TYPE_PCIE_PORT:
75 		*port = FIELD_GET(NFP_FLOWER_CMSG_PORT_VNIC, port_id);
76 		if (FIELD_GET(NFP_FLOWER_CMSG_PORT_VNIC_TYPE, port_id) ==
77 		    NFP_FLOWER_CMSG_PORT_VNIC_TYPE_PF)
78 			return NFP_REPR_TYPE_PF;
79 		else
80 			return NFP_REPR_TYPE_VF;
81 	}
82 
83 	return NFP_FLOWER_CMSG_PORT_TYPE_UNSPEC;
84 }
85 
86 static struct net_device *
87 nfp_flower_repr_get(struct nfp_app *app, u32 port_id)
88 {
89 	enum nfp_repr_type repr_type;
90 	struct nfp_reprs *reprs;
91 	u8 port = 0;
92 
93 	repr_type = nfp_flower_repr_get_type_and_port(app, port_id, &port);
94 
95 	reprs = rcu_dereference(app->reprs[repr_type]);
96 	if (!reprs)
97 		return NULL;
98 
99 	if (port >= reprs->num_reprs)
100 		return NULL;
101 
102 	return rcu_dereference(reprs->reprs[port]);
103 }
104 
105 static int
106 nfp_flower_reprs_reify(struct nfp_app *app, enum nfp_repr_type type,
107 		       bool exists)
108 {
109 	struct nfp_reprs *reprs;
110 	int i, err, count = 0;
111 
112 	reprs = rcu_dereference_protected(app->reprs[type],
113 					  lockdep_is_held(&app->pf->lock));
114 	if (!reprs)
115 		return 0;
116 
117 	for (i = 0; i < reprs->num_reprs; i++) {
118 		struct net_device *netdev;
119 
120 		netdev = nfp_repr_get_locked(app, reprs, i);
121 		if (netdev) {
122 			struct nfp_repr *repr = netdev_priv(netdev);
123 
124 			err = nfp_flower_cmsg_portreify(repr, exists);
125 			if (err)
126 				return err;
127 			count++;
128 		}
129 	}
130 
131 	return count;
132 }
133 
134 static int
135 nfp_flower_wait_repr_reify(struct nfp_app *app, atomic_t *replies, int tot_repl)
136 {
137 	struct nfp_flower_priv *priv = app->priv;
138 	int err;
139 
140 	if (!tot_repl)
141 		return 0;
142 
143 	lockdep_assert_held(&app->pf->lock);
144 	err = wait_event_interruptible_timeout(priv->reify_wait_queue,
145 					       atomic_read(replies) >= tot_repl,
146 					       msecs_to_jiffies(10));
147 	if (err <= 0) {
148 		nfp_warn(app->cpp, "Not all reprs responded to reify\n");
149 		return -EIO;
150 	}
151 
152 	return 0;
153 }
154 
155 static int
156 nfp_flower_repr_netdev_open(struct nfp_app *app, struct nfp_repr *repr)
157 {
158 	int err;
159 
160 	err = nfp_flower_cmsg_portmod(repr, true, repr->netdev->mtu, false);
161 	if (err)
162 		return err;
163 
164 	netif_tx_wake_all_queues(repr->netdev);
165 
166 	return 0;
167 }
168 
169 static int
170 nfp_flower_repr_netdev_stop(struct nfp_app *app, struct nfp_repr *repr)
171 {
172 	netif_tx_disable(repr->netdev);
173 
174 	return nfp_flower_cmsg_portmod(repr, false, repr->netdev->mtu, false);
175 }
176 
177 static int
178 nfp_flower_repr_netdev_init(struct nfp_app *app, struct net_device *netdev)
179 {
180 	return tc_setup_cb_egdev_register(netdev,
181 					  nfp_flower_setup_tc_egress_cb,
182 					  netdev_priv(netdev));
183 }
184 
185 static void
186 nfp_flower_repr_netdev_clean(struct nfp_app *app, struct net_device *netdev)
187 {
188 	tc_setup_cb_egdev_unregister(netdev, nfp_flower_setup_tc_egress_cb,
189 				     netdev_priv(netdev));
190 }
191 
192 static void
193 nfp_flower_repr_netdev_preclean(struct nfp_app *app, struct net_device *netdev)
194 {
195 	struct nfp_repr *repr = netdev_priv(netdev);
196 	struct nfp_flower_priv *priv = app->priv;
197 	atomic_t *replies = &priv->reify_replies;
198 	int err;
199 
200 	atomic_set(replies, 0);
201 	err = nfp_flower_cmsg_portreify(repr, false);
202 	if (err) {
203 		nfp_warn(app->cpp, "Failed to notify firmware about repr destruction\n");
204 		return;
205 	}
206 
207 	nfp_flower_wait_repr_reify(app, replies, 1);
208 }
209 
210 static void nfp_flower_sriov_disable(struct nfp_app *app)
211 {
212 	struct nfp_flower_priv *priv = app->priv;
213 
214 	if (!priv->nn)
215 		return;
216 
217 	nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_VF);
218 }
219 
220 static int
221 nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
222 			    enum nfp_flower_cmsg_port_vnic_type vnic_type,
223 			    enum nfp_repr_type repr_type, unsigned int cnt)
224 {
225 	u8 nfp_pcie = nfp_cppcore_pcie_unit(app->pf->cpp);
226 	struct nfp_flower_priv *priv = app->priv;
227 	atomic_t *replies = &priv->reify_replies;
228 	enum nfp_port_type port_type;
229 	struct nfp_reprs *reprs;
230 	int i, err, reify_cnt;
231 	const u8 queue = 0;
232 
233 	port_type = repr_type == NFP_REPR_TYPE_PF ? NFP_PORT_PF_PORT :
234 						    NFP_PORT_VF_PORT;
235 
236 	reprs = nfp_reprs_alloc(cnt);
237 	if (!reprs)
238 		return -ENOMEM;
239 
240 	for (i = 0; i < cnt; i++) {
241 		struct net_device *repr;
242 		struct nfp_port *port;
243 		u32 port_id;
244 
245 		repr = nfp_repr_alloc(app);
246 		if (!repr) {
247 			err = -ENOMEM;
248 			goto err_reprs_clean;
249 		}
250 
251 		/* For now we only support 1 PF */
252 		WARN_ON(repr_type == NFP_REPR_TYPE_PF && i);
253 
254 		port = nfp_port_alloc(app, port_type, repr);
255 		if (IS_ERR(port)) {
256 			err = PTR_ERR(port);
257 			nfp_repr_free(repr);
258 			goto err_reprs_clean;
259 		}
260 		if (repr_type == NFP_REPR_TYPE_PF) {
261 			port->pf_id = i;
262 			port->vnic = priv->nn->dp.ctrl_bar;
263 		} else {
264 			port->pf_id = 0;
265 			port->vf_id = i;
266 			port->vnic =
267 				app->pf->vf_cfg_mem + i * NFP_NET_CFG_BAR_SZ;
268 		}
269 
270 		eth_hw_addr_random(repr);
271 
272 		port_id = nfp_flower_cmsg_pcie_port(nfp_pcie, vnic_type,
273 						    i, queue);
274 		err = nfp_repr_init(app, repr,
275 				    port_id, port, priv->nn->dp.netdev);
276 		if (err) {
277 			nfp_port_free(port);
278 			nfp_repr_free(repr);
279 			goto err_reprs_clean;
280 		}
281 
282 		RCU_INIT_POINTER(reprs->reprs[i], repr);
283 		nfp_info(app->cpp, "%s%d Representor(%s) created\n",
284 			 repr_type == NFP_REPR_TYPE_PF ? "PF" : "VF", i,
285 			 repr->name);
286 	}
287 
288 	nfp_app_reprs_set(app, repr_type, reprs);
289 
290 	atomic_set(replies, 0);
291 	reify_cnt = nfp_flower_reprs_reify(app, repr_type, true);
292 	if (reify_cnt < 0) {
293 		err = reify_cnt;
294 		nfp_warn(app->cpp, "Failed to notify firmware about repr creation\n");
295 		goto err_reprs_remove;
296 	}
297 
298 	err = nfp_flower_wait_repr_reify(app, replies, reify_cnt);
299 	if (err)
300 		goto err_reprs_remove;
301 
302 	return 0;
303 err_reprs_remove:
304 	reprs = nfp_app_reprs_set(app, repr_type, NULL);
305 err_reprs_clean:
306 	nfp_reprs_clean_and_free(app, reprs);
307 	return err;
308 }
309 
310 static int nfp_flower_sriov_enable(struct nfp_app *app, int num_vfs)
311 {
312 	struct nfp_flower_priv *priv = app->priv;
313 
314 	if (!priv->nn)
315 		return 0;
316 
317 	return nfp_flower_spawn_vnic_reprs(app,
318 					   NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF,
319 					   NFP_REPR_TYPE_VF, num_vfs);
320 }
321 
322 static int
323 nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
324 {
325 	struct nfp_eth_table *eth_tbl = app->pf->eth_tbl;
326 	atomic_t *replies = &priv->reify_replies;
327 	struct sk_buff *ctrl_skb;
328 	struct nfp_reprs *reprs;
329 	int err, reify_cnt;
330 	unsigned int i;
331 
332 	ctrl_skb = nfp_flower_cmsg_mac_repr_start(app, eth_tbl->count);
333 	if (!ctrl_skb)
334 		return -ENOMEM;
335 
336 	reprs = nfp_reprs_alloc(eth_tbl->max_index + 1);
337 	if (!reprs) {
338 		err = -ENOMEM;
339 		goto err_free_ctrl_skb;
340 	}
341 
342 	for (i = 0; i < eth_tbl->count; i++) {
343 		unsigned int phys_port = eth_tbl->ports[i].index;
344 		struct net_device *repr;
345 		struct nfp_port *port;
346 		u32 cmsg_port_id;
347 
348 		repr = nfp_repr_alloc(app);
349 		if (!repr) {
350 			err = -ENOMEM;
351 			goto err_reprs_clean;
352 		}
353 
354 		port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr);
355 		if (IS_ERR(port)) {
356 			err = PTR_ERR(port);
357 			nfp_repr_free(repr);
358 			goto err_reprs_clean;
359 		}
360 		err = nfp_port_init_phy_port(app->pf, app, port, i);
361 		if (err) {
362 			nfp_port_free(port);
363 			nfp_repr_free(repr);
364 			goto err_reprs_clean;
365 		}
366 
367 		SET_NETDEV_DEV(repr, &priv->nn->pdev->dev);
368 		nfp_net_get_mac_addr(app->pf, repr, port);
369 
370 		cmsg_port_id = nfp_flower_cmsg_phys_port(phys_port);
371 		err = nfp_repr_init(app, repr,
372 				    cmsg_port_id, port, priv->nn->dp.netdev);
373 		if (err) {
374 			nfp_port_free(port);
375 			nfp_repr_free(repr);
376 			goto err_reprs_clean;
377 		}
378 
379 		nfp_flower_cmsg_mac_repr_add(ctrl_skb, i,
380 					     eth_tbl->ports[i].nbi,
381 					     eth_tbl->ports[i].base,
382 					     phys_port);
383 
384 		RCU_INIT_POINTER(reprs->reprs[phys_port], repr);
385 		nfp_info(app->cpp, "Phys Port %d Representor(%s) created\n",
386 			 phys_port, repr->name);
387 	}
388 
389 	nfp_app_reprs_set(app, NFP_REPR_TYPE_PHYS_PORT, reprs);
390 
391 	/* The REIFY/MAC_REPR control messages should be sent after the MAC
392 	 * representors are registered using nfp_app_reprs_set().  This is
393 	 * because the firmware may respond with control messages for the
394 	 * MAC representors, f.e. to provide the driver with information
395 	 * about their state, and without registration the driver will drop
396 	 * any such messages.
397 	 */
398 	atomic_set(replies, 0);
399 	reify_cnt = nfp_flower_reprs_reify(app, NFP_REPR_TYPE_PHYS_PORT, true);
400 	if (reify_cnt < 0) {
401 		err = reify_cnt;
402 		nfp_warn(app->cpp, "Failed to notify firmware about repr creation\n");
403 		goto err_reprs_remove;
404 	}
405 
406 	err = nfp_flower_wait_repr_reify(app, replies, reify_cnt);
407 	if (err)
408 		goto err_reprs_remove;
409 
410 	nfp_ctrl_tx(app->ctrl, ctrl_skb);
411 
412 	return 0;
413 err_reprs_remove:
414 	reprs = nfp_app_reprs_set(app, NFP_REPR_TYPE_PHYS_PORT, NULL);
415 err_reprs_clean:
416 	nfp_reprs_clean_and_free(app, reprs);
417 err_free_ctrl_skb:
418 	kfree_skb(ctrl_skb);
419 	return err;
420 }
421 
422 static int nfp_flower_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
423 				 unsigned int id)
424 {
425 	if (id > 0) {
426 		nfp_warn(app->cpp, "FlowerNIC doesn't support more than one data vNIC\n");
427 		goto err_invalid_port;
428 	}
429 
430 	eth_hw_addr_random(nn->dp.netdev);
431 	netif_keep_dst(nn->dp.netdev);
432 
433 	return 0;
434 
435 err_invalid_port:
436 	nn->port = nfp_port_alloc(app, NFP_PORT_INVALID, nn->dp.netdev);
437 	return PTR_ERR_OR_ZERO(nn->port);
438 }
439 
440 static void nfp_flower_vnic_clean(struct nfp_app *app, struct nfp_net *nn)
441 {
442 	struct nfp_flower_priv *priv = app->priv;
443 
444 	if (app->pf->num_vfs)
445 		nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_VF);
446 	nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PF);
447 	nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PHYS_PORT);
448 
449 	priv->nn = NULL;
450 }
451 
452 static int nfp_flower_vnic_init(struct nfp_app *app, struct nfp_net *nn)
453 {
454 	struct nfp_flower_priv *priv = app->priv;
455 	int err;
456 
457 	priv->nn = nn;
458 
459 	err = nfp_flower_spawn_phy_reprs(app, app->priv);
460 	if (err)
461 		goto err_clear_nn;
462 
463 	err = nfp_flower_spawn_vnic_reprs(app,
464 					  NFP_FLOWER_CMSG_PORT_VNIC_TYPE_PF,
465 					  NFP_REPR_TYPE_PF, 1);
466 	if (err)
467 		goto err_destroy_reprs_phy;
468 
469 	if (app->pf->num_vfs) {
470 		err = nfp_flower_spawn_vnic_reprs(app,
471 						  NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF,
472 						  NFP_REPR_TYPE_VF,
473 						  app->pf->num_vfs);
474 		if (err)
475 			goto err_destroy_reprs_pf;
476 	}
477 
478 	return 0;
479 
480 err_destroy_reprs_pf:
481 	nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PF);
482 err_destroy_reprs_phy:
483 	nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PHYS_PORT);
484 err_clear_nn:
485 	priv->nn = NULL;
486 	return err;
487 }
488 
489 static int nfp_flower_init(struct nfp_app *app)
490 {
491 	const struct nfp_pf *pf = app->pf;
492 	struct nfp_flower_priv *app_priv;
493 	u64 version, features;
494 	int err;
495 
496 	if (!pf->eth_tbl) {
497 		nfp_warn(app->cpp, "FlowerNIC requires eth table\n");
498 		return -EINVAL;
499 	}
500 
501 	if (!pf->mac_stats_bar) {
502 		nfp_warn(app->cpp, "FlowerNIC requires mac_stats BAR\n");
503 		return -EINVAL;
504 	}
505 
506 	if (!pf->vf_cfg_bar) {
507 		nfp_warn(app->cpp, "FlowerNIC requires vf_cfg BAR\n");
508 		return -EINVAL;
509 	}
510 
511 	version = nfp_rtsym_read_le(app->pf->rtbl, "hw_flower_version", &err);
512 	if (err) {
513 		nfp_warn(app->cpp, "FlowerNIC requires hw_flower_version memory symbol\n");
514 		return err;
515 	}
516 
517 	/* We need to ensure hardware has enough flower capabilities. */
518 	if (version != NFP_FLOWER_ALLOWED_VER) {
519 		nfp_warn(app->cpp, "FlowerNIC: unsupported firmware version\n");
520 		return -EINVAL;
521 	}
522 
523 	app_priv = vzalloc(sizeof(struct nfp_flower_priv));
524 	if (!app_priv)
525 		return -ENOMEM;
526 
527 	app->priv = app_priv;
528 	app_priv->app = app;
529 	skb_queue_head_init(&app_priv->cmsg_skbs_high);
530 	skb_queue_head_init(&app_priv->cmsg_skbs_low);
531 	INIT_WORK(&app_priv->cmsg_work, nfp_flower_cmsg_process_rx);
532 	init_waitqueue_head(&app_priv->reify_wait_queue);
533 
534 	init_waitqueue_head(&app_priv->mtu_conf.wait_q);
535 	spin_lock_init(&app_priv->mtu_conf.lock);
536 
537 	err = nfp_flower_metadata_init(app);
538 	if (err)
539 		goto err_free_app_priv;
540 
541 	/* Extract the extra features supported by the firmware. */
542 	features = nfp_rtsym_read_le(app->pf->rtbl,
543 				     "_abi_flower_extra_features", &err);
544 	if (err)
545 		app_priv->flower_ext_feats = 0;
546 	else
547 		app_priv->flower_ext_feats = features;
548 
549 	return 0;
550 
551 err_free_app_priv:
552 	vfree(app->priv);
553 	return err;
554 }
555 
556 static void nfp_flower_clean(struct nfp_app *app)
557 {
558 	struct nfp_flower_priv *app_priv = app->priv;
559 
560 	skb_queue_purge(&app_priv->cmsg_skbs_high);
561 	skb_queue_purge(&app_priv->cmsg_skbs_low);
562 	flush_work(&app_priv->cmsg_work);
563 
564 	nfp_flower_metadata_cleanup(app);
565 	vfree(app->priv);
566 	app->priv = NULL;
567 }
568 
569 static bool nfp_flower_check_ack(struct nfp_flower_priv *app_priv)
570 {
571 	bool ret;
572 
573 	spin_lock_bh(&app_priv->mtu_conf.lock);
574 	ret = app_priv->mtu_conf.ack;
575 	spin_unlock_bh(&app_priv->mtu_conf.lock);
576 
577 	return ret;
578 }
579 
580 static int
581 nfp_flower_repr_change_mtu(struct nfp_app *app, struct net_device *netdev,
582 			   int new_mtu)
583 {
584 	struct nfp_flower_priv *app_priv = app->priv;
585 	struct nfp_repr *repr = netdev_priv(netdev);
586 	int err, ack;
587 
588 	/* Only need to config FW for physical port MTU change. */
589 	if (repr->port->type != NFP_PORT_PHYS_PORT)
590 		return 0;
591 
592 	if (!(app_priv->flower_ext_feats & NFP_FL_NBI_MTU_SETTING)) {
593 		nfp_err(app->cpp, "Physical port MTU setting not supported\n");
594 		return -EINVAL;
595 	}
596 
597 	spin_lock_bh(&app_priv->mtu_conf.lock);
598 	app_priv->mtu_conf.ack = false;
599 	app_priv->mtu_conf.requested_val = new_mtu;
600 	app_priv->mtu_conf.portnum = repr->dst->u.port_info.port_id;
601 	spin_unlock_bh(&app_priv->mtu_conf.lock);
602 
603 	err = nfp_flower_cmsg_portmod(repr, netif_carrier_ok(netdev), new_mtu,
604 				      true);
605 	if (err) {
606 		spin_lock_bh(&app_priv->mtu_conf.lock);
607 		app_priv->mtu_conf.requested_val = 0;
608 		spin_unlock_bh(&app_priv->mtu_conf.lock);
609 		return err;
610 	}
611 
612 	/* Wait for fw to ack the change. */
613 	ack = wait_event_timeout(app_priv->mtu_conf.wait_q,
614 				 nfp_flower_check_ack(app_priv),
615 				 msecs_to_jiffies(10));
616 
617 	if (!ack) {
618 		spin_lock_bh(&app_priv->mtu_conf.lock);
619 		app_priv->mtu_conf.requested_val = 0;
620 		spin_unlock_bh(&app_priv->mtu_conf.lock);
621 		nfp_warn(app->cpp, "MTU change not verified with fw\n");
622 		return -EIO;
623 	}
624 
625 	return 0;
626 }
627 
628 static int nfp_flower_start(struct nfp_app *app)
629 {
630 	return nfp_tunnel_config_start(app);
631 }
632 
633 static void nfp_flower_stop(struct nfp_app *app)
634 {
635 	nfp_tunnel_config_stop(app);
636 }
637 
638 const struct nfp_app_type app_flower = {
639 	.id		= NFP_APP_FLOWER_NIC,
640 	.name		= "flower",
641 
642 	.ctrl_cap_mask	= ~0U,
643 	.ctrl_has_meta	= true,
644 
645 	.extra_cap	= nfp_flower_extra_cap,
646 
647 	.init		= nfp_flower_init,
648 	.clean		= nfp_flower_clean,
649 
650 	.repr_change_mtu  = nfp_flower_repr_change_mtu,
651 
652 	.vnic_alloc	= nfp_flower_vnic_alloc,
653 	.vnic_init	= nfp_flower_vnic_init,
654 	.vnic_clean	= nfp_flower_vnic_clean,
655 
656 	.repr_init	= nfp_flower_repr_netdev_init,
657 	.repr_preclean	= nfp_flower_repr_netdev_preclean,
658 	.repr_clean	= nfp_flower_repr_netdev_clean,
659 
660 	.repr_open	= nfp_flower_repr_netdev_open,
661 	.repr_stop	= nfp_flower_repr_netdev_stop,
662 
663 	.start		= nfp_flower_start,
664 	.stop		= nfp_flower_stop,
665 
666 	.ctrl_msg_rx	= nfp_flower_cmsg_rx,
667 
668 	.sriov_enable	= nfp_flower_sriov_enable,
669 	.sriov_disable	= nfp_flower_sriov_disable,
670 
671 	.eswitch_mode_get  = eswitch_mode_get,
672 	.repr_get	= nfp_flower_repr_get,
673 
674 	.setup_tc	= nfp_flower_setup_tc,
675 };
676