Print this page
11490 SRS ring polling disabled for VLANs
11491 Want DLS bypass for VLAN traffic
11492 add VLVF bypass to ixgbe core
2869 duplicate packets with vnics over aggrs
11489 DLS stat delete and aggr kstat can deadlock
Portions contributed by: Theo Schlossnagle <jesus@omniti.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2017, Joyent, Inc.
  25  */
  26 
  27 #ifndef _SYS_MAC_PROVIDER_H
  28 #define _SYS_MAC_PROVIDER_H
  29 
  30 #include <sys/types.h>
  31 #include <sys/ddi.h>
  32 #include <sys/sunddi.h>
  33 #include <sys/stream.h>
  34 #include <sys/mkdev.h>
  35 #include <sys/mac.h>
  36 #include <sys/mac_flow.h>
  37 
  38 /*
  39  * MAC Provider Interface
  40  */
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif


 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
 275 #define MAC_VIRT_LEVEL1         0x1
 276 #define MAC_VIRT_HIO            0x2
 277 
 278 typedef enum {
 279         MAC_RING_TYPE_RX = 1,   /* Receive ring */
 280         MAC_RING_TYPE_TX        /* Transmit ring */
 281 } mac_ring_type_t;
 282 
 283 /*






















 284  * Grouping type of a ring group
 285  *
 286  * MAC_GROUP_TYPE_STATIC: The ring group can not be re-grouped.
 287  * MAC_GROUP_TYPE_DYNAMIC: The ring group support dynamic re-grouping
 288  */
 289 typedef enum {
 290         MAC_GROUP_TYPE_STATIC = 1,      /* Static ring group */
 291         MAC_GROUP_TYPE_DYNAMIC          /* Dynamic ring group */
 292 } mac_group_type_t;
 293 
 294 typedef struct __mac_ring_driver        *mac_ring_driver_t;
 295 typedef struct __mac_group_driver       *mac_group_driver_t;
 296 
 297 typedef struct mac_ring_info_s mac_ring_info_t;
 298 typedef struct mac_group_info_s mac_group_info_t;
 299 
 300 typedef void    (*mac_get_ring_t)(void *, mac_ring_type_t, const int, const int,
 301     mac_ring_info_t *, mac_ring_handle_t);
 302 typedef void    (*mac_get_group_t)(void *, mac_ring_type_t, const int,
 303     mac_group_info_t *, mac_group_handle_t);


 341                 mac_ring_send_t send;
 342                 mac_ring_poll_t poll;
 343         } mrfunion;
 344         mac_ring_stat_t         mri_stat;
 345         /*
 346          * mri_flags will have some bits set to indicate some special
 347          * property/feature of a ring like serialization needed for a
 348          * Tx ring or packets should always need enqueuing on Rx side,
 349          * etc.
 350          */
 351         uint_t                  mri_flags;
 352 } mac_ring_info_s;
 353 
 354 #define mri_tx                  mrfunion.send
 355 #define mri_poll                mrfunion.poll
 356 
 357 /*
 358  * #defines for mri_flags. The flags are temporary flags that are provided
 359  * only to workaround issues in specific drivers, and they will be
 360  * removed in the future.


 361  */
 362 #define MAC_RING_TX_SERIALIZE           0x1
 363 #define MAC_RING_RX_ENQUEUE             0x2
 364 
 365 typedef int     (*mac_group_start_t)(mac_group_driver_t);
 366 typedef void    (*mac_group_stop_t)(mac_group_driver_t);
 367 typedef int     (*mac_add_mac_addr_t)(void *, const uint8_t *);
 368 typedef int     (*mac_rem_mac_addr_t)(void *, const uint8_t *);


 369 
 370 struct mac_group_info_s {
 371         mac_group_driver_t      mgi_driver;     /* Driver reference */
 372         mac_group_start_t       mgi_start;      /* Start the group */
 373         mac_group_stop_t        mgi_stop;       /* Stop the group */
 374         uint_t                  mgi_count;      /* Count of rings */
 375         mac_intr_t              mgi_intr;       /* Optional per-group intr */
 376 
 377         /* Only used for rx groups */
 378         mac_add_mac_addr_t      mgi_addmac;     /* Add a MAC address */
 379         mac_rem_mac_addr_t      mgi_remmac;     /* Remove a MAC address */


 380 };
 381 
 382 /*
 383  * Share management functions.
 384  */
 385 typedef uint64_t mac_share_handle_t;
 386 
 387 /*
 388  * Allocate and free a share. Returns ENOSPC if all shares have been
 389  * previously allocated.
 390  */
 391 typedef int (*mac_alloc_share_t)(void *, mac_share_handle_t *);
 392 typedef void (*mac_free_share_t)(mac_share_handle_t);
 393 
 394 /*
 395  * Bind and unbind a share. Binding a share allows a domain
 396  * to have direct access to the groups and rings associated with
 397  * that share.
 398  */
 399 typedef int (*mac_bind_share_t)(mac_share_handle_t, uint64_t, uint64_t *);




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2018, Joyent, Inc.
  25  */
  26 
  27 #ifndef _SYS_MAC_PROVIDER_H
  28 #define _SYS_MAC_PROVIDER_H
  29 
  30 #include <sys/types.h>
  31 #include <sys/ddi.h>
  32 #include <sys/sunddi.h>
  33 #include <sys/stream.h>
  34 #include <sys/mkdev.h>
  35 #include <sys/mac.h>
  36 #include <sys/mac_flow.h>
  37 
  38 /*
  39  * MAC Provider Interface
  40  */
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif


 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
 275 #define MAC_VIRT_LEVEL1         0x1
 276 #define MAC_VIRT_HIO            0x2
 277 
 278 typedef enum {
 279         MAC_RING_TYPE_RX = 1,   /* Receive ring */
 280         MAC_RING_TYPE_TX        /* Transmit ring */
 281 } mac_ring_type_t;
 282 
 283 /*
 284  * The value VLAN_ID_NONE (VID 0) means a client does not have
 285  * membership to any VLAN. However, this statement is true for both
 286  * untagged packets and priority tagged packets leading to confusion
 287  * over what semantic is intended. To the provider, VID 0 is a valid
 288  * VID when priority tagging is in play. To MAC and everything above
 289  * VLAN_ID_NONE almost universally implies untagged traffic. Thus, we
 290  * convert VLAN_ID_NONE to a sentinel value (MAC_VLAN_UNTAGGED) at the
 291  * border between MAC and MAC provider. This informs the provider that
 292  * the client is interested in untagged traffic and the provider
 293  * should set any relevant bits to receive such traffic.
 294  *
 295  * Currently, the API between MAC and the provider passes the VID as a
 296  * unit16_t. In the future this could actually be the entire TCI mask
 297  * (PCP, DEI, and VID). This current scheme is safe in that potential
 298  * future world as well; as 0xFFFF is not a valid TCI (the 0xFFF VID
 299  * is reserved and never transmitted across networks).
 300  */
 301 #define MAC_VLAN_UNTAGGED               UINT16_MAX
 302 #define MAC_VLAN_UNTAGGED_VID(vid)      \
 303         (((vid) == VLAN_ID_NONE) ? MAC_VLAN_UNTAGGED : (vid))
 304 
 305 /*
 306  * Grouping type of a ring group
 307  *
 308  * MAC_GROUP_TYPE_STATIC: The ring group can not be re-grouped.
 309  * MAC_GROUP_TYPE_DYNAMIC: The ring group support dynamic re-grouping
 310  */
 311 typedef enum {
 312         MAC_GROUP_TYPE_STATIC = 1,      /* Static ring group */
 313         MAC_GROUP_TYPE_DYNAMIC          /* Dynamic ring group */
 314 } mac_group_type_t;
 315 
 316 typedef struct __mac_ring_driver        *mac_ring_driver_t;
 317 typedef struct __mac_group_driver       *mac_group_driver_t;
 318 
 319 typedef struct mac_ring_info_s mac_ring_info_t;
 320 typedef struct mac_group_info_s mac_group_info_t;
 321 
 322 typedef void    (*mac_get_ring_t)(void *, mac_ring_type_t, const int, const int,
 323     mac_ring_info_t *, mac_ring_handle_t);
 324 typedef void    (*mac_get_group_t)(void *, mac_ring_type_t, const int,
 325     mac_group_info_t *, mac_group_handle_t);


 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
 387 #define MAC_RING_RX_ENQUEUE             0x2
 388 
 389 typedef int     (*mac_group_start_t)(mac_group_driver_t);
 390 typedef void    (*mac_group_stop_t)(mac_group_driver_t);
 391 typedef int     (*mac_add_mac_addr_t)(void *, const uint8_t *);
 392 typedef int     (*mac_rem_mac_addr_t)(void *, const uint8_t *);
 393 typedef int     (*mac_add_vlan_filter_t)(mac_group_driver_t, uint16_t);
 394 typedef int     (*mac_rem_vlan_filter_t)(mac_group_driver_t, uint16_t);
 395 
 396 struct mac_group_info_s {
 397         mac_group_driver_t      mgi_driver;     /* Driver reference */
 398         mac_group_start_t       mgi_start;      /* Start the group */
 399         mac_group_stop_t        mgi_stop;       /* Stop the group */
 400         uint_t                  mgi_count;      /* Count of rings */
 401         mac_intr_t              mgi_intr;       /* Optional per-group intr */
 402 
 403         /* Only used for Rx groups */
 404         mac_add_mac_addr_t      mgi_addmac;     /* Add a MAC address */
 405         mac_rem_mac_addr_t      mgi_remmac;     /* Remove a MAC address */
 406         mac_add_vlan_filter_t   mgi_addvlan;    /* Add a VLAN filter */
 407         mac_rem_vlan_filter_t   mgi_remvlan;    /* Remove a VLAN filter */
 408 };
 409 
 410 /*
 411  * Share management functions.
 412  */
 413 typedef uint64_t mac_share_handle_t;
 414 
 415 /*
 416  * Allocate and free a share. Returns ENOSPC if all shares have been
 417  * previously allocated.
 418  */
 419 typedef int (*mac_alloc_share_t)(void *, mac_share_handle_t *);
 420 typedef void (*mac_free_share_t)(mac_share_handle_t);
 421 
 422 /*
 423  * Bind and unbind a share. Binding a share allows a domain
 424  * to have direct access to the groups and rings associated with
 425  * that share.
 426  */
 427 typedef int (*mac_bind_share_t)(mac_share_handle_t, uint64_t, uint64_t *);