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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/mac_impl.h
          +++ new/usr/src/uts/common/sys/mac_impl.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright (c) 2017, Joyent, Inc.
       23 + * Copyright (c) 2018, Joyent, Inc.
  24   24   */
  25   25  
  26   26  #ifndef _SYS_MAC_IMPL_H
  27   27  #define _SYS_MAC_IMPL_H
  28   28  
  29   29  #include <sys/cpupart.h>
  30   30  #include <sys/modhash.h>
  31   31  #include <sys/mac_client.h>
  32   32  #include <sys/mac_provider.h>
  33   33  #include <sys/note.h>
↓ open down ↓ 203 lines elided ↑ open up ↑
 237  237          (mr)->mr_flag &= ~flag;
 238  238  
 239  239  /*
 240  240   * Reference hold and release on mac_ring_t 'mr'
 241  241   */
 242  242  #define MR_REFHOLD_LOCKED(mr)           {               \
 243  243          ASSERT(MUTEX_HELD(&mr->mr_lock));               \
 244  244          (mr)->mr_refcnt++;                              \
 245  245  }
 246  246  
 247      -#define MR_REFRELE(mr)          {                       \
      247 +#define MR_REFRELE(mr)          {                       \
 248  248          mutex_enter(&(mr)->mr_lock);                    \
 249  249          ASSERT((mr)->mr_refcnt != 0);                   \
 250  250          (mr)->mr_refcnt--;                              \
 251  251          if ((mr)->mr_refcnt == 0 &&                     \
 252  252              ((mr)->mr_flag & (MR_CONDEMNED | MR_QUIESCE))) \
 253  253                  cv_signal(&(mr)->mr_cv);                \
 254  254          mutex_exit(&(mr)->mr_lock);                     \
 255  255  }
 256  256  
 257  257  /*
 258      - * Per mac client flow information associated with a RX group.
 259      - * The entire structure is SL protected.
      258 + * Used to attach MAC clients to an Rx group. The members are SL
      259 + * protected.
 260  260   */
 261  261  typedef struct mac_grp_client {
 262  262          struct mac_grp_client           *mgc_next;
 263  263          struct mac_client_impl_s        *mgc_client;
 264  264  } mac_grp_client_t;
 265  265  
 266  266  #define MAC_GROUP_NO_CLIENT(g)  ((g)->mrg_clients == NULL)
 267  267  
 268  268  #define MAC_GROUP_ONLY_CLIENT(g)                        \
 269  269          ((((g)->mrg_clients != NULL) &&                 \
 270  270          ((g)->mrg_clients->mgc_next == NULL)) ?         \
 271  271          (g)->mrg_clients->mgc_client : NULL)
 272  272  
      273 +#define MAC_GROUP_HW_VLAN(g)                            \
      274 +        (((g) != NULL) &&                               \
      275 +        ((g)->mrg_info.mgi_addvlan != NULL) &&          \
      276 +        ((g)->mrg_info.mgi_remvlan != NULL))
      277 +
 273  278  /*
 274  279   * Common ring group data structure for ring control and management.
 275      - * The entire structure is SL protected
      280 + * The entire structure is SL protected.
 276  281   */
 277  282  struct mac_group_s {
 278  283          int                     mrg_index;      /* index in the list */
 279  284          mac_ring_type_t         mrg_type;       /* ring type */
 280  285          mac_group_state_t       mrg_state;      /* state of the group */
 281      -        mac_group_t             *mrg_next;      /* next ring in the chain */
      286 +        mac_group_t             *mrg_next;      /* next group in the chain */
 282  287          mac_handle_t            mrg_mh;         /* reference to MAC */
 283  288          mac_ring_t              *mrg_rings;     /* grouped rings */
 284  289          uint_t                  mrg_cur_count;  /* actual size of group */
 285  290  
 286  291          mac_grp_client_t        *mrg_clients;   /* clients list */
 287  292  
 288  293          mac_group_info_t        mrg_info;       /* driver supplied info */
 289  294  };
 290  295  
 291  296  #define mrg_driver              mrg_info.mgi_driver
