Commit fac0cef9 authored by David S. Miller's avatar David S. Miller

Merge branch 'nfp-SR-IOV-ndos-support'

Jakub Kicinski says:

====================
nfp: SR-IOV ndos support

This set adds basic SR-IOV including setting/getting VF MAC addresses,
VLANs, link state and spoofcheck settings.  It is wired up for both
vNICs and representors (note: ip link will not report VF settings on
VF/PF representors because they are not linked to the PF PCI device).

Pablo and team add the basic implementation, Simon and Dirk follow
up with the representor plumbing.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents bd9dfc54 6abd224b
...@@ -23,6 +23,7 @@ nfp-objs := \ ...@@ -23,6 +23,7 @@ nfp-objs := \
nfp_net_ethtool.o \ nfp_net_ethtool.o \
nfp_net_main.o \ nfp_net_main.o \
nfp_net_repr.o \ nfp_net_repr.o \
nfp_net_sriov.o \
nfp_netvf_main.o \ nfp_netvf_main.o \
nfp_port.o \ nfp_port.o \
bpf/main.o \ bpf/main.o \
......
...@@ -73,6 +73,8 @@ struct nfp_rtsym_table; ...@@ -73,6 +73,8 @@ struct nfp_rtsym_table;
* @mac_stats_mem: Pointer to mapped MAC stats area * @mac_stats_mem: Pointer to mapped MAC stats area
* @vf_cfg_bar: Pointer to the CPP area for the VF configuration BAR * @vf_cfg_bar: Pointer to the CPP area for the VF configuration BAR
* @vf_cfg_mem: Pointer to mapped VF configuration area * @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 * @irq_entries: Array of MSI-X entries for all vNICs
* @limit_vfs: Number of VFs supported by firmware (~0 for PCI limit) * @limit_vfs: Number of VFs supported by firmware (~0 for PCI limit)
* @num_vfs: Number of SR-IOV VFs enabled * @num_vfs: Number of SR-IOV VFs enabled
...@@ -107,6 +109,8 @@ struct nfp_pf { ...@@ -107,6 +109,8 @@ struct nfp_pf {
u8 __iomem *mac_stats_mem; u8 __iomem *mac_stats_mem;
struct nfp_cpp_area *vf_cfg_bar; struct nfp_cpp_area *vf_cfg_bar;
u8 __iomem *vf_cfg_mem; u8 __iomem *vf_cfg_mem;
struct nfp_cpp_area *vfcfg_tbl2_area;
u8 __iomem *vfcfg_tbl2;
struct msix_entry *irq_entries; struct msix_entry *irq_entries;
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include "nfp_app.h" #include "nfp_app.h"
#include "nfp_net_ctrl.h" #include "nfp_net_ctrl.h"
#include "nfp_net.h" #include "nfp_net.h"
#include "nfp_net_sriov.h"
#include "nfp_port.h" #include "nfp_port.h"
/** /**
...@@ -3421,6 +3422,11 @@ const struct net_device_ops nfp_net_netdev_ops = { ...@@ -3421,6 +3422,11 @@ const struct net_device_ops nfp_net_netdev_ops = {
.ndo_get_stats64 = nfp_net_stat64, .ndo_get_stats64 = nfp_net_stat64,
.ndo_vlan_rx_add_vid = nfp_net_vlan_rx_add_vid, .ndo_vlan_rx_add_vid = nfp_net_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = nfp_net_vlan_rx_kill_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_setup_tc = nfp_port_setup_tc,
.ndo_tx_timeout = nfp_net_tx_timeout, .ndo_tx_timeout = nfp_net_tx_timeout,
.ndo_set_rx_mode = nfp_net_set_rx_mode, .ndo_set_rx_mode = nfp_net_set_rx_mode,
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
#define NFP_NET_CFG_UPDATE_BPF (0x1 << 10) /* BPF program load */ #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_MACADDR (0x1 << 11) /* MAC address change */
#define NFP_NET_CFG_UPDATE_MBOX (0x1 << 12) /* Mailbox update */ #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_UPDATE_ERR (0x1 << 31) /* A error occurred */
#define NFP_NET_CFG_TXRS_ENABLE 0x0008 #define NFP_NET_CFG_TXRS_ENABLE 0x0008
#define NFP_NET_CFG_RXRS_ENABLE 0x0010 #define NFP_NET_CFG_RXRS_ENABLE 0x0010
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include "nfpcore/nfp6000_pcie.h" #include "nfpcore/nfp6000_pcie.h"
#include "nfp_app.h" #include "nfp_app.h"
#include "nfp_net_ctrl.h" #include "nfp_net_ctrl.h"
#include "nfp_net_sriov.h"
#include "nfp_net.h" #include "nfp_net.h"
#include "nfp_main.h" #include "nfp_main.h"
#include "nfp_port.h" #include "nfp_port.h"
...@@ -489,6 +490,8 @@ static void nfp_net_pf_app_stop(struct nfp_pf *pf) ...@@ -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) 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) if (pf->vf_cfg_bar)
nfp_cpp_area_release_free(pf->vf_cfg_bar); nfp_cpp_area_release_free(pf->vf_cfg_bar);
if (pf->mac_stats_bar) if (pf->mac_stats_bar)
...@@ -535,17 +538,32 @@ static int nfp_net_pci_map_mem(struct nfp_pf *pf) ...@@ -535,17 +538,32 @@ static int nfp_net_pci_map_mem(struct nfp_pf *pf)
pf->vf_cfg_mem = NULL; 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, mem = nfp_cpp_map_area(pf->cpp, "net.qc", 0, 0,
NFP_PCIE_QUEUE(0), NFP_QCP_QUEUE_AREA_SZ, NFP_PCIE_QUEUE(0), NFP_QCP_QUEUE_AREA_SZ,
&pf->qc_area); &pf->qc_area);
if (IS_ERR(mem)) { if (IS_ERR(mem)) {
nfp_err(pf->cpp, "Failed to map Queue Controller area.\n"); nfp_err(pf->cpp, "Failed to map Queue Controller area.\n");
err = PTR_ERR(mem); err = PTR_ERR(mem);
goto err_unmap_vf_cfg; goto err_unmap_vfcfg_tbl2;
} }
return 0; return 0;
err_unmap_vfcfg_tbl2:
if (pf->vfcfg_tbl2_area)
nfp_cpp_area_release_free(pf->vfcfg_tbl2_area);
err_unmap_vf_cfg: err_unmap_vf_cfg:
if (pf->vf_cfg_bar) if (pf->vf_cfg_bar)
nfp_cpp_area_release_free(pf->vf_cfg_bar); nfp_cpp_area_release_free(pf->vf_cfg_bar);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "nfp_main.h" #include "nfp_main.h"
#include "nfp_net_ctrl.h" #include "nfp_net_ctrl.h"
#include "nfp_net_repr.h" #include "nfp_net_repr.h"
#include "nfp_net_sriov.h"
#include "nfp_port.h" #include "nfp_port.h"
static void static void
...@@ -247,6 +248,11 @@ const struct net_device_ops nfp_repr_netdev_ops = { ...@@ -247,6 +248,11 @@ const struct net_device_ops nfp_repr_netdev_ops = {
.ndo_get_offload_stats = nfp_repr_get_offload_stats, .ndo_get_offload_stats = nfp_repr_get_offload_stats,
.ndo_get_phys_port_name = nfp_port_get_phys_port_name, .ndo_get_phys_port_name = nfp_port_get_phys_port_name,
.ndo_setup_tc = nfp_port_setup_tc, .ndo_setup_tc = nfp_port_setup_tc,
.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,
}; };
static void nfp_repr_clean(struct nfp_repr *repr) static void nfp_repr_clean(struct nfp_repr *repr)
......
/*
* 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;
}
/*
* 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_ */
...@@ -49,10 +49,22 @@ static int nfp_nic_init(struct nfp_app *app) ...@@ -49,10 +49,22 @@ static int nfp_nic_init(struct nfp_app *app)
return 0; 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 = { const struct nfp_app_type app_nic = {
.id = NFP_APP_CORE_NIC, .id = NFP_APP_CORE_NIC,
.name = "nic", .name = "nic",
.init = nfp_nic_init, .init = nfp_nic_init,
.vnic_init = nfp_app_nic_vnic_init, .vnic_init = nfp_app_nic_vnic_init,
.sriov_enable = nfp_nic_sriov_enable,
.sriov_disable = nfp_nic_sriov_disable,
}; };
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