liquidio: Add support for managing liquidio adapter
Subsystems (3)
v2 cover liquidio: Add support for managing liquidio adapter
From: Veerasenareddy Burru <[email protected]>
The LiquidIO adapter has processor cores that can run Linux. This patch set adds support to create a virtual Ethernet interface on host to communicate with applications running on Linux in the LiquidIO adapter. The virtual Ethernet interface also provides login access to Linux on LiquidIO through ssh for management and debugging.
Change Log:
V1 -> V2
Only patch #2 was changed:
* Removed inline functions in .c files
* Removed useless, almost-empty functions
* Revised if-statement under "/* Check for all conditions ..."
* Replaced "if (skb_shinfo(skb)->nr_frags == 0)" with
"if (!skb_shinfo(skb)->nr_frags)"
Veerasenareddy Burru (2):
liquidio: Add support to pass meta information to firmware
liquidio: Add support to create management interface
drivers/net/ethernet/cavium/liquidio/Makefile | 1 + drivers/net/ethernet/cavium/liquidio/lio_main.c | 17 +- .../net/ethernet/cavium/liquidio/liquidio_common.h | 21 ++ .../net/ethernet/cavium/liquidio/liquidio_mgmt.c | 351 +++++++++++++++++++++ .../net/ethernet/cavium/liquidio/octeon_console.c | 28 +- .../net/ethernet/cavium/liquidio/octeon_device.h | 2 + drivers/net/ethernet/cavium/liquidio/octeon_main.h | 8 + 7 files changed, 423 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
Signature · 1 line
1.8.3.1
PATCH v2 1/2 liquidio: Add support to pass meta information to firmware
From: Veerasenareddy Burru <[email protected]>
The LiquidIO adapter has processor cores that can run Linux. This patch adds the support for passing meta information to LiquidIO linux cores.
--- drivers/net/ethernet/cavium/liquidio/lio_main.c | 11 ++++++++- .../net/ethernet/cavium/liquidio/liquidio_common.h | 17 +++++++++++++ .../net/ethernet/cavium/liquidio/octeon_console.c | 28 ++++++++++++++++++---- 3 files changed, 51 insertions(+), 5 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_main.c +10 -1
@@ -3949,6 +3949,8 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)u32 resp_size, ctx_size, data_size;u32 ifidx_or_pfnum;struct lio_version *vdata; +union oct_nic_vf_info vf_info; +/* This is to handle link status changes */ octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC,
@@ -4017,9 +4019,16 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) sc->iq_no =0 ; +/* Populate VF info for firmware */ + vf_info.info =0 ; + + vf_info.s.bus_num = octeon_dev->pci_dev->bus->number; + vf_info.s.dev_fn = octeon_dev->pci_dev->devfn; + vf_info.s.max_vfs = octeon_dev->sriov_info.max_vfs; +octeon_prepare_soft_command (octeon_dev, sc,OPCODE_NIC ,OPCODE_NIC_IF_CFG ,0 , - if_cfg.u64,0 ); + if_cfg.u64, vf_info.info); sc->callback = if_cfg_callback; sc->callback_arg = sc;
drivers/net/ethernet/cavium/liquidio/liquidio_common.h +17 -0
@@ -895,4 +895,21 @@ struct oct_intrmod_cfg { } s; }; +union oct_nic_vf_info { +u64 info; +struct { +#ifdef __BIG_ENDIAN_BITFIELD +u64 max_vfs:32 ; +u64 bus_num:8 ; +u64 dev_fn:8 ; +u64 reserved:16 ; +#else +u64 reserved:16 ; +u64 dev_fn:8 ; +u64 bus_num:8 ; +u64 max_vfs:32 ; +#endif + } s; +}; +#endif
drivers/net/ethernet/cavium/liquidio/octeon_console.c +24 -4
@@ -724,15 +724,19 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num, }#define FBUF_SIZE (4 * 1024 * 1024) +#define MAX_DATE_SIZE 30int octeon_download_firmware (struct octeon_device *oct,const u8 *data,size_t size) { -int ret =0 ; +struct octeon_firmware_file_header *h; +char date[MAX_DATE_SIZE ]; +struct timeval time;u32 crc32_result; +struct tm tm_val;u64 load_addr;u32 image_len; -struct octeon_firmware_file_header *h; +int ret =0 ;u32 i, rem;if (size <sizeof (struct octeon_firmware_file_header )) {
@@ -814,8 +818,24 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,dev_info (&oct->pci_dev->dev,"Writing boot command: %s\n" , h->bootcmd); -/* Invoke the bootcmd */ +/*Get time of the day*/ +do_gettimeofday (&time); +time_to_tm (time.tv_sec, (-sys_tz.tz_minuteswest) *60 , &tm_val); + ret =snprintf (date,MAX_DATE_SIZE , +" date=%04ld.%02d.%02d-%02d:%02d:%02d" , + tm_val.tm_year +1900 , tm_val.tm_mon +1 , tm_val.tm_mday, + tm_val.tm_hour, tm_val.tm_min, tm_val.tm_sec); +if ((sizeof (h->bootcmd) -strnlen (h->bootcmd,sizeof (h->bootcmd))) < + ret) { +dev_err (&oct->pci_dev->dev,"Boot command buffer too small\n" ); +return -EINVAL ; + } +strncat (h->bootcmd, date, +sizeof (h->bootcmd) -strnlen (h->bootcmd,sizeof (h->bootcmd))); + ret =octeon_console_send_cmd (oct, h->bootcmd,50 ); +if (ret) +dev_info (&oct->pci_dev->dev,"Boot command send failed\n" ); -return 0 ; +return ret; }
Signature · 1 line
1.8.3.1
PATCH v2 2/2 liquidio: Add support to create management interface
In reply to Felix ManlunasFrom: Veerasenareddy Burru <[email protected]>
This patch adds support to create a virtual ethernet interface to communicate with Linux on LiquidIO adapter for management.
--- 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 | 351 +++++++++++++++++++++ .../net/ethernet/cavium/liquidio/octeon_device.h | 2 + drivers/net/ethernet/cavium/liquidio/octeon_main.h | 8 + 6 files changed, 372 insertions(+) create mode 100644 drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c
drivers/net/ethernet/cavium/liquidio/Makefile +1 -0
@@ -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)
drivers/net/ethernet/cavium/liquidio/lio_main.c +6 -0
@@ -1776,6 +1776,9 @@ static void liquidio_remove(struct pci_dev *pdev)dev_dbg (&oct_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 (&oct->pci_dev->dev,"Network interfaces ready\n" );
drivers/net/ethernet/cavium/liquidio/liquidio_common.h +4 -0
@@ -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 0x1static inline u32 incr_index (u32 index,u32 count,u32 max) {
drivers/net/ethernet/cavium/liquidio/liquidio_mgmt.c new file +351 -0
351 lines not on this page · raw message
drivers/net/ethernet/cavium/liquidio/octeon_device.h +2 -0
@@ -554,6 +554,8 @@ struct octeon_device { } loc;atomic_t *adapter_refcount;/* reference count of adapter */ + +void *mgmt_ctx;/* pointer to management context */ };#define OCT_DRV_ONLINE 1
drivers/net/ethernet/cavium/liquidio/octeon_main.h +8 -0
@@ -198,4 +198,12 @@ static inline int octeon_map_pci_barx(struct octeon_device *oct,#define ROUNDUP128 (val) (((val) + 127) & 0xffffff80)#endif +/* Initializes the LiquidIO management interface module +* @param octdev - octeon device pointer +* @returns 0 if init is success, -1 otherwise +*/ +int lio_mgmt_init (struct octeon_device *octdev); + +/* De-initializes the LiquidIO management interface module */ +void lio_mgmt_exit (struct octeon_device *octdev);#endif /* _OCTEON_MAIN_H_ */
Signature · 1 line
1.8.3.1
Quoted 7 lines · Felix Manlunas
From: Veerasenareddy Burru <[email protected]>
The LiquidIO adapter has processor cores that can run Linux. This patch set adds support to create a virtual Ethernet interface on host to communicate with applications running on Linux in the LiquidIO adapter. The virtual Ethernet interface also provides login access to Linux on LiquidIO through ssh for management and debugging.
As per the somewhat more detailed feedback provided by my colleague Jakub Kicinski to v1 of this patchset[1] I am concerned that this patchset breaks down the long standing practice of not granting direct access to firmware from userspace.
David Miller
maintainerFrom: Simon Horman <[email protected]>
Date: Sun, 30 Jul 2017 22:21:04 +0200
Quoted 9 lines · Felix Manlunas
Quoted 7 lines
From: Veerasenareddy Burru <[email protected]>
The LiquidIO adapter has processor cores that can run Linux. This patch set adds support to create a virtual Ethernet interface on host to communicate with applications running on Linux in the LiquidIO adapter. The virtual Ethernet interface also provides login access to Linux on LiquidIO through ssh for management and debugging.
Quoted 6 lines
As per the somewhat more detailed feedback provided by my colleague Jakub Kicinski to v1 of this patchset[1] I am concerned that this patchset breaks down the long standing practice of not granting direct access to firmware from userspace.
Agreed, I've seen no attempt to address this important feedback, which I agree with.
Quoted 17 lines · David Miller
From: Simon Horman <[email protected]>
Date: Sun, 30 Jul 2017 22:21:04 +0200Quoted 14 lines · Felix Manlunas
Quoted 7 lines
From: Veerasenareddy Burru <[email protected]>
The LiquidIO adapter has processor cores that can run Linux. This patch set adds support to create a virtual Ethernet interface on host to communicate with applications running on Linux in the LiquidIO adapter. The virtual Ethernet interface also provides login access to Linux on LiquidIO through ssh for management and debugging.
As per the somewhat more detailed feedback provided by my colleague Jakub Kicinski to v1 of this patchset[1] I am concerned that this patchset breaks down the long standing practice of not granting direct access to firmware from userspace.
Quoted 4 lines
Quoted 1 line
Agreed, I've seen no attempt to address this important feedback, which I agree with.
We posted a response to the original comment on Friday 28-July. but for some reason, it did not make to the mailing list outside cavium domain. our apologies, we did not double check before submitting V2 patch. Please find below the response reposted on original thread