Re: [PATCH net-next 2/2] liquidio: Add support to create management interface

2017-07-31 Thread Felix Manlunas
On Tue, Jul 18, 2017 at 11:58:27AM -0700, Jakub Kicinski wrote:
> On Mon, 17 Jul 2017 12:52:17 -0700, Felix Manlunas wrote:
> > From: VSR Burru 
> > 
> > This patch adds support to create a virtual ethernet interface to
> > communicate with Linux on LiquidIO adapter for management.
> > 
> > Signed-off-by: VSR Burru 
> > Signed-off-by: Srinivasa Jampala 
> > Signed-off-by: Satanand Burla 
> > Signed-off-by: Raghu Vatsavayi 
> > Signed-off-by: Felix Manlunas 
> 
> Not my call, but I have mixed feelings about this one.  Is there any
> precedent under drivers/net/ethernet of exposing special communication
> channels with FW like this?  It's irrelevant to me that you're running
> SSH, arbitrary communication with FW from userspace is not something
> netdev community usually accepts.  And I'm afraid what the effects will
> be of this getting accepted.  I'm pretty sure most modern network
> adapters have management CPU cores perfectly capable of running Linux.
> I know NFP does, here is the out-of-tree code equivalent to this patch:

LiquidIO is committed to ethtool and we are not trying to force users to
use this communication channel in place of ethtool. This communication
channel is for our field debug and informattion purposes and not for end
users. If most modern network adapters have management cores that can
run Linux, we could probably also think of finding a standard way to
talk to that Linux.

> 
> https://github.com/Netronome/nfp-drv-kmods/blob/master/src/nfpcore/nfp_net_vnic.c
> 
> I'm not looking forward to a world where I have to ssh into my NIC and
> run vendor commands to configure things.

We are not asking users to ssh into card and run vendor commands. Users
of LiquidIO card will continue to use ethtool for configuration. This is
for our field debugging where we would like to login to the linux and be
able to know the status of different hardware blocks in the card.


Re: [PATCH net-next 2/2] liquidio: Add support to create management interface

2017-07-18 Thread Jakub Kicinski
On Mon, 17 Jul 2017 12:52:17 -0700, Felix Manlunas wrote:
> From: VSR Burru 
> 
> This patch adds support to create a virtual ethernet interface to
> communicate with Linux on LiquidIO adapter for management.
> 
> Signed-off-by: VSR Burru 
> Signed-off-by: Srinivasa Jampala 
> Signed-off-by: Satanand Burla 
> Signed-off-by: Raghu Vatsavayi 
> Signed-off-by: Felix Manlunas 

Not my call, but I have mixed feelings about this one.  Is there any
precedent under drivers/net/ethernet of exposing special communication
channels with FW like this?  It's irrelevant to me that you're running
SSH, arbitrary communication with FW from userspace is not something
netdev community usually accepts.  And I'm afraid what the effects will
be of this getting accepted.  I'm pretty sure most modern network
adapters have management CPU cores perfectly capable of running Linux.
I know NFP does, here is the out-of-tree code equivalent to this patch:

https://github.com/Netronome/nfp-drv-kmods/blob/master/src/nfpcore/nfp_net_vnic.c

I'm not looking forward to a world where I have to ssh into my NIC and
run vendor commands to configure things.


Re: [PATCH net-next 2/2] liquidio: Add support to create management interface

