Skip to content

Commit c130e58

Browse files
shinas-marvellPaolo Abeni
authored and
Paolo Abeni
committed
octeon_ep: PF-VF mailbox version support
Add PF-VF mailbox initial version support Signed-off-by: Shinas Rasheed <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent cde29af commit c130e58

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ struct octep_iface_link_info {
220220
/* The Octeon VF device specific info data structure.*/
221221
struct octep_pfvf_info {
222222
u8 mac_addr[ETH_ALEN];
223+
u32 mbox_version;
223224
};
224225

225226
/* The Octeon device specific private data structure.

drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
2727
{
2828
u32 vf_version = (u32)cmd.s_version.version;
2929

30-
if (vf_version <= OCTEP_PFVF_MBOX_VERSION_V1)
31-
rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;
30+
dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PF version:%d\n",
31+
vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
32+
if (vf_version < OCTEP_PFVF_MBOX_VERSION_CURRENT)
33+
rsp->s_version.version = vf_version;
3234
else
33-
rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK;
35+
rsp->s_version.version = OCTEP_PFVF_MBOX_VERSION_CURRENT;
36+
37+
oct->vf_info[vf_id].mbox_version = rsp->s_version.version;
38+
dev_dbg(&oct->pdev->dev, "VF id:%d negotiated VF version:%d\n",
39+
vf_id, oct->vf_info[vf_id].mbox_version);
40+
41+
rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;
3442
}
3543

3644
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)
166174
goto free_mbox;
167175

168176
memset(oct->mbox[ring], 0, sizeof(struct octep_mbox));
177+
memset(&oct->vf_info[i], 0, sizeof(struct octep_pfvf_info));
169178
mutex_init(&oct->mbox[ring]->lock);
170179
INIT_WORK(&oct->mbox[ring]->wk.work, octep_pfvf_mbox_work);
171180
oct->mbox[ring]->wk.ctxptr = oct->mbox[ring];

drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@
1313
#define OCTEON_SDP_16K_HW_FRS 16380UL
1414
#define OCTEON_SDP_64K_HW_FRS 65531UL
1515

16+
/* When a new command is implemented,PF Mbox version should be bumped.
17+
*/
1618
enum octep_pfvf_mbox_version {
1719
OCTEP_PFVF_MBOX_VERSION_V0,
1820
OCTEP_PFVF_MBOX_VERSION_V1,
1921
};
2022

23+
#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V1
24+
2125
enum octep_pfvf_mbox_opcode {
2226
OCTEP_PFVF_MBOX_CMD_VERSION,
2327
OCTEP_PFVF_MBOX_CMD_SET_MTU,

0 commit comments

Comments
 (0)