Skip to content

Commit

Permalink
nfp: add control vNIC datapath
Browse files Browse the repository at this point in the history
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: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Jun 7, 2017
1 parent 5c0dbe9 commit 77ece8d
Show file tree
Hide file tree
Showing 4 changed files with 345 additions and 9 deletions.
11 changes: 11 additions & 0 deletions drivers/net/ethernet/netronome/nfp/nfp_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down
17 changes: 16 additions & 1 deletion drivers/net/ethernet/netronome/nfp/nfp_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[];

Expand All @@ -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);
Expand Down
Loading

0 comments on commit 77ece8d

Please sign in to comment.