[net-next,05/25] fm10k: Add netconsole support
diff mbox

Message ID 1428092835-16834-5-git-send-email-jeffrey.t.kirsher@intel.com
State Changes Requested
Delegated to: Jeff Kirsher
Headers show

Commit Message

Jeff Kirsher April 3, 2015, 8:26 p.m. UTC
This change adds a function called "fm10k_netpoll" that's used to define
"ndo_poll_controller" in "fm10k_netdev_ops". This is required to enable
support for "netconsole" in fm10k.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com>
Acked-by: Matthew Vick <matthew.vick@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k.h        |  1 +
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 21 +++++++++++++++++++++
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c    |  2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

Comments

Jeff Kirsher April 3, 2015, 9:02 p.m. UTC | #1
On Fri, 2015-04-03 at 13:26 -0700, Jeff Kirsher wrote:
> This change adds a function called "fm10k_netpoll" that's used to
> define
> "ndo_poll_controller" in "fm10k_netdev_ops". This is required to
> enable
> support for "netconsole" in fm10k.
> 
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Signed-off-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com>
> Acked-by: Matthew Vick <matthew.vick@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k.h        |  1 +
>  drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 21
> +++++++++++++++++++++
>  drivers/net/ethernet/intel/fm10k/fm10k_pci.c    |  2 +-
>  3 files changed, 23 insertions(+), 1 deletion(-)

I have applied to my queue.
Alexander Duyck April 7, 2015, 3:17 p.m. UTC | #2
On 04/03/2015 01:26 PM, Jeff Kirsher wrote:
> This change adds a function called "fm10k_netpoll" that's used to define
> "ndo_poll_controller" in "fm10k_netdev_ops". This is required to enable
> support for "netconsole" in fm10k.
>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Signed-off-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com>
> Acked-by: Matthew Vick <matthew.vick@intel.com>
> ---
>   drivers/net/ethernet/intel/fm10k/fm10k.h        |  1 +
>   drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 21 +++++++++++++++++++++
>   drivers/net/ethernet/intel/fm10k/fm10k_pci.c    |  2 +-
>   3 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
> index 65e7001..715d0a0 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k.h
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
> @@ -457,6 +457,7 @@ void fm10k_down(struct fm10k_intfc *interface);
>   void fm10k_update_stats(struct fm10k_intfc *interface);
>   void fm10k_service_event_schedule(struct fm10k_intfc *interface);
>   void fm10k_update_rx_drop_en(struct fm10k_intfc *interface);
> +irqreturn_t fm10k_msix_clean_rings(int irq, void *data);
>   
>   /* Netdev */
>   struct net_device *fm10k_alloc_netdev(void);
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> index a7db5e2..2a61b83 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> @@ -1350,6 +1350,26 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv)
>   	}
>   }
>   
> +/**
> + * fm10k_netpoll - A Polling 'interrupt' handler
> + * @netdev: network interface device structure
> + *
> + * This is used by netconsole to send skbs without having to re-enable
> + * interrupts. It's not called while the normal interrupt routine is executing.
> + **/
> +static void fm10k_netpoll(struct net_device *netdev)
> +{
> +	struct fm10k_intfc *interface = netdev_priv(netdev);
> +	int i;
> +
> +	/* if interface is down do nothing */
> +	if (test_bit(__FM10K_DOWN, &interface->state))
> +		return;
> +
> +	for (i = 0; i < interface->num_q_vectors; i++)
> +		fm10k_msix_clean_rings(0, interface->q_vector[i]);
> +}
> +
>   static netdev_features_t fm10k_features_check(struct sk_buff *skb,
>   					      struct net_device *dev,
>   					      netdev_features_t features)
> @@ -1382,6 +1402,7 @@ static const struct net_device_ops fm10k_netdev_ops = {
>   	.ndo_do_ioctl		= fm10k_ioctl,
>   	.ndo_dfwd_add_station	= fm10k_dfwd_add_station,
>   	.ndo_dfwd_del_station	= fm10k_dfwd_del_station,
> +	.ndo_poll_controller	= fm10k_netpoll,
>   	.ndo_features_check	= fm10k_features_check,
>   };
>   
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> index 6fc9965..c11e2c9 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> @@ -807,7 +807,7 @@ static void fm10k_napi_enable_all(struct fm10k_intfc *interface)
>   	}
>   }
>   
> -static irqreturn_t fm10k_msix_clean_rings(int irq, void *data)
> +irqreturn_t fm10k_msix_clean_rings(int irq, void *data)
>   {
>   	struct fm10k_q_vector *q_vector = data;
>   

2 quick issues with this patch based on the fact that it triggered the 
build bot.

1.  You should probably place fm10k_netpoll in fm10k_pci.c since it is 
technically an interrupt handler.  Then you can avoid issues down the 
road for having to convert fm10k_msix_clean_rings to a non-static 
function that is only used when CONFIG_NET_POLL_CONTROLLER is defined.
2.  It should be wrapped in CONFIG_NET_POLL_CONTROLLER along with the 
inititalization in the fm10k_netdev_ops structure.

- Alex
Singh, Krishneil K April 14, 2015, 7:44 p.m. UTC | #3
-----Original Message-----
From: Kirsher, Jeffrey T 
Sent: Friday, April 3, 2015 2:02 PM
To: intel-wired-lan@lists.osuosl.org
Cc: Kwan, Ngai-mint; Singh, Krishneil K
Subject: Re: [net-next 05/25] fm10k: Add netconsole support

On Fri, 2015-04-03 at 13:26 -0700, Jeff Kirsher wrote:
> This change adds a function called "fm10k_netpoll" that's used to 
> define "ndo_poll_controller" in "fm10k_netdev_ops". This is required 
> to enable support for "netconsole" in fm10k.
> 
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Signed-off-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com>
> Acked-by: Matthew Vick <matthew.vick@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k.h        |  1 +
>  drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 21
> +++++++++++++++++++++
>  drivers/net/ethernet/intel/fm10k/fm10k_pci.c    |  2 +-
>  3 files changed, 23 insertions(+), 1 deletion(-)

I have applied to my queue.
--
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git
dev-queue

Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>

Patch
diff mbox

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 65e7001..715d0a0 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -457,6 +457,7 @@  void fm10k_down(struct fm10k_intfc *interface);
 void fm10k_update_stats(struct fm10k_intfc *interface);
 void fm10k_service_event_schedule(struct fm10k_intfc *interface);
 void fm10k_update_rx_drop_en(struct fm10k_intfc *interface);
+irqreturn_t fm10k_msix_clean_rings(int irq, void *data);
 
 /* Netdev */
 struct net_device *fm10k_alloc_netdev(void);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index a7db5e2..2a61b83 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1350,6 +1350,26 @@  static void fm10k_dfwd_del_station(struct net_device *dev, void *priv)
 	}
 }
 
