Skip to content

Commit bb5dbf2

Browse files
Volodymyr Mytnykdavem330
authored andcommitted
net: marvell: prestera: add firmware v4.0 support
Add firmware (FW) version 4.0 support for Marvell Prestera driver. Major changes have been made to new v4.0 FW ABI to add support of new features, introduce the stability of the FW ABI and ensure better forward compatibility for the future driver vesrions. Current v4.0 FW feature set support does not expect any changes to ABI, as it was defined and tested through long period of time. The ABI may be extended in case of new features, but it will not break the backward compatibility. ABI major changes done in v4.0: - L1 ABI, where MAC and PHY API configuration are split. - ACL has been split to low-level TCAM and Counters ABI to provide more HW ACL capabilities for future driver versions. To support backward support, the addition compatibility layer is required in the driver which will have two different codebase under "if FW-VER elif FW-VER else" conditions that will be removed in the future anyway, So, the idea was to break backward support and focus on more stable FW instead of supporting old version with very minimal and limited set of features/capabilities. Improve FW msg validation: * Use __le64, __le32, __le16 types in msg to/from FW to catch endian mismatch by sparse. * Use BUILD_BUG_ON for structures sent/recv to/from FW. Co-developed-by: Vadym Kochan <[email protected]> Signed-off-by: Vadym Kochan <[email protected]> Signed-off-by: Yevhen Orlov <[email protected]> Signed-off-by: Taras Chornyi <[email protected]> Signed-off-by: Volodymyr Mytnyk <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c52ef04 commit bb5dbf2

File tree

8 files changed

+951
-719
lines changed

8 files changed

+951
-719
lines changed

drivers/net/ethernet/marvell/prestera/prestera.h

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ struct prestera_port_stats {
5353
u64 good_octets_sent;
5454
};
5555

56+
#define PRESTERA_AP_PORT_MAX (10)
57+
5658
struct prestera_port_caps {
5759
u64 supp_link_modes;
5860
u8 supp_fec;
@@ -69,6 +71,39 @@ struct prestera_lag {
6971

7072
struct prestera_flow_block;
7173

74+
struct prestera_port_mac_state {
75+
u32 mode;
76+
u32 speed;
77+
bool oper;
78+
u8 duplex;
79+
u8 fc;
80+
u8 fec;
81+
};
82+
83+
struct prestera_port_phy_state {
84+
u64 lmode_bmap;
85+
struct {
86+
bool pause;
87+
bool asym_pause;
88+
} remote_fc;
89+
u8 mdix;
90+
};
91+
92+
struct prestera_port_mac_config {
93+
u32 mode;
94+
u32 speed;
95+
bool admin;
96+
u8 inband;
97+
u8 duplex;
98+
u8 fec;
99+
};
100+
101+
struct prestera_port_phy_config {
102+
u32 mode;
103+
bool admin;
104+
u8 mdix;
105+
};
106+
72107
struct prestera_port {
73108
struct net_device *dev;
74109
struct prestera_switch *sw;
@@ -91,6 +126,10 @@ struct prestera_port {
91126
struct prestera_port_stats stats;
92127
struct delayed_work caching_dw;
93128
} cached_hw_stats;
129+
struct prestera_port_mac_config cfg_mac;
130+
struct prestera_port_phy_config cfg_phy;
131+
struct prestera_port_mac_state state_mac;
132+
struct prestera_port_phy_state state_phy;
94133
};
95134

96135
struct prestera_device {
@@ -107,7 +146,7 @@ struct prestera_device {
107146
int (*recv_msg)(struct prestera_device *dev, void *msg, size_t size);
108147

109148
/* called by higher layer to send request to the firmware */
110-
int (*send_req)(struct prestera_device *dev, void *in_msg,
149+
int (*send_req)(struct prestera_device *dev, int qid, void *in_msg,
111150
size_t in_size, void *out_msg, size_t out_size,
112151
unsigned int wait);
113152
};
@@ -129,13 +168,28 @@ enum prestera_rxtx_event_id {
129168

130169
enum prestera_port_event_id {
131170
PRESTERA_PORT_EVENT_UNSPEC,
132-
PRESTERA_PORT_EVENT_STATE_CHANGED,
171+
PRESTERA_PORT_EVENT_MAC_STATE_CHANGED,
133172
};
134173

135174
struct prestera_port_event {
136175
u32 port_id;
137176
union {
138-
u32 oper_state;
177+
struct {
178+
u32 mode;
179+
u32 speed;
180+
u8 oper;
181+
u8 duplex;
182+
u8 fc;
183+
u8 fec;
184+
} mac;
185+
struct {
186+
u64 lmode_bmap;
187+
struct {
188+
bool pause;
189+
bool asym_pause;
190+
} remote_fc;
191+
u8 mdix;
192+
} phy;
139193
} data;
140194
};
141195

@@ -223,11 +277,16 @@ void prestera_device_unregister(struct prestera_device *dev);
223277
struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw,
224278
u32 dev_id, u32 hw_id);
225279

226-
int prestera_port_autoneg_set(struct prestera_port *port, bool enable,
227-
u64 adver_link_modes, u8 adver_fec);
280+
int prestera_port_autoneg_set(struct prestera_port *port, u64 link_modes);
228281

229282
struct prestera_port *prestera_find_port(struct prestera_switch *sw, u32 id);
230283

284+
int prestera_port_cfg_mac_read(struct prestera_port *port,
285+
struct prestera_port_mac_config *cfg);
286+
287+
int prestera_port_cfg_mac_write(struct prestera_port *port,
288+
struct prestera_port_mac_config *cfg);
289+
231290
struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev);
232291

233292
int prestera_port_pvid_set(struct prestera_port *port, u16 vid);

0 commit comments

Comments
 (0)