↓ open down ↓ 1 lines elided ↑ open up ↑
 293  298  #define mrg_stop                mrg_info.mgi_stop
 294  299  
 295  300  #define GROUP_INTR_HANDLE(g)            (g)->mrg_info.mgi_intr.mi_handle
 296  301  #define GROUP_INTR_ENABLE_FUNC(g)       (g)->mrg_info.mgi_intr.mi_enable
 297  302  #define GROUP_INTR_DISABLE_FUNC(g)      (g)->mrg_info.mgi_intr.mi_disable
 298  303  
 299  304  #define MAC_RING_TX(mhp, rh, mp, rest) {                                \
 300  305          mac_ring_handle_t mrh = rh;                                     \
 301  306          mac_impl_t *mimpl = (mac_impl_t *)mhp;                          \
 302  307          /*                                                              \
 303      -         * Send packets through a selected tx ring, or through the      \
      308 +         * Send packets through a selected tx ring, or through the      \
 304  309           * default handler if there is no selected ring.                \
 305  310           */                                                             \
 306  311          if (mrh == NULL)                                                \
 307  312                  mrh = mimpl->mi_default_tx_ring;                        \
 308  313          if (mrh == NULL) {                                              \
 309  314                  rest = mimpl->mi_tx(mimpl->mi_driver, mp);              \
 310  315          } else {                                                        \
 311  316                  rest = mac_hwring_tx(mrh, mp);                          \
 312  317          }                                                               \
 313  318  }
↓ open down ↓ 1 lines elided ↑ open up ↑
 315  320  /*
 316  321   * This is the final stop before reaching the underlying driver
 317  322   * or aggregation, so this is where the bridging hook is implemented.
 318  323   * Packets that are bridged will return through mac_bridge_tx(), with
 319  324   * rh nulled out if the bridge chooses to send output on a different
 320  325   * link due to forwarding.
 321  326   */
 322  327  #define MAC_TX(mip, rh, mp, src_mcip) {                                 \
 323  328          mac_ring_handle_t       rhandle = (rh);                         \
 324  329          /*                                                              \
 325      -         * If there is a bound Hybrid I/O share, send packets through   \
      330 +         * If there is a bound Hybrid I/O share, send packets through   \
 326  331           * the default tx ring. (When there's a bound Hybrid I/O share, \
 327      -         * the tx rings of this client are mapped in the guest domain   \
      332 +         * the tx rings of this client are mapped in the guest domain   \
 328  333           * and not accessible from here.)                               \
 329  334           */                                                             \
 330  335          _NOTE(CONSTANTCONDITION)                                        \
 331  336          if ((src_mcip)->mci_state_flags & MCIS_SHARE_BOUND)             \
 332  337                  rhandle = (mip)->mi_default_tx_ring;                    \
 333  338          if (mip->mi_promisc_list != NULL)                               \
 334  339                  mac_promisc_dispatch(mip, mp, src_mcip);                \
 335  340          /*                                                              \
 336      -         * Grab the proper transmit pointer and handle. Special         \
      341 +         * Grab the proper transmit pointer and handle. Special         \
 337  342           * optimization: we can test mi_bridge_link itself atomically,  \
 338  343           * and if that indicates no bridge send packets through tx ring.\
 339  344           */                                                             \
 340  345          if (mip->mi_bridge_link == NULL) {                              \
 341  346                  MAC_RING_TX(mip, rhandle, mp, mp);                      \
 342  347          } else {                                                        \
 343  348                  mp = mac_bridge_tx(mip, rhandle, mp);                   \
 344  349          }                                                               \
 345  350  }
 346  351  
