1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell Octeon EP (EndPoint) Ethernet Driver
4 * Copyright (C) 2020 Marvell.
8 #ifndef _OCTEP_PFVF_MBOX_H_
9 #define _OCTEP_PFVF_MBOX_H_
12 #define OCTEON_PFVF_FLAG_MAC_SET_BY_PF BIT_ULL(0) /* PF has set VF MAC address */
13 #define OCTEON_SDP_16K_HW_FRS 16380UL
14 #define OCTEON_SDP_64K_HW_FRS 65531UL
16 /* When a new command is implemented,PF Mbox version should be bumped.
18 enum octep_pfvf_mbox_version {
19 OCTEP_PFVF_MBOX_VERSION_V0,
20 OCTEP_PFVF_MBOX_VERSION_V1,
21 OCTEP_PFVF_MBOX_VERSION_V2,
24 #define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V2
26 enum octep_pfvf_mbox_opcode {
27 OCTEP_PFVF_MBOX_CMD_VERSION,
28 OCTEP_PFVF_MBOX_CMD_SET_MTU,
29 OCTEP_PFVF_MBOX_CMD_SET_MAC_ADDR,
30 OCTEP_PFVF_MBOX_CMD_GET_MAC_ADDR,
31 OCTEP_PFVF_MBOX_CMD_GET_LINK_INFO,
32 OCTEP_PFVF_MBOX_CMD_GET_STATS,
33 OCTEP_PFVF_MBOX_CMD_SET_RX_STATE,
34 OCTEP_PFVF_MBOX_CMD_SET_LINK_STATUS,
35 OCTEP_PFVF_MBOX_CMD_GET_LINK_STATUS,
36 OCTEP_PFVF_MBOX_CMD_GET_MTU,
37 OCTEP_PFVF_MBOX_CMD_DEV_REMOVE,
38 OCTEP_PFVF_MBOX_CMD_GET_FW_INFO,
39 OCTEP_PFVF_MBOX_CMD_SET_OFFLOADS,
40 OCTEP_PFVF_MBOX_NOTIF_LINK_STATUS,
41 OCTEP_PFVF_MBOX_CMD_MAX,
44 enum octep_pfvf_mbox_word_type {
45 OCTEP_PFVF_MBOX_TYPE_CMD,
46 OCTEP_PFVF_MBOX_TYPE_RSP_ACK,
47 OCTEP_PFVF_MBOX_TYPE_RSP_NACK,
50 enum octep_pfvf_mbox_cmd_status {
51 OCTEP_PFVF_MBOX_CMD_STATUS_NOT_SETUP = 1,
52 OCTEP_PFVF_MBOX_CMD_STATUS_TIMEDOUT = 2,
53 OCTEP_PFVF_MBOX_CMD_STATUS_NACK = 3,
54 OCTEP_PFVF_MBOX_CMD_STATUS_BUSY = 4
57 enum octep_pfvf_mbox_state {
58 OCTEP_PFVF_MBOX_STATE_IDLE = 0,
59 OCTEP_PFVF_MBOX_STATE_BUSY = 1,
62 enum octep_pfvf_link_status {
63 OCTEP_PFVF_LINK_STATUS_DOWN,
64 OCTEP_PFVF_LINK_STATUS_UP,
67 enum octep_pfvf_link_speed {
68 OCTEP_PFVF_LINK_SPEED_NONE,
69 OCTEP_PFVF_LINK_SPEED_1000,
70 OCTEP_PFVF_LINK_SPEED_10000,
71 OCTEP_PFVF_LINK_SPEED_25000,
72 OCTEP_PFVF_LINK_SPEED_40000,
73 OCTEP_PFVF_LINK_SPEED_50000,
74 OCTEP_PFVF_LINK_SPEED_100000,
75 OCTEP_PFVF_LINK_SPEED_LAST,
78 enum octep_pfvf_link_duplex {
79 OCTEP_PFVF_LINK_HALF_DUPLEX,
80 OCTEP_PFVF_LINK_FULL_DUPLEX,
83 enum octep_pfvf_link_autoneg {
84 OCTEP_PFVF_LINK_AUTONEG,
85 OCTEP_PFVF_LINK_FIXED,
88 #define OCTEP_PFVF_MBOX_TIMEOUT_MS 500
89 #define OCTEP_PFVF_MBOX_MAX_RETRIES 2
90 #define OCTEP_PFVF_MBOX_MAX_DATA_SIZE 6
91 #define OCTEP_PFVF_MBOX_MORE_FRAG_FLAG 1
92 #define OCTEP_PFVF_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
94 union octep_pfvf_mbox_word {
163 void octep_pfvf_mbox_work(struct work_struct *work);
164 int octep_setup_pfvf_mbox(struct octep_device *oct);
165 void octep_delete_pfvf_mbox(struct octep_device *oct);
166 void octep_pfvf_notify(struct octep_device *oct, struct octep_ctrl_mbox_msg *msg);