Commit c130e589 authored by Shinas Rasheed's avatar Shinas Rasheed Committed by Paolo Abeni

octeon_ep: PF-VF mailbox version support

Add PF-VF mailbox initial version support
Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent cde29af9
...@@ -220,6 +220,7 @@ struct octep_iface_link_info { ...@@ -220,6 +220,7 @@ struct octep_iface_link_info {
/* The Octeon VF device specific info data structure.*/ /* The Octeon VF device specific info data structure.*/
struct octep_pfvf_info { struct octep_pfvf_info {
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u32 mbox_version;
}; };
/* The Octeon device specific private data structure. /* The Octeon device specific private data structure.
......
...@@ -27,10 +27,18 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id, ...@@ -27,10 +27,18 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
{ {
u32 vf_version = (u32)cmd.s_version.version; u32 vf_version = (u32)cmd.s_version.version;
if (vf_version <= OCTEP_PFVF_MBOX_VERSION_V1) dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PF version:%d\n",
rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
if (vf_version < OCTEP_PFVF_MBOX_VERSION_CURRENT)
rsp->s_version.version = vf_version;
else 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, static void octep_pfvf_get_link_status(struct octep_device *oct, u32 vf_id,
...@@ -166,6 +174,7 @@ int octep_setup_pfvf_mbox(struct octep_device *oct) ...@@ -166,6 +174,7 @@ int octep_setup_pfvf_mbox(struct octep_device *oct)
goto free_mbox; goto free_mbox;
memset(oct->mbox[ring], 0, sizeof(struct octep_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); mutex_init(&oct->mbox[ring]->lock);
INIT_WORK(&oct->mbox[ring]->wk.work, octep_pfvf_mbox_work); INIT_WORK(&oct->mbox[ring]->wk.work, octep_pfvf_mbox_work);
oct->mbox[ring]->wk.ctxptr = oct->mbox[ring]; oct->mbox[ring]->wk.ctxptr = oct->mbox[ring];
......
...@@ -13,11 +13,15 @@ ...@@ -13,11 +13,15 @@
#define OCTEON_SDP_16K_HW_FRS 16380UL #define OCTEON_SDP_16K_HW_FRS 16380UL
#define OCTEON_SDP_64K_HW_FRS 65531UL #define OCTEON_SDP_64K_HW_FRS 65531UL
/* When a new command is implemented,PF Mbox version should be bumped.
*/
enum octep_pfvf_mbox_version { enum octep_pfvf_mbox_version {
OCTEP_PFVF_MBOX_VERSION_V0, OCTEP_PFVF_MBOX_VERSION_V0,
OCTEP_PFVF_MBOX_VERSION_V1, OCTEP_PFVF_MBOX_VERSION_V1,
}; };
#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V1
enum octep_pfvf_mbox_opcode { enum octep_pfvf_mbox_opcode {
OCTEP_PFVF_MBOX_CMD_VERSION, OCTEP_PFVF_MBOX_CMD_VERSION,
OCTEP_PFVF_MBOX_CMD_SET_MTU, OCTEP_PFVF_MBOX_CMD_SET_MTU,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment