225
226 /*
227 * Flags for mc_callbacks. Requiring drivers to set the flags associated
228 * with optional callbacks initialized in the structure allows the mac
229 * module to add optional callbacks in the future without requiring drivers
230 * to recompile.
231 */
232 #define MC_RESERVED 0x0001
233 #define MC_IOCTL 0x0002
234 #define MC_GETCAPAB 0x0004
235 #define MC_OPEN 0x0008
236 #define MC_CLOSE 0x0010
237 #define MC_SETPROP 0x0020
238 #define MC_GETPROP 0x0040
239 #define MC_PROPINFO 0x0080
240 #define MC_PROPERTIES (MC_SETPROP | MC_GETPROP | MC_PROPINFO)
241
242 /*
243 * Virtualization Capabilities
244 */
245 /*
246 * The ordering of entries below is important. MAC_HW_CLASSIFIER
247 * is the cutoff below which are entries which don't depend on
248 * H/W. MAC_HW_CLASSIFIER and entries after that are cases where
249 * H/W has been updated through add/modify/delete APIs.
250 */
251 typedef enum {
252 MAC_NO_CLASSIFIER = 0,
253 MAC_SW_CLASSIFIER,
254 MAC_HW_CLASSIFIER
255 } mac_classify_type_t;
256
257 typedef void (*mac_rx_func_t)(void *, mac_resource_handle_t, mblk_t *,
258 boolean_t);
259
260 /*
261 * The virtualization level conveys the extent of the NIC hardware assistance
262 * for traffic steering employed for virtualization:
263 *
264 * MAC_VIRT_NONE: No assist for v12n.
265 *
266 * MAC_VIRT_LEVEL1: Multiple Rx rings with MAC address level
267 * classification between groups of rings.
268 * Requires the support of the MAC_CAPAB_RINGS
269 * capability.
270 *
271 * MAC_VIRT_HIO: Hybrid I/O capable MAC. Require the support
272 * of the MAC_CAPAB_SHARES capability.
273 */
274 #define MAC_VIRT_NONE 0x0
347 * Common ring functions and driver interfaces
348 */
349 typedef int (*mac_ring_start_t)(mac_ring_driver_t, uint64_t);
350 typedef void (*mac_ring_stop_t)(mac_ring_driver_t);
351
352 typedef mblk_t *(*mac_ring_send_t)(void *, mblk_t *);
353 typedef mblk_t *(*mac_ring_poll_t)(void *, int);
354
355 typedef int (*mac_ring_stat_t)(mac_ring_driver_t, uint_t, uint64_t *);
356
357 typedef struct mac_ring_info_s {
358 mac_ring_driver_t mri_driver;
359 mac_ring_start_t mri_start;
360 mac_ring_stop_t mri_stop;
361 mac_intr_t mri_intr;
362 union {
363 mac_ring_send_t send;
364 mac_ring_poll_t poll;
365 } mrfunion;
366 mac_ring_stat_t mri_stat;
367 /*
368 * mri_flags will have some bits set to indicate some special
369 * property/feature of a ring like serialization needed for a
370 * Tx ring or packets should always need enqueuing on Rx side,
371 * etc.
372 */
373 uint_t mri_flags;
374 } mac_ring_info_s;
375
376 #define mri_tx mrfunion.send
377 #define mri_poll mrfunion.poll
378
379 /*
380 * #defines for mri_flags. The flags are temporary flags that are provided
381 * only to workaround issues in specific drivers, and they will be
382 * removed in the future.
383 *
384 * These are consumed only by sun4v and neptune (nxge).
385 */
386 #define MAC_RING_TX_SERIALIZE 0x1
|
225
226 /*
227 * Flags for mc_callbacks. Requiring drivers to set the flags associated
228 * with optional callbacks initialized in the structure allows the mac
229 * module to add optional callbacks in the future without requiring drivers
230 * to recompile.
231 */
232 #define MC_RESERVED 0x0001
233 #define MC_IOCTL 0x0002
234 #define MC_GETCAPAB 0x0004
235 #define MC_OPEN 0x0008
236 #define MC_CLOSE 0x0010
237 #define MC_SETPROP 0x0020
238 #define MC_GETPROP 0x0040
239 #define MC_PROPINFO 0x0080
240 #define MC_PROPERTIES (MC_SETPROP | MC_GETPROP | MC_PROPINFO)
241
242 /*
243 * Virtualization Capabilities
244 */
245
246 /*
247 * The type of ring classification. This is used by MAC to determine
248 * what, if any, processing it has to do upon receiving traffic on a
249 * particular Rx ring.
250 *
251 * MAC_NO_CLASSIFIER
252 *
253 * No classification has been set. No traffic should cross an Rx
254 * ring in this state.
255 *
256 * MAC_SW_CLASSIFIER
257 *
258 * The driver delivers traffic for multiple clients to this ring.
259 * All traffic must be software classified by MAC to guarantee
260 * delivery to the correct client. This classification type may
261 * be chosen for several reasons.
262 *
263 * o The driver provides only one group and there are multiple
264 * clients using the MAC.
265 *
266 * o The driver provides some hardware filtering but not enough
267 * to fully classify the traffic. E.g., a VLAN VNIC requires L2
268 * unicast address filtering as well as VLAN filtering, but
269 * some drivers may only support the former.
270 *
271 * o The ring belongs to the default group. The default group
272 * acts as a spillover for all clients that can't reserve an
273 * exclusive group. It also handles multicast traffic for all
274 * clients. For these reasons, the default group's rings are
275 * always software classified.
276 *
277 * MAC_HW_CLASSIFIER
278 *
279 * The driver delivers traffic for a single MAC client across
280 * this ring. With this guarantee, MAC can simply pass the
281 * traffic up the stack or even allow polling of the ring.
282 *
283 * MAC_PASSTHRU_CLASSIFIER
284 *
285 * The ring is in "passthru" mode. In this mode we bypass all of
286 * the typical MAC processing and pass the traffic directly to
287 * the mr_pt_fn callback, see mac_rx_common(). This is used in
288 * cases where there is another module acting as MAC provider on
289 * behalf of the driver. E.g., link aggregations use this mode to
290 * take full control of the port's rings; allowing it to enforce
291 * LACP protocols and aggregate rings across discrete drivers.
292 */
293 typedef enum {
294 MAC_NO_CLASSIFIER = 0,
295 MAC_SW_CLASSIFIER,
296 MAC_HW_CLASSIFIER,
297 MAC_PASSTHRU_CLASSIFIER
298 } mac_classify_type_t;
299
300 typedef void (*mac_rx_func_t)(void *, mac_resource_handle_t, mblk_t *,
301 boolean_t);
302
303 /*
304 * The virtualization level conveys the extent of the NIC hardware assistance
305 * for traffic steering employed for virtualization:
306 *
307 * MAC_VIRT_NONE: No assist for v12n.
308 *
309 * MAC_VIRT_LEVEL1: Multiple Rx rings with MAC address level
310 * classification between groups of rings.
311 * Requires the support of the MAC_CAPAB_RINGS
312 * capability.
313 *
314 * MAC_VIRT_HIO: Hybrid I/O capable MAC. Require the support
315 * of the MAC_CAPAB_SHARES capability.
316 */
317 #define MAC_VIRT_NONE 0x0
390 * Common ring functions and driver interfaces
391 */
392 typedef int (*mac_ring_start_t)(mac_ring_driver_t, uint64_t);
393 typedef void (*mac_ring_stop_t)(mac_ring_driver_t);
394
395 typedef mblk_t *(*mac_ring_send_t)(void *, mblk_t *);
396 typedef mblk_t *(*mac_ring_poll_t)(void *, int);
397
398 typedef int (*mac_ring_stat_t)(mac_ring_driver_t, uint_t, uint64_t *);
399
400 typedef struct mac_ring_info_s {
401 mac_ring_driver_t mri_driver;
402 mac_ring_start_t mri_start;
403 mac_ring_stop_t mri_stop;
404 mac_intr_t mri_intr;
405 union {
406 mac_ring_send_t send;
407 mac_ring_poll_t poll;
408 } mrfunion;
409 mac_ring_stat_t mri_stat;
410
411 /*
412 * mri_flags will have some bits set to indicate some special
413 * property/feature of a ring like serialization needed for a
414 * Tx ring or packets should always need enqueuing on Rx side,
415 * etc.
416 */
417 uint_t mri_flags;
418 } mac_ring_info_s;
419
420 #define mri_tx mrfunion.send
421 #define mri_poll mrfunion.poll
422
423 /*
424 * #defines for mri_flags. The flags are temporary flags that are provided
425 * only to workaround issues in specific drivers, and they will be
426 * removed in the future.
427 *
428 * These are consumed only by sun4v and neptune (nxge).
429 */
430 #define MAC_RING_TX_SERIALIZE 0x1
|