2017-07-18 Thread Leon Romanovsky
On Mon, Jul 17, 2017 at 12:52:17PM -0700, Felix Manlunas wrote:
> From: VSR Burru 
>
> This patch adds support to create a virtual ethernet interface to
> communicate with Linux on LiquidIO adapter for management.
>
> Signed-off-by: VSR Burru 
> Signed-off-by: Srinivasa Jampala 
> Signed-off-by: Satanand Burla 
> Signed-off-by: Raghu Vatsavayi 
> Signed-off-by: Felix Manlunas 
> ---
>  drivers/net/ethernet/cavium/liquidio/Makefile  |   1 +
>  drivers/net/ethernet/cavium/liquidio/lio_main.c|   6 +
>  .../net/ethernet/cavium/liquidio/liquidio_common.h |   4 +
>  .../net/ethernet/cavium/liquidio/liquidio_mgmt.c   | 397 
> +
>  .../net/ethernet/cavium/liquidio/octeon_device.h   |   2 +
>  drivers/net/ethernet/cavium/liquidio/octeon_main.h |   9 +
>  6 files changed, 419 insertions(+)
>  create mode 100644 drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/Makefile 
> b/drivers/net/ethernet/cavium/liquidio/Makefile
> index c4d411d..2064157 100644
> --- a/drivers/net/ethernet/cavium/liquidio/Makefile
> +++ b/drivers/net/ethernet/cavium/liquidio/Makefile
> @@ -15,6 +15,7 @@ liquidio-$(CONFIG_LIQUIDIO) += lio_ethtool.o \
>   octeon_mailbox.o   \
>   octeon_mem_ops.o   \
>   octeon_droq.o  \
> + liquidio_mgmt.o  \
>   octeon_nic.o
>
>  liquidio-objs := lio_main.o octeon_console.o $(liquidio-y)
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c 
> b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> index 1508b18..844d7aa 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> @@ -1776,6 +1776,9 @@ static void liquidio_remove(struct pci_dev *pdev)
>
>   dev_dbg(_dev->pci_dev->dev, "Stopping device\n");
>
> + if (oct_dev->fw_info.app_cap_flags & LIQUIDIO_MGMT_INTF_CAP)
> + lio_mgmt_exit(oct_dev);
> +
>   if (oct_dev->watchdog_task)
>   kthread_stop(oct_dev->watchdog_task);
>
> @@ -4408,6 +4411,9 @@ static int liquidio_init_nic_module(struct 
> octeon_device *oct)
>   goto octnet_init_failure;
>   }
>
> + if (oct->fw_info.app_cap_flags & LIQUIDIO_MGMT_INTF_CAP)
> + lio_mgmt_init(oct);
> +
>   liquidio_ptp_init(oct);
>
>   dev_dbg(>pci_dev->dev, "Network interfaces ready\n");
> diff --git a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h 
> b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
> index fc59eda..a479383 100644
> --- a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
> +++ b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
> @@ -63,6 +63,8 @@ enum octeon_tag_type {
>   */
>  #define OPCODE_CORE 0   /* used for generic core operations */
>  #define OPCODE_NIC  1   /* used for NIC operations */
> +#define OPCODE_MGMT 2   /* used for MGMT operations */
> +
>  /* Subcodes are used by host driver/apps to identify the sub-operation
>   * for the core. They only need to by unique for a given subsystem.
>   */
> @@ -106,6 +108,8 @@ enum octeon_tag_type {
>  #define MAX_IOQ_INTERRUPTS_PER_PF   (64 * 2)
>  #define MAX_IOQ_INTERRUPTS_PER_VF   (8 * 2)
>
> +/* App specific capabilities from firmware to pf driver */
> +#define LIQUIDIO_MGMT_INTF_CAP 0x1
>
>  static inline u32 incr_index(u32 index, u32 count, u32 max)
>  {
> diff --git a/drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c 
> b/drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
> new file mode 100644
> index 000..b471c21
> --- /dev/null
> +++ b/drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
> @@ -0,0 +1,397 @@
> +/**
> + * Author: Cavium, Inc.
> + *
> + * Contact: supp...@cavium.com
> + *  Please include "LiquidIO" in the subject.
> + *

Does anyone actually follow it? :)

> + * Copyright (c) 2003-2017 Cavium, Inc.
> + *
> + * This file is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, Version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This file is distributed in the hope that it will be useful, but
> + * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
> + * NONINFRINGEMENT.  See the GNU General Public License for more details.
> + ***/
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

[PATCH net-next 2/2] liquidio: Add support to create management interface

2017-07-17 Thread Felix Manlunas
From: VSR Burru 

This patch adds support to create a virtual ethernet interface to
communicate with Linux on LiquidIO adapter for management.

Signed-off-by: VSR Burru 
Signed-off-by: Srinivasa Jampala 
Signed-off-by: Satanand Burla 
Signed-off-by: Raghu Vatsavayi 
Signed-off-by: Felix Manlunas 
---
 drivers/net/ethernet/cavium/liquidio/Makefile  |   1 +
 drivers/net/ethernet/cavium/liquidio/lio_main.c|   6 +
 .../net/ethernet/cavium/liquidio/liquidio_common.h |   4 +
 .../net/ethernet/cavium/liquidio/liquidio_mgmt.c   | 397 +
 .../net/ethernet/cavium/liquidio/octeon_device.h   |   2 +
 drivers/net/ethernet/cavium/liquidio/octeon_main.h |   9 +
 6 files changed, 419 insertions(+)
 create mode 100644 drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c

diff --git a/drivers/net/ethernet/cavium/liquidio/Makefile 
b/drivers/net/ethernet/cavium/liquidio/Makefile
index c4d411d..2064157 100644
--- a/drivers/net/ethernet/cavium/liquidio/Makefile
+++ b/drivers/net/ethernet/cavium/liquidio/Makefile
@@ -15,6 +15,7 @@ liquidio-$(CONFIG_LIQUIDIO) += lio_ethtool.o \
octeon_mailbox.o   \
octeon_mem_ops.o   \
octeon_droq.o  \
+   liquidio_mgmt.o  \
octeon_nic.o
 
 liquidio-objs := lio_main.o octeon_console.o $(liquidio-y)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c 
b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 1508b18..844d7aa 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -1776,6 +1776,9 @@ static void liquidio_remove(struct pci_dev *pdev)
 
dev_dbg(_dev->pci_dev->dev, "Stopping device\n");
 
+   if (oct_dev->fw_info.app_cap_flags & LIQUIDIO_MGMT_INTF_CAP)
+   lio_mgmt_exit(oct_dev);
+
if (oct_dev->watchdog_task)
kthread_stop(oct_dev->watchdog_task);
 
@@ -4408,6 +4411,9 @@ static int liquidio_init_nic_module(struct octeon_device 
*oct)
goto octnet_init_failure;
}
 
+   if (oct->fw_info.app_cap_flags & LIQUIDIO_MGMT_INTF_CAP)
+   lio_mgmt_init(oct);
+
liquidio_ptp_init(oct);
 
dev_dbg(>pci_dev->dev, "Network interfaces ready\n");
diff --git a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h 
b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
index fc59eda..a479383 100644
--- a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
+++ b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
@@ -63,6 +63,8 @@ enum octeon_tag_type {
  */
 #define OPCODE_CORE 0   /* used for generic core operations */
 #define OPCODE_NIC  1   /* used for NIC operations */
+#define OPCODE_MGMT 2   /* used for MGMT operations */
+
 /* Subcodes are used by host driver/apps to identify the sub-operation
  * for the core. They only need to by unique for a given subsystem.
  */
@@ -106,6 +108,8 @@ enum octeon_tag_type {
 #define MAX_IOQ_INTERRUPTS_PER_PF   (64 * 2)
 #define MAX_IOQ_INTERRUPTS_PER_VF   (8 * 2)
 
+/* App specific capabilities from firmware to pf driver */
+#define LIQUIDIO_MGMT_INTF_CAP 0x1
 
 static inline u32 incr_index(u32 index, u32 count, u32 max)
 {
diff --git a/drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c 
b/drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
new file mode 100644
index 000..b471c21
--- /dev/null
+++ b/drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
@@ -0,0 +1,397 @@
+/**
+ * Author: Cavium, Inc.
+ *
+ * Contact: supp...@cavium.com
+ *  Please include "LiquidIO" in the subject.
+ *
+ * Copyright (c) 2003-2017 Cavium, Inc.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
+ * NONINFRINGEMENT.  See the GNU General Public License for more details.
+ ***/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "octeon_config.h"
+#include "liquidio_common.h"
+#include "octeon_droq.h"
+#include "octeon_iq.h"
+#include "response_manager.h"
+#include "octeon_device.h"
+#include "octeon_nic.h"
+#include "octeon_main.h"
+#include "octeon_network.h"
+
+#define OPCODE_MGMT_PKT_DATA   0x10
+
+struct lio_mgmt {
+