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  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.


  24  */
  25 
  26 #ifndef _SYS_AGGR_IMPL_H
  27 #define _SYS_AGGR_IMPL_H
  28 
  29 #include <sys/types.h>
  30 #include <sys/cred.h>
  31 #include <sys/mac_ether.h>
  32 #include <sys/mac_provider.h>
  33 #include <sys/mac_client.h>
  34 #include <sys/mac_client_priv.h>
  35 #include <sys/aggr_lacp.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 #ifdef _KERNEL
  42 
  43 #define AGGR_MINOR_CTL  1               /* control interface minor */
  44 
  45 /* flags for aggr_grp_modify() */
  46 #define AGGR_MODIFY_POLICY              0x01
  47 #define AGGR_MODIFY_MAC                 0x02
  48 #define AGGR_MODIFY_LACP_MODE           0x04
  49 #define AGGR_MODIFY_LACP_TIMER          0x08
  50 
  51 /*
  52  * Possible value of aggr_rseudo_rx_ring_t.arr_flags. Set when the ring entry
  53  * in the pseudo RX group is used.
  54  */
  55 #define MAC_PSEUDO_RING_INUSE   0x01
  56 









  57 typedef struct aggr_unicst_addr_s {
  58         uint8_t                         aua_addr[ETHERADDRL];
  59         struct aggr_unicst_addr_s       *aua_next;
  60 } aggr_unicst_addr_t;
  61 
  62 typedef struct aggr_pseudo_rx_ring_s {
  63         mac_ring_handle_t       arr_rh; /* filled in by aggr_fill_ring() */
  64         struct aggr_port_s      *arr_port;
  65         mac_ring_handle_t       arr_hw_rh;
  66         uint_t                  arr_flags;
  67         uint64_t                arr_gen;
  68 } aggr_pseudo_rx_ring_t;
  69 
  70 typedef struct aggr_pseudo_rx_group_s {
  71         struct aggr_grp_s       *arg_grp; /* filled in by aggr_fill_group() */
  72         mac_group_handle_t      arg_gh;   /* filled in by aggr_fill_group() */
  73         aggr_unicst_addr_t      *arg_macaddr;
  74         aggr_pseudo_rx_ring_t   arg_rings[MAX_RINGS_PER_GROUP];
  75         uint_t                  arg_ring_cnt;


  76 } aggr_pseudo_rx_group_t;
  77 
  78 typedef struct aggr_pseudo_tx_ring_s {
  79         mac_ring_handle_t       atr_rh; /* filled in by aggr_fill_ring() */
  80         struct aggr_port_s      *atr_port;
  81         mac_ring_handle_t       atr_hw_rh;
  82         uint_t                  atr_flags;
  83 } aggr_pseudo_tx_ring_t;
  84 
  85 typedef struct aggr_pseudo_tx_group_s {
  86         mac_group_handle_t      atg_gh; /* filled in by aggr_fill_group() */
  87         uint_t                  atg_ring_cnt;
  88         aggr_pseudo_tx_ring_t   atg_rings[MAX_RINGS_PER_GROUP];
  89 } aggr_pseudo_tx_group_t;
  90 
  91 /*
  92  * A link aggregation MAC port.
  93  * Note that lp_next is protected by the lg_lock of the group the
  94  * port is part of.
  95  */


 169                         lg_closing : 1,
 170                         lg_addr_fixed : 1,      /* fixed MAC address? */
 171                         lg_started : 1,         /* group started? */
 172                         lg_promisc : 1,         /* in promiscuous mode? */
 173                         lg_zcopy : 1,
 174                         lg_vlan : 1,
 175                         lg_force : 1,
 176                         lg_lso : 1,
 177                         lg_pad_bits : 8;
 178         aggr_port_t     *lg_ports;              /* list of configured ports */
 179         aggr_port_t     *lg_mac_addr_port;
 180         mac_handle_t    lg_mh;
 181         zoneid_t        lg_zoneid;
 182         uint_t          lg_nattached_ports;
 183         krwlock_t       lg_tx_lock;
 184         uint_t          lg_ntx_ports;
 185         aggr_port_t     **lg_tx_ports;          /* array of tx ports */
 186         uint_t          lg_tx_ports_size;       /* size of lg_tx_ports */
 187         uint32_t        lg_tx_policy;           /* outbound policy */
 188         uint8_t         lg_mac_tx_policy;
 189         uint64_t        lg_ifspeed;
 190         link_state_t    lg_link_state;







 191         link_duplex_t   lg_link_duplex;
 192         uint64_t        lg_stat[MAC_NSTAT];
 193         uint64_t        lg_ether_stat[ETHER_NSTAT];

 194         aggr_lacp_mode_t lg_lacp_mode;          /* off, active, or passive */
 195         Agg_t           aggr;                   /* 802.3ad data */
 196         uint32_t        lg_hcksum_txflags;
 197         uint_t          lg_max_sdu;
 198         uint32_t        lg_margin;
 199         mac_capab_lso_t lg_cap_lso;
 200 
 201         /*
 202          * The following fields are used by the LACP packets processing.
 203          * Specifically, as the LACP packets processing is not performance
 204          * critical, all LACP packets will be handled by a dedicated thread
 205          * instead of in the mac_rx() call. This is to avoid the dead lock
 206          * with mac_unicast_remove(), which holding the mac perimeter of the
 207          * aggr, and wait for the mr_refcnt of the RX ring to drop to zero.
 208          */
 209         kmutex_t        lg_lacp_lock;
 210         kcondvar_t      lg_lacp_cv;
 211         mblk_t          *lg_lacp_head;
 212         mblk_t          *lg_lacp_tail;
 213         kthread_t       *lg_lacp_rx_thread;


 291 extern void aggr_grp_multicst_port(aggr_port_t *, boolean_t);
 292 extern uint_t aggr_grp_count(void);
 293 extern void aggr_grp_update_default(aggr_grp_t *);
 294 
 295 extern void aggr_port_init(void);
 296 extern void aggr_port_fini(void);
 297 extern int aggr_port_create(aggr_grp_t *, const datalink_id_t, boolean_t,
 298     aggr_port_t **);
 299 extern void aggr_port_delete(aggr_port_t *);
 300 extern void aggr_port_free(aggr_port_t *);
 301 extern int aggr_port_start(aggr_port_t *);
 302 extern void aggr_port_stop(aggr_port_t *);
 303 extern int aggr_port_promisc(aggr_port_t *, boolean_t);
 304 extern int aggr_port_unicst(aggr_port_t *);
 305 extern int aggr_port_multicst(void *, boolean_t, const uint8_t *);
 306 extern uint64_t aggr_port_stat(aggr_port_t *, uint_t);
 307 extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *);
 308 extern void aggr_port_init_callbacks(aggr_port_t *);
 309 
 310 extern void aggr_recv_cb(void *, mac_resource_handle_t, mblk_t *, boolean_t);


 311 
 312 extern void aggr_tx_ring_update(void *, uintptr_t);
 313 extern void aggr_tx_notify_thread(void *);
 314 extern void aggr_send_port_enable(aggr_port_t *);
 315 extern void aggr_send_port_disable(aggr_port_t *);
 316 extern void aggr_send_update_policy(aggr_grp_t *, uint32_t);
 317 
 318 extern void aggr_lacp_init(void);
 319 extern void aggr_lacp_fini(void);
 320 extern void aggr_lacp_init_port(aggr_port_t *);
 321 extern void aggr_lacp_init_grp(aggr_grp_t *);
 322 extern void aggr_lacp_set_mode(aggr_grp_t *, aggr_lacp_mode_t,
 323     aggr_lacp_timer_t);
 324 extern void aggr_lacp_update_mode(aggr_grp_t *, aggr_lacp_mode_t);
 325 extern void aggr_lacp_update_timer(aggr_grp_t *, aggr_lacp_timer_t);
 326 extern void aggr_lacp_rx_enqueue(aggr_port_t *, mblk_t *);
 327 extern void aggr_lacp_port_attached(aggr_port_t *);
 328 extern void aggr_lacp_port_detached(aggr_port_t *);
 329 extern void aggr_port_lacp_set_mode(aggr_grp_t *, aggr_port_t *);
 330 
 331 extern void aggr_lacp_rx_thread(void *);
 332 extern void aggr_recv_lacp(aggr_port_t *, mac_resource_handle_t, mblk_t *);
 333 
 334 extern void aggr_grp_port_hold(aggr_port_t *);
 335 extern void aggr_grp_port_rele(aggr_port_t *);
 336 extern void aggr_grp_port_wait(aggr_grp_t *);
 337 
 338 extern int aggr_port_addmac(aggr_port_t *, const uint8_t *);
 339 extern void aggr_port_remmac(aggr_port_t *, const uint8_t *);
 340 



 341 extern mblk_t *aggr_ring_tx(void *, mblk_t *);
 342 extern mblk_t *aggr_find_tx_ring(void *, mblk_t *,
 343     uintptr_t, mac_ring_handle_t *);
 344 
 345 #endif  /* _KERNEL */
 346 
 347 #ifdef  __cplusplus
 348 }
 349 #endif
 350 
 351 #endif  /* _SYS_AGGR_IMPL_H */


   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  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright 2012 OmniTI Computer Consulting, Inc  All rights reserved.
  25  * Copyright 2018 Joyent, Inc.
  26  */
  27 
  28 #ifndef _SYS_AGGR_IMPL_H
  29 #define _SYS_AGGR_IMPL_H
  30 
  31 #include <sys/types.h>
  32 #include <sys/cred.h>
  33 #include <sys/mac_ether.h>
  34 #include <sys/mac_provider.h>
  35 #include <sys/mac_client.h>
  36 #include <sys/mac_client_priv.h>
  37 #include <sys/aggr_lacp.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 #ifdef _KERNEL
  44 
  45 #define AGGR_MINOR_CTL  1               /* control interface minor */
  46 
  47 /* flags for aggr_grp_modify() */
  48 #define AGGR_MODIFY_POLICY              0x01
  49 #define AGGR_MODIFY_MAC                 0x02
  50 #define AGGR_MODIFY_LACP_MODE           0x04
  51 #define AGGR_MODIFY_LACP_TIMER          0x08
  52 
  53 /*
  54  * Possible value of aggr_rseudo_rx_ring_t.arr_flags. Set when the ring entry
  55  * in the pseudo RX group is used.
  56  */
  57 #define MAC_PSEUDO_RING_INUSE   0x01
  58 
  59 /*
  60  * VLAN filters placed on the Rx pseudo group.
  61  */
  62 typedef struct aggr_vlan {
  63         list_node_t     av_link;
  64         uint16_t        av_vid;         /* VLAN ID */
  65         uint_t          av_refs;        /* num aggr clients using this VID */
  66 } aggr_vlan_t;
  67 
  68 typedef struct aggr_unicst_addr_s {
  69         uint8_t                         aua_addr[ETHERADDRL];
  70         struct aggr_unicst_addr_s       *aua_next;
  71 } aggr_unicst_addr_t;
  72 
  73 typedef struct aggr_pseudo_rx_ring_s {
  74         mac_ring_handle_t       arr_rh; /* filled in by aggr_fill_ring() */
  75         struct aggr_port_s      *arr_port;
  76         mac_ring_handle_t       arr_hw_rh;
  77         uint_t                  arr_flags;
  78         uint64_t                arr_gen;
  79 } aggr_pseudo_rx_ring_t;
  80 
  81 typedef struct aggr_pseudo_rx_group_s {
  82         struct aggr_grp_s       *arg_grp; /* filled in by aggr_fill_group() */
  83         mac_group_handle_t      arg_gh;   /* filled in by aggr_fill_group() */
  84         aggr_unicst_addr_t      *arg_macaddr;
  85         aggr_pseudo_rx_ring_t   arg_rings[MAX_RINGS_PER_GROUP];
  86         uint_t                  arg_ring_cnt;
  87         uint_t                  arg_untagged; /* num clients untagged */
  88         list_t                  arg_vlans;    /* VLANs on this group */
  89 } aggr_pseudo_rx_group_t;
  90 
  91 typedef struct aggr_pseudo_tx_ring_s {
  92         mac_ring_handle_t       atr_rh; /* filled in by aggr_fill_ring() */
  93         struct aggr_port_s      *atr_port;
  94         mac_ring_handle_t       atr_hw_rh;
  95         uint_t                  atr_flags;
  96 } aggr_pseudo_tx_ring_t;
  97 
  98 typedef struct aggr_pseudo_tx_group_s {
  99         mac_group_handle_t      atg_gh; /* filled in by aggr_fill_group() */
 100         uint_t                  atg_ring_cnt;
 101         aggr_pseudo_tx_ring_t   atg_rings[MAX_RINGS_PER_GROUP];
 102 } aggr_pseudo_tx_group_t;
 103 
 104 /*
 105  * A link aggregation MAC port.
 106  * Note that lp_next is protected by the lg_lock of the group the
 107  * port is part of.
 108  */


 182                         lg_closing : 1,
 183                         lg_addr_fixed : 1,      /* fixed MAC address? */
 184                         lg_started : 1,         /* group started? */
 185                         lg_promisc : 1,         /* in promiscuous mode? */
 186                         lg_zcopy : 1,
 187                         lg_vlan : 1,
 188                         lg_force : 1,
 189                         lg_lso : 1,
 190                         lg_pad_bits : 8;
 191         aggr_port_t     *lg_ports;              /* list of configured ports */
 192         aggr_port_t     *lg_mac_addr_port;
 193         mac_handle_t    lg_mh;
 194         zoneid_t        lg_zoneid;
 195         uint_t          lg_nattached_ports;
 196         krwlock_t       lg_tx_lock;
 197         uint_t          lg_ntx_ports;
 198         aggr_port_t     **lg_tx_ports;          /* array of tx ports */
 199         uint_t          lg_tx_ports_size;       /* size of lg_tx_ports */
 200         uint32_t        lg_tx_policy;           /* outbound policy */
 201         uint8_t         lg_mac_tx_policy;

 202         link_state_t    lg_link_state;
 203 
 204 
 205         /*
 206          * The lg_stat_lock must be held when accessing these fields.
 207          */
 208         kmutex_t        lg_stat_lock;
 209         uint64_t        lg_ifspeed;
 210         link_duplex_t   lg_link_duplex;
 211         uint64_t        lg_stat[MAC_NSTAT];
 212         uint64_t        lg_ether_stat[ETHER_NSTAT];
 213 
 214         aggr_lacp_mode_t lg_lacp_mode;          /* off, active, or passive */
 215         Agg_t           aggr;                   /* 802.3ad data */
 216         uint32_t        lg_hcksum_txflags;
 217         uint_t          lg_max_sdu;
 218         uint32_t        lg_margin;
 219         mac_capab_lso_t lg_cap_lso;
 220 
 221         /*
 222          * The following fields are used by the LACP packets processing.
 223          * Specifically, as the LACP packets processing is not performance
 224          * critical, all LACP packets will be handled by a dedicated thread
 225          * instead of in the mac_rx() call. This is to avoid the dead lock
 226          * with mac_unicast_remove(), which holding the mac perimeter of the
 227          * aggr, and wait for the mr_refcnt of the RX ring to drop to zero.
 228          */
 229         kmutex_t        lg_lacp_lock;
 230         kcondvar_t      lg_lacp_cv;
 231         mblk_t          *lg_lacp_head;
 232         mblk_t          *lg_lacp_tail;
 233         kthread_t       *lg_lacp_rx_thread;


 311 extern void aggr_grp_multicst_port(aggr_port_t *, boolean_t);
 312 extern uint_t aggr_grp_count(void);
 313 extern void aggr_grp_update_default(aggr_grp_t *);
 314 
 315 extern void aggr_port_init(void);
 316 extern void aggr_port_fini(void);
 317 extern int aggr_port_create(aggr_grp_t *, const datalink_id_t, boolean_t,
 318     aggr_port_t **);
 319 extern void aggr_port_delete(aggr_port_t *);
 320 extern void aggr_port_free(aggr_port_t *);
 321 extern int aggr_port_start(aggr_port_t *);
 322 extern void aggr_port_stop(aggr_port_t *);
 323 extern int aggr_port_promisc(aggr_port_t *, boolean_t);
 324 extern int aggr_port_unicst(aggr_port_t *);
 325 extern int aggr_port_multicst(void *, boolean_t, const uint8_t *);
 326 extern uint64_t aggr_port_stat(aggr_port_t *, uint_t);
 327 extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *);
 328 extern void aggr_port_init_callbacks(aggr_port_t *);
 329 
 330 extern void aggr_recv_cb(void *, mac_resource_handle_t, mblk_t *, boolean_t);
 331 extern void aggr_recv_promisc_cb(void *, mac_resource_handle_t, mblk_t *,
 332     boolean_t);
 333 
 334 extern void aggr_tx_ring_update(void *, uintptr_t);
 335 extern void aggr_tx_notify_thread(void *);
 336 extern void aggr_send_port_enable(aggr_port_t *);
 337 extern void aggr_send_port_disable(aggr_port_t *);
 338 extern void aggr_send_update_policy(aggr_grp_t *, uint32_t);
 339 
 340 extern void aggr_lacp_init(void);
 341 extern void aggr_lacp_fini(void);
 342 extern void aggr_lacp_init_port(aggr_port_t *);
 343 extern void aggr_lacp_init_grp(aggr_grp_t *);
 344 extern void aggr_lacp_set_mode(aggr_grp_t *, aggr_lacp_mode_t,
 345     aggr_lacp_timer_t);
 346 extern void aggr_lacp_update_mode(aggr_grp_t *, aggr_lacp_mode_t);
 347 extern void aggr_lacp_update_timer(aggr_grp_t *, aggr_lacp_timer_t);
 348 extern void aggr_lacp_rx_enqueue(aggr_port_t *, mblk_t *);
 349 extern void aggr_lacp_port_attached(aggr_port_t *);
 350 extern void aggr_lacp_port_detached(aggr_port_t *);
 351 extern void aggr_port_lacp_set_mode(aggr_grp_t *, aggr_port_t *);
 352 
 353 extern void aggr_lacp_rx_thread(void *);
 354 extern void aggr_recv_lacp(aggr_port_t *, mac_resource_handle_t, mblk_t *);
 355 
 356 extern void aggr_grp_port_hold(aggr_port_t *);
 357 extern void aggr_grp_port_rele(aggr_port_t *);
 358 extern void aggr_grp_port_wait(aggr_grp_t *);
 359 
 360 extern int aggr_port_addmac(aggr_port_t *, const uint8_t *);
 361 extern void aggr_port_remmac(aggr_port_t *, const uint8_t *);
 362 
 363 extern int aggr_port_addvlan(aggr_port_t *, uint16_t);
 364 extern int aggr_port_remvlan(aggr_port_t *, uint16_t);
 365 
 366 extern mblk_t *aggr_ring_tx(void *, mblk_t *);
 367 extern mblk_t *aggr_find_tx_ring(void *, mblk_t *,
 368     uintptr_t, mac_ring_handle_t *);
 369 
 370 #endif  /* _KERNEL */
 371 
 372 #ifdef  __cplusplus
 373 }
 374 #endif
 375 
 376 #endif  /* _SYS_AGGR_IMPL_H */