Skip to content

Commit

Permalink
qede: Split PF/VF ndos.
Browse files Browse the repository at this point in the history
PFs and VFs share the same structure of NDOs today,
and the VFs explicitly fails the ndo_xdp() callback stating
it doesn't support XDP.

This results in lots of:

  [qede_xdp:1032(enp131s2)]VFs don't support XDP
  ------------[ cut here ]------------
  WARNING: CPU: 4 PID: 1426 at net/core/rtnetlink.c:1637 rtnl_dump_ifinfo+0x354/0x3c0
  ...
  Call Trace:
    ? __alloc_skb+0x9b/0x1d0
    netlink_dump+0x122/0x290
    netlink_recvmsg+0x27d/0x430
    sock_recvmsg+0x3d/0x50
  ...

As every dump request for the VF interface info would fail due to
rtnl_xdp_fill() returning an error code.

To resolve this, introduce a subset of the NDOs meant for the VF
in a seperate structure and register that one instead for VFs,
and omit the ndo_xdp initialization.

Fixes: 40b8c45 ("qede: Prevent VFs from using XDP")
Signed-off-by: Yuval Mintz <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Mintz, Yuval authored and davem330 committed May 9, 2017
1 parent a82dadb commit be47c55
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
5 changes: 0 additions & 5 deletions drivers/net/ethernet/qlogic/qede/qede_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,11 +1028,6 @@ int qede_xdp(struct net_device *dev, struct netdev_xdp *xdp)
{
struct qede_dev *edev = netdev_priv(dev);

if (IS_VF(edev)) {
DP_NOTICE(edev, "VFs don't support XDP\n");
return -EOPNOTSUPP;
}

switch (xdp->command) {
case XDP_SETUP_PROG:
return qede_xdp_set(edev, xdp->prog);
Expand Down
22 changes: 21 additions & 1 deletion drivers/net/ethernet/qlogic/qede/qede_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,23 @@ static const struct net_device_ops qede_netdev_ops = {
#endif
};

static const struct net_device_ops qede_netdev_vf_ops = {
.ndo_open = qede_open,
.ndo_stop = qede_close,
.ndo_start_xmit = qede_start_xmit,
.ndo_set_rx_mode = qede_set_rx_mode,
.ndo_set_mac_address = qede_set_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = qede_change_mtu,
.ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid,
.ndo_set_features = qede_set_features,
.ndo_get_stats64 = qede_get_stats64,
.ndo_udp_tunnel_add = qede_udp_tunnel_add,
.ndo_udp_tunnel_del = qede_udp_tunnel_del,
.ndo_features_check = qede_features_check,
};

/* -------------------------------------------------------------------------
* START OF PROBE / REMOVE
* -------------------------------------------------------------------------
Expand Down Expand Up @@ -622,7 +639,10 @@ static void qede_init_ndev(struct qede_dev *edev)

ndev->watchdog_timeo = TX_TIMEOUT;

ndev->netdev_ops = &qede_netdev_ops;
if (IS_VF(edev))
ndev->netdev_ops = &qede_netdev_vf_ops;
else
ndev->netdev_ops = &qede_netdev_ops;

qede_set_ethtool_ops(ndev);

Expand Down

0 comments on commit be47c55

Please sign in to comment.