@@ -22,7 +22,8 @@ static const u32 link_info_sz = sizeof(struct octep_ctrl_net_link_info);
22
22
static const u32 get_stats_sz = sizeof (struct octep_ctrl_net_h2f_req_cmd_get_stats );
23
23
static atomic_t ctrl_net_msg_id ;
24
24
25
- static void init_send_req (struct octep_ctrl_mbox_msg * msg , void * buf , u16 sz )
25
+ static void init_send_req (struct octep_ctrl_mbox_msg * msg , void * buf ,
26
+ u16 sz , int vfid )
26
27
{
27
28
msg -> hdr .s .flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ ;
28
29
msg -> hdr .s .msg_id = atomic_inc_return (& ctrl_net_msg_id ) &
@@ -31,6 +32,10 @@ static void init_send_req(struct octep_ctrl_mbox_msg *msg, void *buf, u16 sz)
31
32
msg -> sg_num = 1 ;
32
33
msg -> sg_list [0 ].msg = buf ;
33
34
msg -> sg_list [0 ].sz = msg -> hdr .s .sz ;
35
+ if (vfid != OCTEP_CTRL_NET_INVALID_VFID ) {
36
+ msg -> hdr .s .is_vf = 1 ;
37
+ msg -> hdr .s .vf_idx = vfid ;
38
+ }
34
39
}
35
40
36
41
static int octep_send_mbox_req (struct octep_device * oct ,
@@ -91,13 +96,13 @@ int octep_ctrl_net_init(struct octep_device *oct)
91
96
return 0 ;
92
97
}
93
98
94
- int octep_ctrl_net_get_link_status (struct octep_device * oct )
99
+ int octep_ctrl_net_get_link_status (struct octep_device * oct , int vfid )
95
100
{
96
101
struct octep_ctrl_net_wait_data d = {0 };
97
102
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
98
103
int err ;
99
104
100
- init_send_req (& d .msg , (void * )req , state_sz );
105
+ init_send_req (& d .msg , (void * )req , state_sz , vfid );
101
106
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_LINK_STATUS ;
102
107
req -> link .cmd = OCTEP_CTRL_NET_CMD_GET ;
103
108
err = octep_send_mbox_req (oct , & d , true);
@@ -107,13 +112,13 @@ int octep_ctrl_net_get_link_status(struct octep_device *oct)
107
112
return d .data .resp .link .state ;
108
113
}
109
114
110
- int octep_ctrl_net_set_link_status (struct octep_device * oct , bool up ,
115
+ int octep_ctrl_net_set_link_status (struct octep_device * oct , int vfid , bool up ,
111
116
bool wait_for_response )
112
117
{
113
118
struct octep_ctrl_net_wait_data d = {0 };
114
119
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
115
120
116
- init_send_req (& d .msg , req , state_sz );
121
+ init_send_req (& d .msg , req , state_sz , vfid );
117
122
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_LINK_STATUS ;
118
123
req -> link .cmd = OCTEP_CTRL_NET_CMD_SET ;
119
124
req -> link .state = (up ) ? OCTEP_CTRL_NET_STATE_UP :
@@ -122,13 +127,13 @@ int octep_ctrl_net_set_link_status(struct octep_device *oct, bool up,
122
127
return octep_send_mbox_req (oct , & d , wait_for_response );
123
128
}
124
129
125
- int octep_ctrl_net_set_rx_state (struct octep_device * oct , bool up ,
130
+ int octep_ctrl_net_set_rx_state (struct octep_device * oct , int vfid , bool up ,
126
131
bool wait_for_response )
127
132
{
128
133
struct octep_ctrl_net_wait_data d = {0 };
129
134
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
130
135
131
- init_send_req (& d .msg , req , state_sz );
136
+ init_send_req (& d .msg , req , state_sz , vfid );
132
137
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_RX_STATE ;
133
138
req -> link .cmd = OCTEP_CTRL_NET_CMD_SET ;
134
139
req -> link .state = (up ) ? OCTEP_CTRL_NET_STATE_UP :
@@ -137,13 +142,13 @@ int octep_ctrl_net_set_rx_state(struct octep_device *oct, bool up,
137
142
return octep_send_mbox_req (oct , & d , wait_for_response );
138
143
}
139
144
140
- int octep_ctrl_net_get_mac_addr (struct octep_device * oct , u8 * addr )
145
+ int octep_ctrl_net_get_mac_addr (struct octep_device * oct , int vfid , u8 * addr )
141
146
{
142
147
struct octep_ctrl_net_wait_data d = {0 };
143
148
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
144
149
int err ;
145
150
146
- init_send_req (& d .msg , req , mac_sz );
151
+ init_send_req (& d .msg , req , mac_sz , vfid );
147
152
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_MAC ;
148
153
req -> link .cmd = OCTEP_CTRL_NET_CMD_GET ;
149
154
err = octep_send_mbox_req (oct , & d , true);
@@ -155,43 +160,43 @@ int octep_ctrl_net_get_mac_addr(struct octep_device *oct, u8 *addr)
155
160
return 0 ;
156
161
}
157
162
158
- int octep_ctrl_net_set_mac_addr (struct octep_device * oct , u8 * addr ,
163
+ int octep_ctrl_net_set_mac_addr (struct octep_device * oct , int vfid , u8 * addr ,
159
164
bool wait_for_response )
160
165
{
161
166
struct octep_ctrl_net_wait_data d = {0 };
162
167
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
163
168
164
- init_send_req (& d .msg , req , mac_sz );
169
+ init_send_req (& d .msg , req , mac_sz , vfid );
165
170
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_MAC ;
166
171
req -> mac .cmd = OCTEP_CTRL_NET_CMD_SET ;
167
172
memcpy (& req -> mac .addr , addr , ETH_ALEN );
168
173
169
174
return octep_send_mbox_req (oct , & d , wait_for_response );
170
175
}
171
176
172
- int octep_ctrl_net_set_mtu (struct octep_device * oct , int mtu ,
177
+ int octep_ctrl_net_set_mtu (struct octep_device * oct , int vfid , int mtu ,
173
178
bool wait_for_response )
174
179
{
175
180
struct octep_ctrl_net_wait_data d = {0 };
176
181
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
177
182
178
- init_send_req (& d .msg , req , mtu_sz );
183
+ init_send_req (& d .msg , req , mtu_sz , vfid );
179
184
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_MTU ;
180
185
req -> mtu .cmd = OCTEP_CTRL_NET_CMD_SET ;
181
186
req -> mtu .val = mtu ;
182
187
183
188
return octep_send_mbox_req (oct , & d , wait_for_response );
184
189
}
185
190
186
- int octep_ctrl_net_get_if_stats (struct octep_device * oct )
191
+ int octep_ctrl_net_get_if_stats (struct octep_device * oct , int vfid )
187
192
{
188
193
struct octep_ctrl_net_wait_data d = {0 };
189
194
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
190
195
void __iomem * iface_rx_stats ;
191
196
void __iomem * iface_tx_stats ;
192
197
int err ;
193
198
194
- init_send_req (& d .msg , req , get_stats_sz );
199
+ init_send_req (& d .msg , req , get_stats_sz , vfid );
195
200
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_GET_IF_STATS ;
196
201
req -> get_stats .offset = oct -> ctrl_mbox_ifstats_offset ;
197
202
err = octep_send_mbox_req (oct , & d , true);
@@ -207,14 +212,14 @@ int octep_ctrl_net_get_if_stats(struct octep_device *oct)
207
212
return 0 ;
208
213
}
209
214
210
- int octep_ctrl_net_get_link_info (struct octep_device * oct )
215
+ int octep_ctrl_net_get_link_info (struct octep_device * oct , int vfid )
211
216
{
212
217
struct octep_ctrl_net_wait_data d = {0 };
213
218
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
214
219
struct octep_ctrl_net_h2f_resp * resp ;
215
220
int err ;
216
221
217
- init_send_req (& d .msg , req , link_info_sz );
222
+ init_send_req (& d .msg , req , link_info_sz , vfid );
218
223
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_LINK_INFO ;
219
224
req -> link_info .cmd = OCTEP_CTRL_NET_CMD_GET ;
220
225
err = octep_send_mbox_req (oct , & d , true);
@@ -231,14 +236,14 @@ int octep_ctrl_net_get_link_info(struct octep_device *oct)
231
236
return 0 ;
232
237
}
233
238
234
- int octep_ctrl_net_set_link_info (struct octep_device * oct ,
239
+ int octep_ctrl_net_set_link_info (struct octep_device * oct , int vfid ,
235
240
struct octep_iface_link_info * link_info ,
236
241
bool wait_for_response )
237
242
{
238
243
struct octep_ctrl_net_wait_data d = {0 };
239
244
struct octep_ctrl_net_h2f_req * req = & d .data .req ;
240
245
241
- init_send_req (& d .msg , req , link_info_sz );
246
+ init_send_req (& d .msg , req , link_info_sz , vfid );
242
247
req -> hdr .s .cmd = OCTEP_CTRL_NET_H2F_CMD_LINK_INFO ;
243
248
req -> link_info .cmd = OCTEP_CTRL_NET_CMD_SET ;
244
249
req -> link_info .info .advertised_modes = link_info -> advertised_modes ;
0 commit comments