+/**
+ * fm10k_netpoll - A Polling 'interrupt' handler
+ * @netdev: network interface device structure
+ *
+ * This is used by netconsole to send skbs without having to re-enable
+ * interrupts. It's not called while the normal interrupt routine is executing.
+ **/
+static void fm10k_netpoll(struct net_device *netdev)
+{
+	struct fm10k_intfc *interface = netdev_priv(netdev);
+	int i;
+
+	/* if interface is down do nothing */
+	if (test_bit(__FM10K_DOWN, &interface->state))
+		return;
+
+	for (i = 0; i < interface->num_q_vectors; i++)
+		fm10k_msix_clean_rings(0, interface->q_vector[i]);
+}
+
 static netdev_features_t fm10k_features_check(struct sk_buff *skb,
 					      struct net_device *dev,
 					      netdev_features_t features)
@@ -1382,6 +1402,7 @@  static const struct net_device_ops fm10k_netdev_ops = {
 	.ndo_do_ioctl		= fm10k_ioctl,
 	.ndo_dfwd_add_station	= fm10k_dfwd_add_station,
 	.ndo_dfwd_del_station	= fm10k_dfwd_del_station,
+	.ndo_poll_controller	= fm10k_netpoll,
 	.ndo_features_check	= fm10k_features_check,
 };
 
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 6fc9965..c11e2c9 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -807,7 +807,7 @@  static void fm10k_napi_enable_all(struct fm10k_intfc *interface)
 	}
 }
 
-static irqreturn_t fm10k_msix_clean_rings(int irq, void *data)
+irqreturn_t fm10k_msix_clean_rings(int irq, void *data)
 {
 	struct fm10k_q_vector *q_vector = data;