add PF-VF mailbox support
Subsystems (3)
v3 cover add PF-VF mailbox support
This patchset aims to add PF-VF mailbox support, its related version support, and relevant control net support for immediate functionalities such as firmware notifications to VF.
Changes:
V3:
- Corrected error cleanup logic for PF-VF mbox setup
- Removed double inclusion of types.h header file in octep_pfvf_mbox.c
V2: https://lore.kernel.org/all/[email protected]/
- Removed unused variable in PATCH 1/4
V1: https://lore.kernel.org/all/[email protected]/
Shinas Rasheed (4):
octeon_ep: add PF-VF mailbox communication
octeon_ep: PF-VF mailbox version support
octeon_ep: control net framework to support VF offloads
octeon_ep: support firmware notifications for VFs
.../net/ethernet/marvell/octeon_ep/Makefile | 2 +- .../marvell/octeon_ep/octep_cn9k_pf.c | 59 ++- .../marvell/octeon_ep/octep_cnxk_pf.c | 49 +- .../marvell/octeon_ep/octep_ctrl_mbox.h | 4 +- .../marvell/octeon_ep/octep_ctrl_net.c | 6 + .../ethernet/marvell/octeon_ep/octep_main.c | 84 +++- .../ethernet/marvell/octeon_ep/octep_main.h | 46 +- .../marvell/octeon_ep/octep_pfvf_mbox.c | 450 ++++++++++++++++++ .../marvell/octeon_ep/octep_pfvf_mbox.h | 167 +++++++ .../marvell/octeon_ep/octep_regs_cn9k_pf.h | 9 + .../marvell/octeon_ep/octep_regs_cnxk_pf.h | 13 + .../net/ethernet/marvell/octeon_ep/octep_tx.h | 24 +- 12 files changed, 864 insertions(+), 49 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h
Signature · 1 line
2.25.1
PATCH v3 1/1 octeon_ep: add PF-VF mailbox communication
Implement mailbox communication between PF and VFs. PF-VF mailbox is used for all control commands from VF to PF and asynchronous notification messages from PF to VF.
---
V3:
- Corrected error cleanup logic for PF-VF mbox setup
- Removed double inclusion of types.h header file in octep_pfvf_mbox.c
V2: https://lore.kernel.org/all/[email protected]/
- Remove unused variable
V1: https://lore.kernel.org/all/[email protected]/
.../net/ethernet/marvell/octeon_ep/Makefile | 2 +- .../marvell/octeon_ep/octep_cn9k_pf.c | 59 ++- .../marvell/octeon_ep/octep_cnxk_pf.c | 46 ++- .../marvell/octeon_ep/octep_ctrl_mbox.h | 4 +- .../ethernet/marvell/octeon_ep/octep_main.c | 83 ++++- .../ethernet/marvell/octeon_ep/octep_main.h | 45 ++- .../marvell/octeon_ep/octep_pfvf_mbox.c | 335 ++++++++++++++++++ .../marvell/octeon_ep/octep_pfvf_mbox.h | 143 ++++++++ .../marvell/octeon_ep/octep_regs_cn9k_pf.h | 9 + .../marvell/octeon_ep/octep_regs_cnxk_pf.h | 13 + .../net/ethernet/marvell/octeon_ep/octep_tx.h | 24 +- 11 files changed, 714 insertions(+), 49 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c create mode 100644 drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h
drivers/net/ethernet/marvell/octeon_ep/Makefile +1 -1
@@ -7,4 +7,4 @@ obj-$(CONFIG_OCTEON_EP) += octeon_ep.o octeon_ep-y := octep_main.o octep_cn9k_pf.o octep_tx.o octep_rx.o \ octep_ethtool.o octep_ctrl_mbox.o octep_ctrl_net.o \ - octep_cnxk_pf.o + octep_pfvf_mbox.o octep_cnxk_pf.o
drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c +52 -7
92 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c +39 -7
79 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_mbox.h +3 -1
@@ -16,10 +16,12 @@* |reserved (4 bytes) | * |-------------------------------------------| * |host version (8 bytes) | +* | low 32 bits | * |host status (8 bytes) | * |host reserved (104 bytes) | * |-------------------------------------------| -* |fw version (8 bytes) | +* |fw version's (8 bytes) | +* | min=high 32 bits, max=low 32 bits | * |fw status (8 bytes) | * |fw reserved (104 bytes) | * |===========================================|
drivers/net/ethernet/marvell/octeon_ep/octep_main.c +81 -2
136 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_main.h +26 -19
72 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c new file +335 -0
335 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h new file +143 -0
143 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h +9 -0
@@ -208,6 +208,9 @@#define CN93_SDP_R_MBOX_PF_VF_INT_START 0x10220#define CN93_SDP_R_MBOX_VF_PF_DATA_START 0x10230 +#define CN93_SDP_MBOX_VF_PF_DATA_START 0x24000 +#define CN93_SDP_MBOX_PF_VF_DATA_START 0x22000 +#define CN93_SDP_R_MBOX_PF_VF_DATA (ring) \ (CN93_SDP_R_MBOX_PF_VF_DATA_START + ((ring) * CN93_RING_OFFSET))
@@ -217,6 +220,12 @@#define CN93_SDP_R_MBOX_VF_PF_DATA (ring) \ (CN93_SDP_R_MBOX_VF_PF_DATA_START + ((ring) * CN93_RING_OFFSET)) +#define CN93_SDP_MBOX_VF_PF_DATA (ring) \ + (CN93_SDP_MBOX_VF_PF_DATA_START + ((ring) * CN93_EPVF_RING_OFFSET)) + +#define CN93_SDP_MBOX_PF_VF_DATA (ring) \ + (CN93_SDP_MBOX_PF_VF_DATA_START + ((ring) * CN93_EPVF_RING_OFFSET)) +/* ##################### Interrupt Registers ########################## */ #define CN93_SDP_R_ERR_TYPE_START 0x10400
drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h +13 -0
@@ -183,6 +183,7 @@#define CNXK_SDP_R_OUT_INT_MDRT_CTL1_START 0x103A0#define CNXK_SDP_R_OUT_INT_MDRT_DBG_START 0x103C0 +#define CNXK_SDP_R_MBOX_ISM_START 0x10500#define CNXK_SDP_R_OUT_CNTS_ISM_START 0x10510#define CNXK_SDP_R_IN_CNTS_ISM_START 0x10520
@@ -204,6 +205,9 @@#define CNXK_SDP_R_OUT_INT_MDRT_DBG (ring) \ (CNXK_SDP_R_OUT_INT_MDRT_DBG_START + ((ring) * CNXK_RING_OFFSET)) +#define CNXK_SDP_R_MBOX_ISM (ring) \ + (CNXK_SDP_R_MBOX_ISM_START + ((ring) * CNXK_RING_OFFSET)) +#define CNXK_SDP_R_OUT_CNTS_ISM (ring) \ (CNXK_SDP_R_OUT_CNTS_ISM_START + ((ring) * CNXK_RING_OFFSET))
@@ -222,6 +226,9 @@#define CNXK_SDP_R_MBOX_PF_VF_INT_START 0x10220#define CNXK_SDP_R_MBOX_VF_PF_DATA_START 0x10230 +#define CNXK_SDP_MBOX_VF_PF_DATA_START 0x24000 +#define CNXK_SDP_MBOX_PF_VF_DATA_START 0x22000 +#define CNXK_SDP_R_MBOX_PF_VF_DATA (ring) \ (CNXK_SDP_R_MBOX_PF_VF_DATA_START + ((ring) * CNXK_RING_OFFSET))
@@ -231,6 +238,12 @@#define CNXK_SDP_R_MBOX_VF_PF_DATA (ring) \ (CNXK_SDP_R_MBOX_VF_PF_DATA_START + ((ring) * CNXK_RING_OFFSET)) +#define CNXK_SDP_MBOX_VF_PF_DATA (ring) \ + (CNXK_SDP_MBOX_VF_PF_DATA_START + ((ring) * CNXK_EPVF_RING_OFFSET)) + +#define CNXK_SDP_MBOX_PF_VF_DATA (ring) \ + (CNXK_SDP_MBOX_PF_VF_DATA_START + ((ring) * CNXK_EPVF_RING_OFFSET)) +/* ##################### Interrupt Registers ########################## */ #define CNXK_SDP_R_ERR_TYPE_START 0x10400
drivers/net/ethernet/marvell/octeon_ep/octep_tx.h +12 -12
@@ -61,6 +61,18 @@ struct octep_tx_buffer {/* Hardware interface Tx statistics */ struct octep_iface_tx_stats { +/* Total frames sent on the interface */ +u64 pkts; + +/* Total octets sent on the interface */ +u64 octs; + +/* Packets sent to a broadcast DMAC */ +u64 bcst; + +/* Packets sent to the multicast DMAC */ +u64 mcst; +/* Packets dropped due to excessive collisions */ u64 xscol;
@@ -77,12 +89,6 @@ struct octep_iface_tx_stats {*/ u64 scol; -/* Total octets sent on the interface */ -u64 octs; - -/* Total frames sent on the interface */ -u64 pkts; -/* Packets sent with an octet count < 64 */ u64 hist_lt64;
@@ -107,12 +113,6 @@ struct octep_iface_tx_stats {/* Packets sent with an octet count of > 1518 */ u64 hist_gt1518; -/* Packets sent to a broadcast DMAC */ -u64 bcst; - -/* Packets sent to the multicast DMAC */ -u64 mcst; -/* Packets sent that experienced a transmit underflow and were * truncated */
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerRe: [PATCH net-next v3] octeon_ep: add PF-VF mailbox communication
Quoted 3 lines · On Sun, 10 Dec 2023 22:33:52 -0800 Shinas Rasheed wrote:
Implement mailbox communication between PF and VFs. PF-VF mailbox is used for all control commands from VF to PF and asynchronous notification messages from PF to VF.
This patch was not designated as 1/4 in the subject so patchwork thought it's a separate posting, and the series lacks patch 1/4. You gotta repost so that patchwork can ingest this properly.
Signature · 1 line
pw-bot: cr
PATCH v3 2/4 octeon_ep: PF-VF mailbox version support
In reply to Shinas RasheedAdd PF-VF mailbox initial version support
---
V3:
- No changes
V2: https://lore.kernel.org/all/[email protected]/
- No changes
V1: https://lore.kernel.org/all/[email protected]/
.../net/ethernet/marvell/octeon_ep/octep_main.h | 1 + .../ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 15 ++++++++++++--- .../ethernet/marvell/octeon_ep/octep_pfvf_mbox.h | 7 +++++-- 3 files changed, 18 insertions(+), 5 deletions(-)
drivers/net/ethernet/marvell/octeon_ep/octep_main.h +1 -0
@@ -220,6 +220,7 @@ struct octep_iface_link_info {/* The Octeon VF device specific info data structure.*/ struct octep_pfvf_info {u8 mac_addr[ETH_ALEN ]; +u32 mbox_version; };/* The Octeon device specific private data structure.
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +12 -3
@@ -28,10 +28,18 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id, {u32 vf_version = (u32 )cmd.s_version.version; -if (vf_version <=OCTEP_PFVF_MBOX_VERSION_V1 ) - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; +dev_dbg (&oct->pdev->dev,"VF id:%d VF version:%d PF version:%d\n" , + vf_id, vf_version,OCTEP_PFVF_MBOX_VERSION_CURRENT ); +if (vf_version <OCTEP_PFVF_MBOX_VERSION_CURRENT ) + rsp->s_version.version = vf_version;else - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ; + rsp->s_version.version =OCTEP_PFVF_MBOX_VERSION_CURRENT ; + + oct->vf_info[vf_id].mbox_version = rsp->s_version.version; +dev_dbg (&oct->pdev->dev,"VF id:%d negotiated VF version:%d\n" , + vf_id, oct->vf_info[vf_id].mbox_version); + + rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; } static void octep_pfvf_get_link_status(struct octep_device *oct, u32 vf_id,
@@ -167,6 +175,7 @@ int octep_setup_pfvf_mbox(struct octep_device *oct) goto free_mbox;memset (oct->mbox[ring],0 ,sizeof (struct octep_mbox )); +memset (&oct->vf_info[i],0 ,sizeof (struct octep_pfvf_info ));mutex_init (&oct->mbox[ring]->lock);INIT_WORK (&oct->mbox[ring]->wk.work, octep_pfvf_mbox_work); oct->mbox[ring]->wk.ctxptr = oct->mbox[ring];
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h +5 -2
@@ -13,11 +13,15 @@#define OCTEON_SDP_16K_HW_FRS 16380UL#define OCTEON_SDP_64K_HW_FRS 65531UL +/* When a new command is implemented,PF Mbox version should be bumped. +*/ enum octep_pfvf_mbox_version {OCTEP_PFVF_MBOX_VERSION_V0 ,OCTEP_PFVF_MBOX_VERSION_V1 , }; +#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V1 +enum octep_pfvf_mbox_opcode {OCTEP_PFVF_MBOX_CMD_VERSION ,OCTEP_PFVF_MBOX_CMD_SET_MTU ,
@@ -30,7 +34,7 @@ enum octep_pfvf_mbox_opcode {OCTEP_PFVF_MBOX_CMD_GET_LINK_STATUS ,OCTEP_PFVF_MBOX_CMD_GET_MTU ,OCTEP_PFVF_MBOX_CMD_DEV_REMOVE , - OCTEP_PFVF_MBOX_CMD_LAST, + OCTEP_PFVF_MBOX_CMD_MAX, }; enum octep_pfvf_mbox_word_type {
@@ -79,7 +83,6 @@ enum octep_pfvf_link_autoneg {#define OCTEP_PFVF_MBOX_TIMEOUT_MS 500#define OCTEP_PFVF_MBOX_MAX_RETRIES 2 -#define OCTEP_PFVF_MBOX_VERSION 0#define OCTEP_PFVF_MBOX_MAX_DATA_SIZE 6#define OCTEP_PFVF_MBOX_MORE_FRAG_FLAG 1#define OCTEP_PFVF_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
Signature · 1 line
2.25.1
Re: [PATCH net-next v3 2/4] octeon_ep: PF-VF mailbox version support
Quoted 4 lines · Shinas Rasheed
Add PF-VF mailbox initial version support
Signed-off-by Shinas Rasheed <[email protected]>---
<...>
Quoted 20 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +11
-3@@ -28,10 +28,18 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id, {u32 vf_version = (u32 )cmd.s_version.version; -if (vf_version <=OCTEP_PFVF_MBOX_VERSION_V1 ) - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; +dev_dbg (&oct->pdev->dev,"VF id:%d VF version:%d PF version:%d\n" , + vf_id, vf_version,OCTEP_PFVF_MBOX_VERSION_CURRENT ); +if (vf_version <OCTEP_PFVF_MBOX_VERSION_CURRENT ) + rsp->s_version.version = vf_version;else - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ; + rsp->s_version.version =OCTEP_PFVF_MBOX_VERSION_CURRENT ; + + oct->vf_info[vf_id].mbox_version = rsp->s_version.version; +dev_dbg (&oct->pdev->dev,"VF id:%d negotiated VF version:%d\n" , + vf_id, oct->vf_info[vf_id].mbox_version); + + rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; }
<...>
Quoted 1 line
+#define
OCTEP_PFVF_MBOX_VERSION_CURRENTOCTEP_PFVF_MBOX_VERSION_V1
This architecture design is unlikely to work in the real world unless you control both PF and VF environment. Mostly PF is running some old legacy distribution while VFs run more modern OS and this check will prevent to run new driver in VF.
Thanks
RE: [EXT] Re: [PATCH net-next v3 2/4] octeon_ep: PF-VF mailbox version support
Hi Leon,
Quoted 27 lines
Review static void octep_pfvf_validate_version(struct
Quoted 1 line
(quoted diff) +0
-0@@ -28,10 +28,18 @@ static void octep_pfvf_validate_version(struct
octep_device*oct, u32vf_id,drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
Quoted 6 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +1
-2{u32 vf_version = (u32 )cmd.s_version.version; -if (vf_version <=OCTEP_PFVF_MBOX_VERSION_V1 ) - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; + dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PFversion:%d\n",
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
Quoted 6 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +4
-1+ vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT); +if (vf_version <OCTEP_PFVF_MBOX_VERSION_CURRENT ) + rsp->s_version.version = vf_version;else - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ; + rsp->s_version.version =
OCTEP_PFVF_MBOX_VERSION_CURRENT;Quoted 7 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +6
-0+ + oct->vf_info[vf_id].mbox_version = rsp->s_version.version; +dev_dbg (&oct->pdev->dev,"VF id:%d negotiated VF version:%d\n" , + vf_id, oct->vf_info[vf_id].mbox_version); + + rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; }<...>
Quoted 1 line
+#define
OCTEP_PFVF_MBOX_VERSION_CURRENT
Quoted 8 lines
OCTEP_PFVF_MBOX_VERSION_V1This architecture design is unlikely to work in the real world unless you control both PF and VF environment. Mostly PF is running some old legacy distribution while VFs run more modern OS and this check will prevent to run new driver in VF.
Thanks
Thanks for the review. This version validation only concerns regarding the control net API layer (which is used to communicate with the firmware). In the case you have described, this instead enables new VF drivers to atleast work atop legacy PF drivers (note legacy here still refers to PF drivers which support this backward compatibility), although they might not be able to use the latest control net functionalities that they have been enabled for.
In the absence of such a backward compatibility, VF drivers would issue control net requests which PF drivers wouldn't know, only leading to logs of incompatibility errors and erroneous usage.
Also again please note that this version compatibility only concerns the control net infrastructure and API (the control plane).
Re: [EXT] Re: [PATCH net-next v3 2/4] octeon_ep: PF-VF mailbox version support
Quoted 36 lines · Shinas Rasheed
Hi Leon,
Quoted 34 lines
Review static void octep_pfvf_validate_version(struct
Quoted 1 line
(quoted diff) +0
-0@@ -28,10 +28,18 @@ static void octep_pfvf_validate_version(struct
octep_device*oct, u32vf_id,drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
Quoted 6 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +1
-2{u32 vf_version = (u32 )cmd.s_version.version; -if (vf_version <=OCTEP_PFVF_MBOX_VERSION_V1 ) - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; + dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PFversion:%d\n",
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
Quoted 6 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +4
-1+ vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT); +if (vf_version <OCTEP_PFVF_MBOX_VERSION_CURRENT ) + rsp->s_version.version = vf_version;else - rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ; + rsp->s_version.version =
OCTEP_PFVF_MBOX_VERSION_CURRENT;Quoted 7 lines
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +6
-0+ + oct->vf_info[vf_id].mbox_version = rsp->s_version.version; +dev_dbg (&oct->pdev->dev,"VF id:%d negotiated VF version:%d\n" , + vf_id, oct->vf_info[vf_id].mbox_version); + + rsp->s_version.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; }<...>
Quoted 1 line
+#define
OCTEP_PFVF_MBOX_VERSION_CURRENT
OCTEP_PFVF_MBOX_VERSION_V1This architecture design is unlikely to work in the real world unless you control both PF and VF environment. Mostly PF is running some old legacy distribution while VFs run more modern OS and this check will prevent to run new driver in VF.
Quoted 6 lines
Quoted 1 line
Thanks
Thanks for the review. This version validation only concerns regarding the control net API layer (which is used to communicate with the firmware). In the case you have described, this instead enables new VF drivers to atleast work atop legacy PF drivers (note legacy here still refers to PF drivers which support this backward compatibility), although they might not be able to use the latest control net functionalities that they have been enabled for.
The question what will be in X years from now, when you will have v100? Will you fallback to v0 for backward compatibility?
Quoted 5 lines
In the absence of such a backward compatibility, VF drivers would issue control net requests which PF drivers wouldn't know, only leading to logs of incompatibility errors and erroneous usage.
Also again please note that this version compatibility only concerns the control net infrastructure and API (the control plane).
It doesn't matter, even in best scenario, you can't guarantee that code in VM actually implements version Y fully and will need to check correctness per-command anyway.
Thanks
Quoted 1 line
RE: [EXT] Re: [PATCH net-next v3 2/4] octeon_ep: PF-VF mailbox version support
Quoted 26 lines
Quoted 7 lines
Quoted 6 lines
This architecture design is unlikely to work in the real world unless you control both PF and VF environment. Mostly PF is running some old legacy distribution while VFs run more modern OS and this check will prevent to run new driver in VF.
Thanks
Quoted 7 lines
Thanks for the review. This version validation only concerns regarding the control net API layer (which is used to communicate with
the firmware). In the case you have described, this instead enables new VF drivers to atleast work atop legacy PF drivers (note legacy here still refers to PF drivers which support this backward compatibility), although they might not be able to use the latest control net functionalities that they have been enabled for.The question what will be in X years from now, when you will have v100? Will you fallback to v0 for backward compatibility?
Quoted 7 lines
In the absence of such a backward compatibility, VF drivers would issue control net requests which PF drivers wouldn't know, only leading to logs of incompatibility errors and erroneous usage.
Also again please note that this version compatibility only concerns the control net infrastructure and API (the control plane).
Quoted 6 lines
It doesn't matter, even in best scenario, you can't guarantee that code in VM actually
implements version Y fully and will need to check correctness per-command anyway.Thanks
I'm afraid as to what else can be an alternative? The control net commands have to be decoded and passed by the PF driver for the VFs, as only the PFs have access to talk to firmware directly. The VF drivers do not have an alternative way to query control net APIs, and may fail if the control net APIs they have are not even recognized by the PF to decode them.
Either VF commands which the PF can't support can be blocked at the source (by the equivalent PF-VF backward compatibility which will exist in VF drivers) by this negotiation, or we have to let commands come through and fail them, leading to just redundancy in terms of running code. I don't see how this negotiation in any way 'limit' the VF drivers.
As you said, in essence the VF drivers will have to fallback to v0 for backward compatibility if the native host uses some old OS having older PF drivers. If not, the commands would come and fail anyways at the PF. Either way, it's an error case and this negotiation is just to decide if we are going to allow letting such commands in.
Thanks for your time
Re: [EXT] Re: [PATCH net-next v3 2/4] octeon_ep: PF-VF mailbox version support
Quoted 37 lines · Shinas Rasheed
Quoted 26 lines
Quoted 7 lines
Quoted 6 lines
This architecture design is unlikely to work in the real world unless you control both PF and VF environment. Mostly PF is running some old legacy distribution while VFs run more modern OS and this check will prevent to run new driver in VF.
Thanks
Quoted 7 lines
Thanks for the review. This version validation only concerns regarding the control net API layer (which is used to communicate with
the firmware). In the case you have described, this instead enables new VF drivers to atleast work atop legacy PF drivers (note legacy here still refers to PF drivers which support this backward compatibility), although they might not be able to use the latest control net functionalities that they have been enabled for.The question what will be in X years from now, when you will have v100? Will you fallback to v0 for backward compatibility?
Quoted 7 lines
In the absence of such a backward compatibility, VF drivers would issue control net requests which PF drivers wouldn't know, only leading to logs of incompatibility errors and erroneous usage.
Also again please note that this version compatibility only concerns the control net infrastructure and API (the control plane).
Quoted 6 lines
It doesn't matter, even in best scenario, you can't guarantee that code in VM actually
implements version Y fully and will need to check correctness per-command anyway.Thanks
I'm afraid as to what else can be an alternative? The control net commands have to be decoded and passed by the PF driver for the VFs, as only the PFs have access to talk to firmware directly. The VF drivers do not have an alternative way to query control net APIs, and may fail if the control net APIs they have are not even recognized by the PF to decode them.
Quoted 6 lines
Either VF commands which the PF can't support can be blocked at the source (by the equivalent PF-VF backward compatibility which will exist in VF drivers) by this negotiation, or we have to let commands come through and fail them, leading to just redundancy in terms of running code. I don't see how this negotiation in any way 'limit' the VF drivers.
As you said, in essence the VF drivers will have to fallback to v0 for backward compatibility if the native host uses some old OS having older PF drivers. If not, the commands would come and fail anyways at the PF. Either way, it's an error case and this negotiation is just to decide if we are going to allow letting such commands in.
I don't know what netdev maintainers will do with this code, I just pointed to this architecture/HW troublesome design.
Thanks
Quoted 2 lines
Thanks for your time
RE: [EXT] Re: [PATCH net-next v3 2/4] octeon_ep: PF-VF mailbox version support
Quoted 18 lines
Quoted 1 line
I'm afraid as to what else can be an alternative? The control net commands
have to be decoded and passed by the PF driver for the VFs,
Quoted 1 line
as only the PFs have access to talk to firmware directly. The VF drivers do
not have an alternative way to query control net APIs, and may fail
Quoted 1 line
if the control net APIs they have are not even recognized by the PF to
decode them.
Quoted 2 lines
Either VF commands which the PF can't support can be blocked at the
source (by the equivalent PF-VF backward compatibility which will exist in VF drivers)
Quoted 1 line
by this negotiation, or we have to let commands come through and fail
them, leading to just redundancy in terms of running code. I don't see how this negotiation in
Quoted 3 lines
any way 'limit' the VF drivers.
As you said, in essence the VF drivers will have to fallback to v0 for
backward compatibility if the native host uses some old OS having older PF drivers. If not, the
Quoted 8 lines
Quoted 1 line
commands would come and fail anyways at the PF. Either way, it's an error
case and this negotiation is just to decide if we are going to allow letting such commands in.
I don't know what netdev maintainers will do with this code, I just pointed to this architecture/HW troublesome design.
Thanks
I understand, thanks for your scrutiny. As I understand, its a case for letting errors run its course by letting unsupported commands in, or negotiate for a common version and stop earlier on control plane commands which the PF driver just doesn't know.
Again, thanks for your constructive insight.
PATCH v3 3/4 octeon_ep: control net framework to support VF offloads
In reply to Shinas RasheedInquire firmware on supported offloads, as well as convey offloads enabled dynamically to firmware for the VFs. Implement control net API to support the same.
---
V3:
- No changes
V2: https://lore.kernel.org/all/[email protected]/
- No changes
V1: https://lore.kernel.org/all/[email protected]/
.../marvell/octeon_ep/octep_pfvf_mbox.c | 47 +++++++++++++++++++ .../marvell/octeon_ep/octep_pfvf_mbox.h | 21 ++++++++- 2 files changed, 67 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +47 -0
@@ -159,6 +159,47 @@ static void octep_pfvf_dev_remove(struct octep_device *oct, u32 vf_id, rsp->s.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; } +static void octep_pfvf_get_fw_info (struct octep_device *oct,u32 vf_id, +union octep_pfvf_mbox_word cmd, +union octep_pfvf_mbox_word *rsp) +{ +struct octep_fw_info fw_info; +int err; + + err =octep_ctrl_net_get_info (oct, vf_id, &fw_info); +if (err) { + rsp->s_fw_info.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ; +dev_err (&oct->pdev->dev,"Get VF info failed via host control Mbox\n" ); +return ; + } + + rsp->s_fw_info.pkind = fw_info.pkind; + rsp->s_fw_info.fsz = fw_info.fsz; + rsp->s_fw_info.rx_ol_flags = fw_info.rx_ol_flags; + rsp->s_fw_info.tx_ol_flags = fw_info.tx_ol_flags; + + rsp->s_fw_info.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; +} + +static void octep_pfvf_set_offloads (struct octep_device *oct,u32 vf_id, +union octep_pfvf_mbox_word cmd, +union octep_pfvf_mbox_word *rsp) +{ +struct octep_ctrl_net_offloads offloads = { + .rx_offloads = cmd.s_offloads.rx_ol_flags, + .tx_offloads = cmd.s_offloads.tx_ol_flags + }; +int err; + + err =octep_ctrl_net_set_offloads (oct, vf_id, &offloads, true); +if (err) { + rsp->s_offloads.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ; +dev_err (&oct->pdev->dev,"Set VF offloads failed via host control Mbox\n" ); +return ; + } + rsp->s_offloads.type =OCTEP_PFVF_MBOX_TYPE_RSP_ACK ; +} +int octep_setup_pfvf_mbox (struct octep_device *oct) {int i =0 , num_vfs =0 , rings_per_vf =0 ;
@@ -335,6 +376,12 @@ void octep_pfvf_mbox_work(struct work_struct *work)case OCTEP_PFVF_MBOX_CMD_DEV_REMOVE :octep_pfvf_dev_remove (oct, vf_id, cmd, &rsp);break ; +case OCTEP_PFVF_MBOX_CMD_GET_FW_INFO : +octep_pfvf_get_fw_info (oct, vf_id, cmd, &rsp); +break ; +case OCTEP_PFVF_MBOX_CMD_SET_OFFLOADS : +octep_pfvf_set_offloads (oct, vf_id, cmd, &rsp); +break ;default :dev_err (&oct->pdev->dev,"PF-VF mailbox: invalid opcode %d\n" , cmd.s.opcode); rsp.s.type =OCTEP_PFVF_MBOX_TYPE_RSP_NACK ;
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h +20 -1
@@ -18,9 +18,10 @@enum octep_pfvf_mbox_version {OCTEP_PFVF_MBOX_VERSION_V0 ,OCTEP_PFVF_MBOX_VERSION_V1 , +OCTEP_PFVF_MBOX_VERSION_V2 , }; -#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V1 +#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V2enum octep_pfvf_mbox_opcode {OCTEP_PFVF_MBOX_CMD_VERSION ,
@@ -34,6 +35,8 @@ enum octep_pfvf_mbox_opcode {OCTEP_PFVF_MBOX_CMD_GET_LINK_STATUS ,OCTEP_PFVF_MBOX_CMD_GET_MTU ,OCTEP_PFVF_MBOX_CMD_DEV_REMOVE , +OCTEP_PFVF_MBOX_CMD_GET_FW_INFO , +OCTEP_PFVF_MBOX_CMD_SET_OFFLOADS , OCTEP_PFVF_MBOX_CMD_MAX, };
@@ -138,6 +141,22 @@ union octep_pfvf_mbox_word { u64 status:1; u64 rsvd:53; } s_link_status; +struct { +u64 opcode:8 ; +u64 type:2 ; +u64 pkind:8 ; +u64 fsz:8 ; +u64 rx_ol_flags:16 ; +u64 tx_ol_flags:16 ; +u64 rsvd:6 ; + } s_fw_info; +struct { +u64 opcode:8 ; +u64 type:2 ; +u64 rsvd:22 ; +u64 rx_ol_flags:16 ; +u64 tx_ol_flags:16 ; + } s_offloads; } __packed;void octep_pfvf_mbox_work (struct work_struct *work);
Signature · 1 line
2.25.1
PATCH v3 4/4 octeon_ep: support firmware notifications for VFs
In reply to Shinas RasheedNotifications from firmware to vf has to pass through PF control mbox and via PF-VF mailboxes. The notifications have to be parsed out from the control mbox and passed to the PF-VF mailbox in order to reach the corresponding VF. Version compatibility should also be checked before messages are passed to the mailboxes.
---
V3:
- No changes
V2: https://lore.kernel.org/all/[email protected]/
- No changes
V1: https://lore.kernel.org/all/[email protected]/
.../marvell/octeon_ep/octep_ctrl_net.c | 6 ++ .../marvell/octeon_ep/octep_pfvf_mbox.c | 58 +++++++++++++++++++ .../marvell/octeon_ep/octep_pfvf_mbox.h | 2 + 3 files changed, 66 insertions(+)
drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c +6 -0
@@ -13,6 +13,7 @@#include "octep_config.h" #include "octep_main.h" #include "octep_ctrl_net.h" +#include "octep_pfvf_mbox.h" /* Control plane version */ #define OCTEP_CP_VERSION_CURRENT OCTEP_CP_VERSION(1, 0, 0)
@@ -329,6 +330,11 @@ static int process_mbox_notify(struct octep_device *oct, octep_ctrl_net_f2h_cmd_versions[cmd] < OCTEP_CP_VERSION_CURRENT)return -EOPNOTSUPP ; +if (msg->hdr.s.is_vf) { +octep_pfvf_notify (oct, msg); +return 0 ; + } +switch (cmd) {case OCTEP_CTRL_NET_F2H_CMD_LINK_STATUS :if (netif_running (netdev)) {
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +58 -0
76 lines not on this page · raw message
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h +2 -0
@@ -37,6 +37,7 @@ enum octep_pfvf_mbox_opcode {OCTEP_PFVF_MBOX_CMD_DEV_REMOVE ,OCTEP_PFVF_MBOX_CMD_GET_FW_INFO ,OCTEP_PFVF_MBOX_CMD_SET_OFFLOADS , +OCTEP_PFVF_MBOX_NOTIF_LINK_STATUS , OCTEP_PFVF_MBOX_CMD_MAX, };
@@ -162,4 +163,5 @@ union octep_pfvf_mbox_word {void octep_pfvf_mbox_work (struct work_struct *work);int octep_setup_pfvf_mbox (struct octep_device *oct);void octep_delete_pfvf_mbox (struct octep_device *oct); +void octep_pfvf_notify (struct octep_device *oct,struct octep_ctrl_mbox_msg *msg);#endif
Signature · 1 line
2.25.1