↓ open down ↓ 6 lines elided ↑ open up ↑
 353  358          struct mac_client_impl_s        *mfa_client;
 354  359  } mac_factory_addr_t;
 355  360  
 356  361  typedef struct mac_mcast_addrs_s {
 357  362          struct mac_mcast_addrs_s        *mma_next;
 358  363          uint8_t                         mma_addr[MAXMACADDRLEN];
 359  364          int                             mma_ref;
 360  365  } mac_mcast_addrs_t;
 361  366  
 362  367  typedef enum {
 363      -        MAC_ADDRESS_TYPE_UNICAST_CLASSIFIED = 1,        /* hardware steering */
      368 +        MAC_ADDRESS_TYPE_UNICAST_CLASSIFIED = 1,        /* HW classification */
 364  369          MAC_ADDRESS_TYPE_UNICAST_PROMISC                /* promiscuous mode */
 365  370  } mac_address_type_t;
 366  371  
      372 +typedef struct mac_vlan_s {
      373 +        struct mac_vlan_s       *mv_next;
      374 +        uint16_t                mv_vid;
      375 +} mac_vlan_t;
      376 +
 367  377  typedef struct mac_address_s {
 368  378          mac_address_type_t      ma_type;                /* address type */
 369      -        int                     ma_nusers;              /* number of users */
 370      -                                                        /* of that address */
      379 +        int                     ma_nusers;              /* num users of addr */
 371  380          struct mac_address_s    *ma_next;               /* next address */
 372  381          uint8_t                 ma_addr[MAXMACADDRLEN]; /* address value */
 373  382          size_t                  ma_len;                 /* address length */
      383 +        mac_vlan_t              *ma_vlans;              /* VLANs on this addr */
      384 +        boolean_t               ma_untagged;            /* accept untagged? */
 374  385          mac_group_t             *ma_group;              /* asscociated group */
 375  386          mac_impl_t              *ma_mip;                /* MAC handle */
 376  387  } mac_address_t;
 377  388  
 378  389  extern krwlock_t i_mac_impl_lock;
 379  390  extern mod_hash_t *i_mac_impl_hash;
 380  391  extern kmem_cache_t *i_mac_impl_cachep;
 381  392  extern uint_t i_mac_impl_count;
 382  393  
 383  394  /*
↓ open down ↓ 96 lines elided ↑ open up ↑
 480  491           */
 481  492          mac_capab_transceiver_t mi_transceiver;
 482  493  
 483  494          /*
 484  495           * LED Capability information. SL protected.
 485  496           */
 486  497          mac_led_mode_t          mi_led_modes;
 487  498          mac_capab_led_t         mi_led;
 488  499  
 489  500          /*
 490      -         * MAC address list. SL protected.
      501 +         * MAC address and VLAN lists. SL protected.
 491  502           */
 492  503          mac_address_t           *mi_addresses;
 493  504  
 494  505          /*
 495  506           * This MAC's table of sub-flows
 496  507           */
 497  508          flow_tab_t              *mi_flow_tab;           /* WO */
 498  509  
 499  510          kstat_t                 *mi_ksp;                /* WO */
 500  511          uint_t                  mi_kstat_count;         /* WO */
