nfp: implement netpoll ndo (thus enabling netconsole)
authorJakub Kicinski <jakub.kicinski@netronome.com>
Sat, 30 Jun 2018 00:04:36 +0000 (17:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Jun 2018 12:31:56 +0000 (21:31 +0900)
NFP NAPI handling will only complete the TXed packets when called
with budget of 0, implement ndo_poll_controller by scheduling NAPI
on all TX queues.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c

index d4c27f8..edc6ef6 100644 (file)
@@ -3115,6 +3115,21 @@ nfp_net_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
        return nfp_net_reconfig_mbox(nn, NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_KILL);
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void nfp_net_netpoll(struct net_device *netdev)
+{
+       struct nfp_net *nn = netdev_priv(netdev);
+       int i;
+
+       /* nfp_net's NAPIs are statically allocated so even if there is a race
+        * with reconfig path this will simply try to schedule some disabled
+        * NAPI instances.
+        */
+       for (i = 0; i < nn->dp.num_stack_tx_rings; i++)
+               napi_schedule_irqoff(&nn->r_vecs[i].napi);
+}
+#endif
+
 static void nfp_net_stat64(struct net_device *netdev,
                           struct rtnl_link_stats64 *stats)
 {
@@ -3482,6 +3497,9 @@ 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,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = nfp_net_netpoll,
+#endif
        .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,