Commit 77ece8d5 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: add control vNIC datapath

Since control vNICs don't have a netdev, they can't use napi and
queuing stack provides.  Add simple tasklet-based data receive
and send of control messages with queuing on a skb_list.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c0dbe9e
......@@ -38,6 +38,7 @@ struct bpf_prog;
struct net_device;
struct pci_dev;
struct tc_to_netdev;
struct sk_buff;
struct nfp_app;
struct nfp_cpp;
struct nfp_pf;
......@@ -55,6 +56,7 @@ extern const struct nfp_app_type app_bpf;
* struct nfp_app_type - application definition
* @id: application ID
* @name: application name
* @ctrl_has_meta: control messages have prepend of type:5/port:CTRL
*
* Callbacks
* @init: perform basic app checks
......@@ -69,6 +71,8 @@ struct nfp_app_type {
enum nfp_app_id id;
const char *name;
bool ctrl_has_meta;
int (*init)(struct nfp_app *app);
const char *(*extra_cap)(struct nfp_app *app, struct nfp_net *nn);
......@@ -99,6 +103,8 @@ struct nfp_app {
const struct nfp_app_type *type;
};
bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb);
static inline int nfp_app_init(struct nfp_app *app)
{
if (!app->type->init)
......@@ -125,6 +131,11 @@ static inline const char *nfp_app_name(struct nfp_app *app)
return app->type->name;
}
static inline bool nfp_app_ctrl_has_meta(struct nfp_app *app)
{
return app->type->ctrl_has_meta;
}
static inline const char *nfp_app_extra_cap(struct nfp_app *app,
struct nfp_net *nn)
{
......
......@@ -405,7 +405,14 @@ struct nfp_net_rx_ring {
*/
struct nfp_net_r_vector {
struct nfp_net *nfp_net;
struct napi_struct napi;
union {
struct napi_struct napi;
struct {
struct tasklet_struct tasklet;
struct sk_buff_head queue;
struct spinlock lock;
};
};
struct nfp_net_tx_ring *tx_ring;
struct nfp_net_rx_ring *rx_ring;
......@@ -816,6 +823,11 @@ static inline bool nfp_net_running(struct nfp_net *nn)
return nn->dp.ctrl & NFP_NET_CFG_CTRL_ENABLE;
}
static inline const char *nfp_net_name(struct nfp_net *nn)
{
return nn->dp.netdev ? nn->dp.netdev->name : "ctrl";
}
/* Globals */
extern const char nfp_driver_version[];
......@@ -838,6 +850,9 @@ void nfp_net_free(struct nfp_net *nn);
int nfp_net_init(struct nfp_net *nn);
void nfp_net_clean(struct nfp_net *nn);
int nfp_ctrl_open(struct nfp_net *nn);
void nfp_ctrl_close(struct nfp_net *nn);
void nfp_net_set_ethtool_ops(struct net_device *netdev);
void nfp_net_info(struct nfp_net *nn);
int nfp_net_reconfig(struct nfp_net *nn, u32 update);
......
......@@ -71,8 +71,11 @@
#define NFP_NET_META_FIELD_SIZE 4
#define NFP_NET_META_HASH 1 /* next field carries hash type */
#define NFP_NET_META_MARK 2
#define NFP_NET_META_PORTID 5
#define NFP_NET_META_CSUM 6 /* checksum complete type */
#define NFP_META_PORT_ID_CTRL ~0U
/**
* Hash type pre-pended when a RSS hash was computed
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment