@@ -21,6 +21,7 @@ struct idpf_vport_max_q;
21
21
#define IDPF_NO_FREE_SLOT 0xffff
22
22
23
23
/* Default Mailbox settings */
24
+ #define IDPF_NUM_FILTERS_PER_MSG 20
24
25
#define IDPF_NUM_DFLT_MBX_Q 2 /* includes both TX and RX */
25
26
#define IDPF_DFLT_MBX_Q_LEN 64
26
27
#define IDPF_DFLT_MBX_ID -1
@@ -37,6 +38,20 @@ struct idpf_vport_max_q;
37
38
#define IDPF_VIRTCHNL_VERSION_MAJOR VIRTCHNL2_VERSION_MAJOR_2
38
39
#define IDPF_VIRTCHNL_VERSION_MINOR VIRTCHNL2_VERSION_MINOR_0
39
40
41
+ /**
42
+ * struct idpf_mac_filter
43
+ * @list: list member field
44
+ * @macaddr: MAC address
45
+ * @remove: filter should be removed (virtchnl)
46
+ * @add: filter should be added (virtchnl)
47
+ */
48
+ struct idpf_mac_filter {
49
+ struct list_head list ;
50
+ u8 macaddr [ETH_ALEN ];
51
+ bool remove ;
52
+ bool add ;
53
+ };
54
+
40
55
/**
41
56
* enum idpf_state - State machine to handle bring up
42
57
* @__IDPF_STARTUP: Start the state machine
@@ -115,11 +130,17 @@ enum idpf_vport_state {
115
130
116
131
/**
117
132
* struct idpf_netdev_priv - Struct to store vport back pointer
133
+ * @adapter: Adapter back pointer
118
134
* @vport: Vport back pointer
135
+ * @vport_id: Vport identifier
136
+ * @vport_idx: Relative vport index
119
137
* @state: See enum idpf_vport_state
120
138
*/
121
139
struct idpf_netdev_priv {
140
+ struct idpf_adapter * adapter ;
122
141
struct idpf_vport * vport ;
142
+ u32 vport_id ;
143
+ u16 vport_idx ;
123
144
enum idpf_vport_state state ;
124
145
};
125
146
@@ -184,6 +205,12 @@ struct idpf_dev_ops {
184
205
STATE(IDPF_VC_ALLOC_VECTORS_ERR) \
185
206
STATE(IDPF_VC_DEALLOC_VECTORS) \
186
207
STATE(IDPF_VC_DEALLOC_VECTORS_ERR) \
208
+ STATE(IDPF_VC_ADD_MAC_ADDR) \
209
+ STATE(IDPF_VC_ADD_MAC_ADDR_ERR) \
210
+ STATE(IDPF_VC_DEL_MAC_ADDR) \
211
+ STATE(IDPF_VC_DEL_MAC_ADDR_ERR) \
212
+ STATE(IDPF_VC_GET_PTYPE_INFO) \
213
+ STATE(IDPF_VC_GET_PTYPE_INFO_ERR) \
187
214
STATE(IDPF_VC_NBITS)
188
215
189
216
#define IDPF_GEN_ENUM (ENUM ) ENUM,
@@ -213,13 +240,15 @@ extern const char * const idpf_vport_vc_state_str[];
213
240
* @bufq_size: Size of buffers in ring (e.g. 2K, 4K, etc)
214
241
* @num_rxq_grp: Number of RX queues in a group
215
242
* @rxq_model: Splitq queue or single queue queuing model
243
+ * @rx_ptype_lkup: Lookup table for ptypes on RX
216
244
* @adapter: back pointer to associated adapter
217
245
* @netdev: Associated net_device. Each vport should have one and only one
218
246
* associated netdev.
219
247
* @vport_type: Default SRIOV, SIOV, etc.
220
248
* @vport_id: Device given vport identifier
221
249
* @idx: Software index in adapter vports struct
222
250
* @default_vport: Use this vport if one isn't specified
251
+ * @base_rxd: True if the driver should use base descriptors instead of flex
223
252
* @max_mtu: device given max possible MTU
224
253
* @default_mac_addr: device will give a default MAC to use
225
254
* @vc_msg: Virtchnl message buffer
@@ -242,13 +271,15 @@ struct idpf_vport {
242
271
u32 bufq_size [IDPF_MAX_BUFQS_PER_RXQ_GRP ];
243
272
u16 num_rxq_grp ;
244
273
u32 rxq_model ;
274
+ struct idpf_rx_ptype_decoded rx_ptype_lkup [IDPF_RX_MAX_PTYPE ];
245
275
246
276
struct idpf_adapter * adapter ;
247
277
struct net_device * netdev ;
248
278
u16 vport_type ;
249
279
u32 vport_id ;
250
280
u16 idx ;
251
281
bool default_vport ;
282
+ bool base_rxd ;
252
283
253
284
u16 max_mtu ;
254
285
u8 default_mac_addr [ETH_ALEN ];
@@ -269,6 +300,7 @@ struct idpf_vport {
269
300
* ethtool
270
301
* @num_req_rxq_desc: Number of user requested RX queue descriptors through
271
302
* ethtool
303
+ * @mac_filter_list: List of MAC filters
272
304
*
273
305
* Used to restore configuration after a reset as the vport will get wiped.
274
306
*/
@@ -277,17 +309,22 @@ struct idpf_vport_user_config_data {
277
309
u16 num_req_rx_qs ;
278
310
u32 num_req_txq_desc ;
279
311
u32 num_req_rxq_desc ;
312
+ struct list_head mac_filter_list ;
280
313
};
281
314
282
315
/**
283
316
* enum idpf_vport_config_flags - Vport config flags
284
317
* @IDPF_VPORT_REG_NETDEV: Register netdev
285
318
* @IDPF_VPORT_UP_REQUESTED: Set if interface up is requested on core reset
319
+ * @IDPF_VPORT_ADD_MAC_REQ: Asynchronous add ether address in flight
320
+ * @IDPF_VPORT_DEL_MAC_REQ: Asynchronous delete ether address in flight
286
321
* @IDPF_VPORT_CONFIG_FLAGS_NBITS: Must be last
287
322
*/
288
323
enum idpf_vport_config_flags {
289
324
IDPF_VPORT_REG_NETDEV ,
290
325
IDPF_VPORT_UP_REQUESTED ,
326
+ IDPF_VPORT_ADD_MAC_REQ ,
327
+ IDPF_VPORT_DEL_MAC_REQ ,
291
328
IDPF_VPORT_CONFIG_FLAGS_NBITS ,
292
329
};
293
330
@@ -335,11 +372,13 @@ struct idpf_vector_lifo {
335
372
* struct idpf_vport_config - Vport configuration data
336
373
* @user_config: see struct idpf_vport_user_config_data
337
374
* @max_q: Maximum possible queues
375
+ * @mac_filter_list_lock: Lock to protect mac filters
338
376
* @flags: See enum idpf_vport_config_flags
339
377
*/
340
378
struct idpf_vport_config {
341
379
struct idpf_vport_user_config_data user_config ;
342
380
struct idpf_vport_max_q max_q ;
381
+ spinlock_t mac_filter_list_lock ;
343
382
DECLARE_BITMAP (flags , IDPF_VPORT_CONFIG_FLAGS_NBITS );
344
383
};
345
384
@@ -592,6 +631,7 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter);
592
631
int idpf_intr_req (struct idpf_adapter * adapter );
593
632
void idpf_intr_rel (struct idpf_adapter * adapter );
594
633
int idpf_send_destroy_vport_msg (struct idpf_vport * vport );
634
+ int idpf_send_get_rx_ptype_msg (struct idpf_vport * vport );
595
635
int idpf_send_dealloc_vectors_msg (struct idpf_adapter * adapter );
596
636
int idpf_send_alloc_vectors_msg (struct idpf_adapter * adapter , u16 num_vectors );
597
637
void idpf_deinit_task (struct idpf_adapter * adapter );
@@ -606,9 +646,13 @@ int idpf_vport_alloc_max_qs(struct idpf_adapter *adapter,
606
646
struct idpf_vport_max_q * max_q );
607
647
void idpf_vport_dealloc_max_qs (struct idpf_adapter * adapter ,
608
648
struct idpf_vport_max_q * max_q );
649
+ int idpf_add_del_mac_filters (struct idpf_vport * vport ,
650
+ struct idpf_netdev_priv * np ,
651
+ bool add , bool async );
609
652
void idpf_vport_init (struct idpf_vport * vport , struct idpf_vport_max_q * max_q );
610
653
u32 idpf_get_vport_id (struct idpf_vport * vport );
611
654
int idpf_send_create_vport_msg (struct idpf_adapter * adapter ,
612
655
struct idpf_vport_max_q * max_q );
656
+ int idpf_check_supported_desc_ids (struct idpf_vport * vport );
613
657
614
658
#endif /* !_IDPF_H_ */
0 commit comments