↓ open down ↓ 251 lines elided ↑ open up ↑
 752  763  extern void mac_bcast_refresh(mac_impl_t *, mac_multicst_t, void *,
 753  764      boolean_t);
 754  765  extern void mac_client_bcast_refresh(mac_client_impl_t *, mac_multicst_t,
 755  766      void *, boolean_t);
 756  767  
 757  768  /*
 758  769   * Grouping functions are used internally by MAC layer.
 759  770   */
 760  771  extern int mac_group_addmac(mac_group_t *, const uint8_t *);
 761  772  extern int mac_group_remmac(mac_group_t *, const uint8_t *);
      773 +extern int mac_group_addvlan(mac_group_t *, uint16_t);
      774 +extern int mac_group_remvlan(mac_group_t *, uint16_t);
 762  775  extern int mac_rx_group_add_flow(mac_client_impl_t *, flow_entry_t *,
 763  776      mac_group_t *);
 764  777  extern mblk_t *mac_hwring_tx(mac_ring_handle_t, mblk_t *);
 765  778  extern mblk_t *mac_bridge_tx(mac_impl_t *, mac_ring_handle_t, mblk_t *);
 766  779  extern mac_group_t *mac_reserve_rx_group(mac_client_impl_t *, uint8_t *,
 767  780      boolean_t);
 768  781  extern void mac_release_rx_group(mac_client_impl_t *, mac_group_t *);
 769  782  extern int mac_rx_switch_group(mac_client_impl_t *, mac_group_t *,
 770  783      mac_group_t *);
 771  784  extern mac_ring_t *mac_reserve_tx_ring(mac_impl_t *, mac_ring_t *);
 772  785  extern mac_group_t *mac_reserve_tx_group(mac_client_impl_t *, boolean_t);
 773  786  extern void mac_release_tx_group(mac_client_impl_t *, mac_group_t *);
 774  787  extern void mac_tx_switch_group(mac_client_impl_t *, mac_group_t *,
 775  788      mac_group_t *);
 776  789  extern void mac_rx_switch_grp_to_sw(mac_group_t *);
 777  790  
 778  791  /*
 779  792   * MAC address functions are used internally by MAC layer.
 780  793   */
 781  794  extern mac_address_t *mac_find_macaddr(mac_impl_t *, uint8_t *);
      795 +extern mac_address_t *mac_find_macaddr_vlan(mac_impl_t *, uint8_t *, uint16_t);
 782  796  extern boolean_t mac_check_macaddr_shared(mac_address_t *);
 783  797  extern int mac_update_macaddr(mac_address_t *, uint8_t *);
 784  798  extern void mac_freshen_macaddr(mac_address_t *, uint8_t *);
 785  799  extern void mac_retrieve_macaddr(mac_address_t *, uint8_t *);
 786  800  extern void mac_init_macaddr(mac_impl_t *);
 787  801  extern void mac_fini_macaddr(mac_impl_t *);
 788  802  
 789  803  /*
 790  804   * Flow construction/destruction routines.
 791  805   * Not meant to be used by mac clients.
↓ open down ↓ 64 lines elided ↑ open up ↑
 856  870  extern void mac_register_priv_prop(mac_impl_t *, char **);
 857  871  extern void mac_unregister_priv_prop(mac_impl_t *);
 858  872  extern int mac_init_rings(mac_impl_t *, mac_ring_type_t);
 859  873  extern void mac_free_rings(mac_impl_t *, mac_ring_type_t);
 860  874  extern void mac_compare_ddi_handle(mac_group_t *, uint_t, mac_ring_t *);
 861  875  
 862  876  extern int mac_start_group(mac_group_t *);
 863  877  extern void mac_stop_group(mac_group_t *);
 864  878  extern int mac_start_ring(mac_ring_t *);
 865  879  extern void mac_stop_ring(mac_ring_t *);
 866      -extern int mac_add_macaddr(mac_impl_t *, mac_group_t *, uint8_t *, boolean_t);
 867      -extern int mac_remove_macaddr(mac_address_t *);
      880 +extern int mac_add_macaddr_vlan(mac_impl_t *, mac_group_t *, uint8_t *,
      881 +    uint16_t, boolean_t);
      882 +extern int mac_remove_macaddr_vlan(mac_address_t *, uint16_t);
 868  883  
 869  884  extern void mac_set_group_state(mac_group_t *, mac_group_state_t);
 870  885  extern void mac_group_add_client(mac_group_t *, mac_client_impl_t *);
 871  886  extern void mac_group_remove_client(mac_group_t *, mac_client_impl_t *);
 872  887  
 873  888  extern int i_mac_group_add_ring(mac_group_t *, mac_ring_t *, int);
 874  889  extern void i_mac_group_rem_ring(mac_group_t *, mac_ring_t *, boolean_t);
 875  890  extern int mac_group_ring_modify(mac_client_impl_t *, mac_group_t *,
 876  891      mac_group_t *);
 877  892  extern void mac_poll_state_change(mac_handle_t, boolean_t);
↓ open down ↓ 63 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX