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

nfp: add per-data path feature mask

Make sure that features supported only by some of the data paths
are not enabled for all.  Add a mask of supported features into
the data path op structure.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarFei Qin <fei.qin@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0dcf7f50
...@@ -242,9 +242,24 @@ nfp_nfd3_print_tx_descs(struct seq_file *file, ...@@ -242,9 +242,24 @@ nfp_nfd3_print_tx_descs(struct seq_file *file,
} }
} }
#define NFP_NFD3_CFG_CTRL_SUPPORTED \
(NFP_NET_CFG_CTRL_ENABLE | NFP_NET_CFG_CTRL_PROMISC | \
NFP_NET_CFG_CTRL_L2BC | NFP_NET_CFG_CTRL_L2MC | \
NFP_NET_CFG_CTRL_RXCSUM | NFP_NET_CFG_CTRL_TXCSUM | \
NFP_NET_CFG_CTRL_RXVLAN | NFP_NET_CFG_CTRL_TXVLAN | \
NFP_NET_CFG_CTRL_GATHER | NFP_NET_CFG_CTRL_LSO | \
NFP_NET_CFG_CTRL_CTAG_FILTER | NFP_NET_CFG_CTRL_CMSG_DATA | \
NFP_NET_CFG_CTRL_RINGCFG | NFP_NET_CFG_CTRL_RSS | \
NFP_NET_CFG_CTRL_IRQMOD | NFP_NET_CFG_CTRL_TXRWB | \
NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE | \
NFP_NET_CFG_CTRL_BPF | NFP_NET_CFG_CTRL_LSO2 | \
NFP_NET_CFG_CTRL_RSS2 | NFP_NET_CFG_CTRL_CSUM_COMPLETE | \
NFP_NET_CFG_CTRL_LIVE_ADDR)
const struct nfp_dp_ops nfp_nfd3_ops = { const struct nfp_dp_ops nfp_nfd3_ops = {
.version = NFP_NFD_VER_NFD3, .version = NFP_NFD_VER_NFD3,
.tx_min_desc_per_pkt = 1, .tx_min_desc_per_pkt = 1,
.cap_mask = NFP_NFD3_CFG_CTRL_SUPPORTED,
.poll = nfp_nfd3_poll, .poll = nfp_nfd3_poll,
.xsk_poll = nfp_nfd3_xsk_poll, .xsk_poll = nfp_nfd3_xsk_poll,
.ctrl_poll = nfp_nfd3_ctrl_poll, .ctrl_poll = nfp_nfd3_ctrl_poll,
......
...@@ -2303,6 +2303,9 @@ static int nfp_net_read_caps(struct nfp_net *nn) ...@@ -2303,6 +2303,9 @@ static int nfp_net_read_caps(struct nfp_net *nn)
nn->dp.rx_offset = NFP_NET_RX_OFFSET; nn->dp.rx_offset = NFP_NET_RX_OFFSET;
} }
/* Mask out NFD-version-specific features */
nn->cap &= nn->dp.ops->cap_mask;
/* For control vNICs mask out the capabilities app doesn't want. */ /* For control vNICs mask out the capabilities app doesn't want. */
if (!nn->dp.netdev) if (!nn->dp.netdev)
nn->cap &= nn->app->type->ctrl_cap_mask; nn->cap &= nn->app->type->ctrl_cap_mask;
......
...@@ -115,6 +115,7 @@ enum nfp_nfd_version { ...@@ -115,6 +115,7 @@ enum nfp_nfd_version {
* struct nfp_dp_ops - Hooks to wrap different implementation of different dp * struct nfp_dp_ops - Hooks to wrap different implementation of different dp
* @version: Indicate dp type * @version: Indicate dp type
* @tx_min_desc_per_pkt: Minimal TX descs needed for each packet * @tx_min_desc_per_pkt: Minimal TX descs needed for each packet
* @cap_mask: Mask of supported features
* @poll: Napi poll for normal rx/tx * @poll: Napi poll for normal rx/tx
* @xsk_poll: Napi poll when xsk is enabled * @xsk_poll: Napi poll when xsk is enabled
* @ctrl_poll: Tasklet poll for ctrl rx/tx * @ctrl_poll: Tasklet poll for ctrl rx/tx
...@@ -131,6 +132,7 @@ enum nfp_nfd_version { ...@@ -131,6 +132,7 @@ enum nfp_nfd_version {
struct nfp_dp_ops { struct nfp_dp_ops {
enum nfp_nfd_version version; enum nfp_nfd_version version;
unsigned int tx_min_desc_per_pkt; unsigned int tx_min_desc_per_pkt;
u32 cap_mask;
int (*poll)(struct napi_struct *napi, int budget); int (*poll)(struct napi_struct *napi, int budget);
int (*xsk_poll)(struct napi_struct *napi, int budget); int (*xsk_poll)(struct napi_struct *napi, int budget);
......
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