nfp: add basic SR-IOV ndo functions
authorPablo Cascón <pablo.cascon@netronome.com>
Fri, 25 Aug 2017 04:31:49 +0000 (21:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Aug 2017 02:24:58 +0000 (19:24 -0700)
Add basic ndo_set/get_vf to support SR-IOV.

VF to egress phy static mapping by now.

Use vfcfg ABI version 2 to write the info to the FW and collect
the return value from the mailbox.

Signed-off-by: Pablo Cascón <pablo.cascon@netronome.com>
Signed-off-by: Jimmy Kizito <jimmy.kizito@netronome.com>
Signed-off-by: Rami Tomer <rami.tomer@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/Makefile
drivers/net/ethernet/netronome/nfp/nfp_main.h
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h
drivers/net/ethernet/netronome/nfp/nfp_net_main.c
drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c [new file with mode: 0644]
drivers/net/ethernet/netronome/nfp/nfp_net_sriov.h [new file with mode: 0644]
drivers/net/ethernet/netronome/nfp/nic/main.c

index b8e1358868bd0da2e745b5155b6b9d977e111666..96e579a15cbe12ba150d94b309e3b7beb1ef19ac 100644 (file)
@@ -23,6 +23,7 @@ nfp-objs := \
            nfp_net_ethtool.o \
            nfp_net_main.o \
            nfp_net_repr.o \
+           nfp_net_sriov.o \
            nfp_netvf_main.o \
            nfp_port.o \
            bpf/main.o \
index 6922410806dbcb01f5bc0bf00af6da1d26e21e2c..be0ee59f2eb96ac148fc482b419fb773b2c26cc3 100644 (file)
@@ -73,6 +73,8 @@ struct nfp_rtsym_table;
  * @mac_stats_mem:     Pointer to mapped MAC stats area
  * @vf_cfg_bar:                Pointer to the CPP area for the VF configuration BAR
  * @vf_cfg_mem:                Pointer to mapped VF configuration area
+ * @vfcfg_tbl2_area:   Pointer to the CPP area for the VF config table
+ * @vfcfg_tbl2:                Pointer to mapped VF config table
  * @irq_entries:       Array of MSI-X entries for all vNICs
  * @limit_vfs:         Number of VFs supported by firmware (~0 for PCI limit)
  * @num_vfs:           Number of SR-IOV VFs enabled
@@ -107,6 +109,8 @@ struct nfp_pf {
        u8 __iomem *mac_stats_mem;
        struct nfp_cpp_area *vf_cfg_bar;
        u8 __iomem *vf_cfg_mem;
+       struct nfp_cpp_area *vfcfg_tbl2_area;
+       u8 __iomem *vfcfg_tbl2;
 
        struct msix_entry *irq_entries;
 
index 732f1d315fba55dbbca9b6fc6118f08cc6bc676b..ecbec28cfa76441bed835b94204fca16ccf75027 100644 (file)
@@ -71,6 +71,7 @@
 #include "nfp_app.h"
 #include "nfp_net_ctrl.h"
 #include "nfp_net.h"
+#include "nfp_net_sriov.h"
 #include "nfp_port.h"
 
 /**
@@ -3421,6 +3422,11 @@ const struct net_device_ops nfp_net_netdev_ops = {
        .ndo_get_stats64        = nfp_net_stat64,
        .ndo_vlan_rx_add_vid    = nfp_net_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = nfp_net_vlan_rx_kill_vid,
+       .ndo_set_vf_mac         = nfp_app_set_vf_mac,
+       .ndo_set_vf_vlan        = nfp_app_set_vf_vlan,
+       .ndo_set_vf_spoofchk    = nfp_app_set_vf_spoofchk,
+       .ndo_get_vf_config      = nfp_app_get_vf_config,
+       .ndo_set_vf_link_state  = nfp_app_set_vf_link_state,
        .ndo_setup_tc           = nfp_port_setup_tc,
        .ndo_tx_timeout         = nfp_net_tx_timeout,
        .ndo_set_rx_mode        = nfp_net_set_rx_mode,
index e5e94e0746ecbdae17f05d3e6b890b2c7f6cfe23..b0a452ba9039a92b5b98b9efad83407eaf98aeb1 100644 (file)
 #define   NFP_NET_CFG_UPDATE_BPF         (0x1 << 10) /* BPF program load */
 #define   NFP_NET_CFG_UPDATE_MACADDR     (0x1 << 11) /* MAC address change */
 #define   NFP_NET_CFG_UPDATE_MBOX        (0x1 << 12) /* Mailbox update */
+#define   NFP_NET_CFG_UPDATE_VF                  (0x1 << 13) /* VF settings change */
 #define   NFP_NET_CFG_UPDATE_ERR          (0x1 << 31) /* A error occurred */
 #define NFP_NET_CFG_TXRS_ENABLE         0x0008
 #define NFP_NET_CFG_RXRS_ENABLE         0x0010
index acdad6f202518386800595a09259690726e51868..2da083fd5e137c25e06376816314f332cdba9271 100644 (file)
@@ -57,6 +57,7 @@
 #include "nfpcore/nfp6000_pcie.h"
 #include "nfp_app.h"
 #include "nfp_net_ctrl.h"
+#include "nfp_net_sriov.h"
 #include "nfp_net.h"
 #include "nfp_main.h"
 #include "nfp_port.h"
@@ -489,6 +490,8 @@ static void nfp_net_pf_app_stop(struct nfp_pf *pf)
 
 static void nfp_net_pci_unmap_mem(struct nfp_pf *pf)
 {
+       if (pf->vfcfg_tbl2_area)
+               nfp_cpp_area_release_free(pf->vfcfg_tbl2_area);
        if (pf->vf_cfg_bar)
                nfp_cpp_area_release_free(pf->vf_cfg_bar);
        if (pf->mac_stats_bar)
@@ -535,17 +538,32 @@ static int nfp_net_pci_map_mem(struct nfp_pf *pf)
                pf->vf_cfg_mem = NULL;
        }
 
+       min_size = NFP_NET_VF_CFG_SZ * pf->limit_vfs + NFP_NET_VF_CFG_MB_SZ;
+       pf->vfcfg_tbl2 = nfp_net_pf_map_rtsym(pf, "net.vfcfg_tbl2",
+                                             "_pf%d_net_vf_cfg2",
+                                             min_size, &pf->vfcfg_tbl2_area);
+       if (IS_ERR(pf->vfcfg_tbl2)) {
+               if (PTR_ERR(pf->vfcfg_tbl2) != -ENOENT) {
+                       err = PTR_ERR(pf->vfcfg_tbl2);
+                       goto err_unmap_vf_cfg;
+               }
+               pf->vfcfg_tbl2 = NULL;
+       }
+
        mem = nfp_cpp_map_area(pf->cpp, "net.qc", 0, 0,
                               NFP_PCIE_QUEUE(0), NFP_QCP_QUEUE_AREA_SZ,
                               &pf->qc_area);
        if (IS_ERR(mem)) {
                nfp_err(pf->cpp, "Failed to map Queue Controller area.\n");
                err = PTR_ERR(mem);
-               goto err_unmap_vf_cfg;
+               goto err_unmap_vfcfg_tbl2;
        }
 
        return 0;
 
+err_unmap_vfcfg_tbl2:
+       if (pf->vfcfg_tbl2_area)
+               nfp_cpp_area_release_free(pf->vfcfg_tbl2_area);
 err_unmap_vf_cfg:
        if (pf->vf_cfg_bar)
                nfp_cpp_area_release_free(pf->vf_cfg_bar);
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c b/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c
new file mode 100644 (file)
index 0000000..e6d2e06
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2017 Netronome Systems, Inc.
+ *
+ * This software is dual licensed under the GNU General License Version 2,
+ * June 1991 as shown in the file COPYING in the top-level directory of this
+ * source tree or the BSD 2-Clause License provided below.  You have the
+ * option to license this software under the complete terms of either license.
+ *
+ * The BSD 2-Clause License:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      1. Redistributions of source code must retain the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer.
+ *
+ *      2. Redistributions in binary form must reproduce the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer in the documentation and/or other materials
+ *         provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/if_link.h>
+#include <linux/if_ether.h>
+
+#include "nfpcore/nfp_cpp.h"
+#include "nfp_app.h"
+#include "nfp_main.h"
+#include "nfp_net_ctrl.h"
+#include "nfp_net.h"
+#include "nfp_net_sriov.h"
+
+static int
+nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg)
+{
+       u16 cap_vf;
+
+       if (!app || !app->pf->vfcfg_tbl2)
+               return -EOPNOTSUPP;
+
+       cap_vf = readw(app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_CAP);
+       if ((cap_vf & cap) != cap) {
+               nfp_warn(app->pf->cpp, "ndo_set_vf_%s not supported\n", msg);
+               return -EOPNOTSUPP;
+       }
+
+       if (vf < 0 || vf >= app->pf->num_vfs) {
+               nfp_warn(app->pf->cpp, "invalid VF id %d\n", vf);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int
+nfp_net_sriov_update(struct nfp_app *app, int vf, u16 update, const char *msg)
+{
+       struct nfp_net *nn;
+       int ret;
+
+       /* Write update info to mailbox in VF config symbol */
+       writeb(vf, app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_VF_NUM);
+       writew(update, app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_UPD);
+
+       nn = list_first_entry(&app->pf->vnics, struct nfp_net, vnic_list);
+       /* Signal VF reconfiguration */
+       ret = nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_VF);
+       if (ret)
+               return ret;
+
+       ret = readw(app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_RET);
+       if (ret)
+               nfp_warn(app->pf->cpp,
+                        "FW refused VF %s update with errno: %d\n", msg, ret);
+       return -ret;
+}
+
+int nfp_app_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
+{
+       struct nfp_app *app = nfp_app_from_netdev(netdev);
+       unsigned int vf_offset;
+       int err;
+
+       err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_MAC, "mac");
+       if (err)
+               return err;
+
+       if (is_multicast_ether_addr(mac)) {
+               nfp_warn(app->pf->cpp,
+                        "invalid Ethernet address %pM for VF id %d\n",
+                        mac, vf);
+               return -EINVAL;
+       }
+
+       /* Write MAC to VF entry in VF config symbol */
+       vf_offset = NFP_NET_VF_CFG_MB_SZ + vf * NFP_NET_VF_CFG_SZ;
+       writel(get_unaligned_be32(mac), app->pf->vfcfg_tbl2 + vf_offset);
+       writew(get_unaligned_be16(mac + 4),
+              app->pf->vfcfg_tbl2 + vf_offset + NFP_NET_VF_CFG_MAC_LO);
+
+       return nfp_net_sriov_update(app, vf, NFP_NET_VF_CFG_MB_UPD_MAC, "MAC");
+}
+
+int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
+                       __be16 vlan_proto)
+{
+       struct nfp_app *app = nfp_app_from_netdev(netdev);
+       unsigned int vf_offset;
+       u16 vlan_tci;
+       int err;
+
+       err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN, "vlan");
+       if (err)
+               return err;
+
+       if (vlan_proto != htons(ETH_P_8021Q))
+               return -EOPNOTSUPP;
+
+       if (vlan > 4095 || qos > 7) {
+               nfp_warn(app->pf->cpp,
+                        "invalid vlan id or qos for VF id %d\n", vf);
+               return -EINVAL;
+       }
+
+       /* Write VLAN tag to VF entry in VF config symbol */
+       vlan_tci = FIELD_PREP(NFP_NET_VF_CFG_VLAN_VID, vlan) |
+               FIELD_PREP(NFP_NET_VF_CFG_VLAN_QOS, qos);
+       vf_offset = NFP_NET_VF_CFG_MB_SZ + vf * NFP_NET_VF_CFG_SZ;
+       writew(vlan_tci, app->pf->vfcfg_tbl2 + vf_offset + NFP_NET_VF_CFG_VLAN);
+
+       return nfp_net_sriov_update(app, vf, NFP_NET_VF_CFG_MB_UPD_VLAN,
+                                   "vlan");
+}
+
+int nfp_app_set_vf_spoofchk(struct net_device *netdev, int vf, bool enable)
+{
+       struct nfp_app *app = nfp_app_from_netdev(netdev);
+       unsigned int vf_offset;
+       u8 vf_ctrl;
+       int err;
+
+       err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_SPOOF,
+                                 "spoofchk");
+       if (err)
+               return err;
+
+       /* Write spoof check control bit to VF entry in VF config symbol */
+       vf_offset = NFP_NET_VF_CFG_MB_SZ + vf * NFP_NET_VF_CFG_SZ +
+               NFP_NET_VF_CFG_CTRL;
+       vf_ctrl = readb(app->pf->vfcfg_tbl2 + vf_offset);
+       vf_ctrl &= ~NFP_NET_VF_CFG_CTRL_SPOOF;
+       vf_ctrl |= FIELD_PREP(NFP_NET_VF_CFG_CTRL_SPOOF, enable);
+       writeb(vf_ctrl, app->pf->vfcfg_tbl2 + vf_offset);
+
+       return nfp_net_sriov_update(app, vf, NFP_NET_VF_CFG_MB_UPD_SPOOF,
+                                   "spoofchk");
+}
+
+int nfp_app_set_vf_link_state(struct net_device *netdev, int vf,
+                             int link_state)
+{
+       struct nfp_app *app = nfp_app_from_netdev(netdev);
+       unsigned int vf_offset;
+       u8 vf_ctrl;
+       int err;
+
+       err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_LINK_STATE,
+                                 "link_state");
+       if (err)
+               return err;
+
+       switch (link_state) {
+       case IFLA_VF_LINK_STATE_AUTO:
+       case IFLA_VF_LINK_STATE_ENABLE:
+       case IFLA_VF_LINK_STATE_DISABLE:
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       /* Write link state to VF entry in VF config symbol */
+       vf_offset = NFP_NET_VF_CFG_MB_SZ + vf * NFP_NET_VF_CFG_SZ +
+               NFP_NET_VF_CFG_CTRL;
+       vf_ctrl = readb(app->pf->vfcfg_tbl2 + vf_offset);
+       vf_ctrl &= ~NFP_NET_VF_CFG_CTRL_LINK_STATE;
+       vf_ctrl |= FIELD_PREP(NFP_NET_VF_CFG_CTRL_LINK_STATE, link_state);
+       writeb(vf_ctrl, app->pf->vfcfg_tbl2 + vf_offset);
+
+       return nfp_net_sriov_update(app, vf, NFP_NET_VF_CFG_MB_UPD_LINK_STATE,
+                                   "link state");
+}
+
+int nfp_app_get_vf_config(struct net_device *netdev, int vf,
+                         struct ifla_vf_info *ivi)
+{
+       struct nfp_app *app = nfp_app_from_netdev(netdev);
+       unsigned int vf_offset;
+       u16 vlan_tci;
+       u32 mac_hi;
+       u16 mac_lo;
+       u8 flags;
+       int err;
+
+       err = nfp_net_sriov_check(app, vf, 0, "");
+       if (err)
+               return err;
+
+       vf_offset = NFP_NET_VF_CFG_MB_SZ + vf * NFP_NET_VF_CFG_SZ;
+
+       mac_hi = readl(app->pf->vfcfg_tbl2 + vf_offset);
+       mac_lo = readw(app->pf->vfcfg_tbl2 + vf_offset + NFP_NET_VF_CFG_MAC_LO);
+
+       flags = readb(app->pf->vfcfg_tbl2 + vf_offset + NFP_NET_VF_CFG_CTRL);
+       vlan_tci = readw(app->pf->vfcfg_tbl2 + vf_offset + NFP_NET_VF_CFG_VLAN);
+
+       memset(ivi, 0, sizeof(*ivi));
+       ivi->vf = vf;
+
+       put_unaligned_be32(mac_hi, &ivi->mac[0]);
+       put_unaligned_be16(mac_lo, &ivi->mac[4]);
+
+       ivi->vlan = FIELD_GET(NFP_NET_VF_CFG_VLAN_VID, vlan_tci);
+       ivi->qos = FIELD_GET(NFP_NET_VF_CFG_VLAN_QOS, vlan_tci);
+
+       ivi->spoofchk = FIELD_GET(NFP_NET_VF_CFG_CTRL_SPOOF, flags);
+       ivi->linkstate = FIELD_GET(NFP_NET_VF_CFG_CTRL_LINK_STATE, flags);
+
+       return 0;
+}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.h b/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.h
new file mode 100644 (file)
index 0000000..e9df9d1
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2017 Netronome Systems, Inc.
+ *
+ * This software is dual licensed under the GNU General License Version 2,
+ * June 1991 as shown in the file COPYING in the top-level directory of this
+ * source tree or the BSD 2-Clause License provided below.  You have the
+ * option to license this software under the complete terms of either license.
+ *
+ * The BSD 2-Clause License:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      1. Redistributions of source code must retain the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer.
+ *
+ *      2. Redistributions in binary form must reproduce the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer in the documentation and/or other materials
+ *         provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _NFP_NET_SRIOV_H_
+#define _NFP_NET_SRIOV_H_
+
+/**
+ * SRIOV VF configuration.
+ * The configuration memory begins with a mailbox region for communication with
+ * the firmware followed by individual VF entries.
+ */
+#define NFP_NET_VF_CFG_SZ              16
+#define NFP_NET_VF_CFG_MB_SZ           16
+
+/* VF config mailbox */
+#define NFP_NET_VF_CFG_MB                              0x0
+#define NFP_NET_VF_CFG_MB_CAP                          0x0
+#define   NFP_NET_VF_CFG_MB_CAP_MAC                      (0x1 << 0)
+#define   NFP_NET_VF_CFG_MB_CAP_VLAN                     (0x1 << 1)
+#define   NFP_NET_VF_CFG_MB_CAP_SPOOF                    (0x1 << 2)
+#define   NFP_NET_VF_CFG_MB_CAP_LINK_STATE               (0x1 << 3)
+#define NFP_NET_VF_CFG_MB_RET                          0x2
+#define NFP_NET_VF_CFG_MB_UPD                          0x4
+#define   NFP_NET_VF_CFG_MB_UPD_MAC                      (0x1 << 0)
+#define   NFP_NET_VF_CFG_MB_UPD_VLAN                     (0x1 << 1)
+#define   NFP_NET_VF_CFG_MB_UPD_SPOOF                    (0x1 << 2)
+#define   NFP_NET_VF_CFG_MB_UPD_LINK_STATE               (0x1 << 3)
+#define NFP_NET_VF_CFG_MB_VF_NUM                       0x7
+
+/* VF config entry
+ * MAC_LO is set that the MAC address can be read in a single 6 byte read
+ * by the NFP
+ */
+#define NFP_NET_VF_CFG_MAC                             0x0
+#define   NFP_NET_VF_CFG_MAC_HI                                  0x0
+#define   NFP_NET_VF_CFG_MAC_LO                                  0x6
+#define NFP_NET_VF_CFG_CTRL                            0x4
+#define   NFP_NET_VF_CFG_CTRL_SPOOF                      0x4
+#define   NFP_NET_VF_CFG_CTRL_LINK_STATE                 0x3
+#define     NFP_NET_VF_CFG_LS_MODE_AUTO                            0
+#define     NFP_NET_VF_CFG_LS_MODE_ENABLE                  1
+#define     NFP_NET_VF_CFG_LS_MODE_DISABLE                 2
+#define NFP_NET_VF_CFG_VLAN                            0x8
+#define   NFP_NET_VF_CFG_VLAN_QOS                        0xe000
+#define   NFP_NET_VF_CFG_VLAN_VID                        0x0fff
+
+int nfp_app_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
+int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
+                       __be16 vlan_proto);
+int nfp_app_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
+int nfp_app_set_vf_link_state(struct net_device *netdev, int vf,
+                             int link_state);
+int nfp_app_get_vf_config(struct net_device *netdev, int vf,
+                         struct ifla_vf_info *ivi);
+
+#endif /* _NFP_NET_SRIOV_H_ */
index 520684242b7dd2e045fd8b3e54bbe4feb3646f8a..8287a85d22c1445e8065f23f3f8ae89be452e5c8 100644 (file)
@@ -49,10 +49,22 @@ static int nfp_nic_init(struct nfp_app *app)
        return 0;
 }
 
+static int nfp_nic_sriov_enable(struct nfp_app *app, int num_vfs)
+{
+       return 0;
+}
+
+static void nfp_nic_sriov_disable(struct nfp_app *app)
+{
+}
+
 const struct nfp_app_type app_nic = {
        .id             = NFP_APP_CORE_NIC,
        .name           = "nic",
 
        .init           = nfp_nic_init,
        .vnic_init      = nfp_app_nic_vnic_init,
+
+       .sriov_enable   = nfp_nic_sriov_enable,
+       .sriov_disable  = nfp_nic_sriov_disable,
 };