Print this page
11493 aggr needs support for multiple pseudo rx groups
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/aggr_impl.h
          +++ new/usr/src/uts/common/sys/aggr_impl.h
↓ open down ↓ 48 lines elided ↑ open up ↑
  49   49  #define AGGR_MODIFY_MAC                 0x02
  50   50  #define AGGR_MODIFY_LACP_MODE           0x04
  51   51  #define AGGR_MODIFY_LACP_TIMER          0x08
  52   52  
  53   53  /*
  54   54   * Possible value of aggr_rseudo_rx_ring_t.arr_flags. Set when the ring entry
  55   55   * in the pseudo RX group is used.
  56   56   */
  57   57  #define MAC_PSEUDO_RING_INUSE   0x01
  58   58  
       59 +#define MAX_GROUPS_PER_PORT     128
       60 +
  59   61  /*
  60   62   * VLAN filters placed on the Rx pseudo group.
  61   63   */
  62   64  typedef struct aggr_vlan {
  63   65          list_node_t     av_link;
  64   66          uint16_t        av_vid;         /* VLAN ID */
  65   67          uint_t          av_refs;        /* num aggr clients using this VID */
  66   68  } aggr_vlan_t;
  67   69  
  68   70  typedef struct aggr_unicst_addr_s {
  69   71          uint8_t                         aua_addr[ETHERADDRL];
  70   72          struct aggr_unicst_addr_s       *aua_next;
  71   73  } aggr_unicst_addr_t;
  72   74  
  73   75  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;
       76 +        mac_ring_handle_t               arr_rh; /* set by aggr_fill_ring() */
       77 +        struct aggr_port_s              *arr_port;
       78 +        struct aggr_pseudo_rx_group_s   *arr_grp;
       79 +        mac_ring_handle_t               arr_hw_rh;
       80 +        uint_t                          arr_flags;
       81 +        uint64_t                        arr_gen;
  79   82  } aggr_pseudo_rx_ring_t;
  80   83  
       84 +/*
       85 + * An aggr pseudo group abstracts the underlying ports' HW groups. For
       86 + * example, if each port has 8 groups (mac_group_t), then the aggr
       87 + * will create 8 pseudo groups. Each pseudo group represents a
       88 + * collection of HW groups: one group from each port. If you have
       89 + * three ports then the pseudo group stands in for three HW groups.
       90 + */
  81   91  typedef struct aggr_pseudo_rx_group_s {
       92 +        uint_t                  arg_index;
  82   93          struct aggr_grp_s       *arg_grp; /* filled in by aggr_fill_group() */
  83   94          mac_group_handle_t      arg_gh;   /* filled in by aggr_fill_group() */
  84   95          aggr_unicst_addr_t      *arg_macaddr;
  85   96          aggr_pseudo_rx_ring_t   arg_rings[MAX_RINGS_PER_GROUP];
  86   97          uint_t                  arg_ring_cnt;
  87   98          uint_t                  arg_untagged; /* num clients untagged */
  88   99          list_t                  arg_vlans;    /* VLANs on this group */
  89  100  } aggr_pseudo_rx_group_t;
  90  101  
  91  102  typedef struct aggr_pseudo_tx_ring_s {
↓ open down ↓ 20 lines elided ↑ open up ↑
 112  123          datalink_id_t   lp_linkid;
 113  124          uint16_t        lp_portid;
 114  125          uint8_t         lp_addr[ETHERADDRL];    /* port MAC address */
 115  126          uint32_t        lp_refs;                /* refcount */
 116  127          aggr_port_state_t lp_state;
 117  128          uint32_t        lp_started : 1,
 118  129                          lp_tx_enabled : 1,
 119  130                          lp_collector_enabled : 1,
 120  131                          lp_promisc_on : 1,
 121  132                          lp_no_link_update : 1,
 122      -                        lp_rx_grp_added : 1,
 123  133                          lp_tx_grp_added : 1,
 124  134                          lp_closing : 1,
 125      -                        lp_pad_bits : 24;
      135 +                        lp_pad_bits : 25;
 126  136          mac_handle_t    lp_mh;
 127      -        mac_client_handle_t lp_mch;
      137 +
      138 +        mac_client_handle_t     lp_mch;
      139 +
 128  140          const mac_info_t *lp_mip;
 129  141          mac_notify_handle_t lp_mnh;
 130  142          uint_t          lp_tx_idx;              /* idx in group's tx array */
 131  143          uint64_t        lp_ifspeed;
 132  144          link_state_t    lp_link_state;
 133  145          link_duplex_t   lp_link_duplex;
 134  146          uint64_t        lp_stat[MAC_NSTAT];
 135  147          uint64_t        lp_ether_stat[ETHER_NSTAT];
 136  148          aggr_lacp_port_t lp_lacp;               /* LACP state */
 137  149          lacp_stats_t    lp_lacp_stats;
 138  150          uint32_t        lp_margin;
 139      -        mac_promisc_handle_t lp_mphp;
      151 +
 140  152          mac_unicast_handle_t lp_mah;
 141  153  
 142  154          /* List of non-primary addresses that requires promiscous mode set */
 143  155          aggr_unicst_addr_t      *lp_prom_addr;
 144      -        /* handle of the underlying HW RX group */
 145      -        mac_group_handle_t      lp_hwgh;
      156 +
      157 +        /*
      158 +         * References to the underlying HW Rx groups of this port.
      159 +         * Used by aggr to program HW classification for the pseudo
      160 +         * groups.
      161 +         */
      162 +        mac_group_handle_t      lp_hwghs[MAX_GROUPS_PER_PORT];
      163 +
 146  164          int                     lp_tx_ring_cnt;
 147  165          /* handles of the underlying HW TX rings */
 148  166          mac_ring_handle_t       *lp_tx_rings;
 149  167          /*
 150  168           * Handles of the pseudo TX rings. Each of them maps to
 151  169           * corresponding hardware TX ring in lp_tx_rings[]. A
 152  170           * pseudo TX ring is presented to aggr primary mac
 153  171           * client even when underlying NIC has no TX ring.
 154  172           */
 155  173          mac_ring_handle_t       *lp_pseudo_tx_rings;
↓ open down ↓ 26 lines elided ↑ open up ↑
 182  200                          lg_closing : 1,
 183  201                          lg_addr_fixed : 1,      /* fixed MAC address? */
 184  202                          lg_started : 1,         /* group started? */
 185  203                          lg_promisc : 1,         /* in promiscuous mode? */
 186  204                          lg_zcopy : 1,
 187  205                          lg_vlan : 1,
 188  206                          lg_force : 1,
 189  207                          lg_lso : 1,
 190  208                          lg_pad_bits : 8;
 191  209          aggr_port_t     *lg_ports;              /* list of configured ports */
 192      -        aggr_port_t     *lg_mac_addr_port;
      210 +        aggr_port_t     *lg_mac_addr_port;      /* using address of this port */
 193  211          mac_handle_t    lg_mh;
 194  212          zoneid_t        lg_zoneid;
 195  213          uint_t          lg_nattached_ports;
 196  214          krwlock_t       lg_tx_lock;
 197  215          uint_t          lg_ntx_ports;
 198  216          aggr_port_t     **lg_tx_ports;          /* array of tx ports */
 199  217          uint_t          lg_tx_ports_size;       /* size of lg_tx_ports */
 200  218          uint32_t        lg_tx_policy;           /* outbound policy */
 201  219          uint8_t         lg_mac_tx_policy;
 202  220          link_state_t    lg_link_state;
↓ open down ↓ 23 lines elided ↑ open up ↑
 226  244           * with mac_unicast_remove(), which holding the mac perimeter of the
 227  245           * aggr, and wait for the mr_refcnt of the RX ring to drop to zero.
 228  246           */
 229  247          kmutex_t        lg_lacp_lock;
 230  248          kcondvar_t      lg_lacp_cv;
 231  249          mblk_t          *lg_lacp_head;
 232  250          mblk_t          *lg_lacp_tail;
 233  251          kthread_t       *lg_lacp_rx_thread;
 234  252          boolean_t       lg_lacp_done;
 235  253  
 236      -        aggr_pseudo_rx_group_t  lg_rx_group;
      254 +        uint_t                  lg_rx_group_count;
      255 +        aggr_pseudo_rx_group_t  lg_rx_groups[MAX_GROUPS_PER_PORT];
      256 +
 237  257          aggr_pseudo_tx_group_t  lg_tx_group;
 238  258  
 239  259          kmutex_t        lg_tx_flowctl_lock;
 240  260          kcondvar_t      lg_tx_flowctl_cv;
 241  261          uint_t          lg_tx_blocked_cnt;
 242  262          mac_ring_handle_t       *lg_tx_blocked_rings;
 243  263          kthread_t       *lg_tx_notify_thread;
 244  264          boolean_t       lg_tx_notify_done;
 245  265  
 246  266          /*
↓ open down ↓ 74 lines elided ↑ open up ↑
 321  341  extern int aggr_port_start(aggr_port_t *);
 322  342  extern void aggr_port_stop(aggr_port_t *);
 323  343  extern int aggr_port_promisc(aggr_port_t *, boolean_t);
 324  344  extern int aggr_port_unicst(aggr_port_t *);
 325  345  extern int aggr_port_multicst(void *, boolean_t, const uint8_t *);
 326  346  extern uint64_t aggr_port_stat(aggr_port_t *, uint_t);
 327  347  extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *);
 328  348  extern void aggr_port_init_callbacks(aggr_port_t *);
 329  349  
 330  350  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  351  
 334  352  extern void aggr_tx_ring_update(void *, uintptr_t);
 335  353  extern void aggr_tx_notify_thread(void *);
 336  354  extern void aggr_send_port_enable(aggr_port_t *);
 337  355  extern void aggr_send_port_disable(aggr_port_t *);
 338  356  extern void aggr_send_update_policy(aggr_grp_t *, uint32_t);
 339  357  
 340  358  extern void aggr_lacp_init(void);
 341  359  extern void aggr_lacp_fini(void);
 342  360  extern void aggr_lacp_init_port(aggr_port_t *);
↓ open down ↓ 7 lines elided ↑ open up ↑
 350  368  extern void aggr_lacp_port_detached(aggr_port_t *);
 351  369  extern void aggr_port_lacp_set_mode(aggr_grp_t *, aggr_port_t *);
 352  370  
 353  371  extern void aggr_lacp_rx_thread(void *);
 354  372  extern void aggr_recv_lacp(aggr_port_t *, mac_resource_handle_t, mblk_t *);
 355  373  
 356  374  extern void aggr_grp_port_hold(aggr_port_t *);
 357  375  extern void aggr_grp_port_rele(aggr_port_t *);
 358  376  extern void aggr_grp_port_wait(aggr_grp_t *);
 359  377  
 360      -extern int aggr_port_addmac(aggr_port_t *, const uint8_t *);
 361      -extern void aggr_port_remmac(aggr_port_t *, const uint8_t *);
      378 +extern int aggr_port_addmac(aggr_port_t *, uint_t, const uint8_t *);
      379 +extern void aggr_port_remmac(aggr_port_t *, uint_t, const uint8_t *);
 362  380  
 363      -extern int aggr_port_addvlan(aggr_port_t *, uint16_t);
 364      -extern int aggr_port_remvlan(aggr_port_t *, uint16_t);
      381 +extern int aggr_port_addvlan(aggr_port_t *, uint_t, uint16_t);
      382 +extern int aggr_port_remvlan(aggr_port_t *, uint_t, uint16_t);
 365  383  
 366  384  extern mblk_t *aggr_ring_tx(void *, mblk_t *);
 367  385  extern mblk_t *aggr_find_tx_ring(void *, mblk_t *,
 368  386      uintptr_t, mac_ring_handle_t *);
 369  387  
 370  388  #endif  /* _KERNEL */
 371  389  
 372  390  #ifdef  __cplusplus
 373  391  }
 374  392  #endif
 375  393  
 376  394  #endif  /* _SYS_AGGR_IMPL_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX