openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

traffic.h (3952B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        traffic.h
      8  * Purpose:     Defines and types required for traffic test.
      9  */
     10 
     11 #ifndef _TRAFFIC_TEST_H
     12 #define _TRAFFIC_TEST_H
     13 
     14 #include <soc/types.h>
     15 
     16 #include <bcm/port.h>
     17 
     18 /* Traffic Test Port (A) and Link Partner (B) */
     19 typedef struct {
     20     bcm_l2_addr_t l2A;
     21     bcm_l2_addr_t l2B;    
     22     uint32  portA;
     23     uint32  portB;
     24     int     vidA;
     25     int     vidB;    
     26 } traffic_port_config_t;
     27 
     28 /*
     29  * Port stats we monitor on a per-port basis while the test is running.
     30  */
     31 typedef struct {
     32     int      error;
     33     uint64   rbyt;
     34     uint64   rpkt;
     35     uint64   raln;
     36     uint64   rdisc;
     37     uint64   tbyt;
     38     uint64   tpkt;
     39     uint64   dropped;
     40 } traffic_port_stat_t;
     41 
     42 typedef enum {
     43     TRAFFIC_INTERNAL=0,      /* FD, MAC */
     44     TRAFFIC_INTERNAL_PHY,    /* FD, PHY */
     45     TRAFFIC_EXTERNAL_BI,     /* Full Duplex */
     46     TRAFFIC_EXTERNAL_UP,     /* A->B */
     47     TRAFFIC_EXTERNAL_DOWN    /* B->A */
     48 } traffic_mode_t;
     49 
     50 typedef enum {
     51     SPEED_MAX,
     52     SPEED_10,
     53     SPEED_100,
     54     SPEED_1GIG,
     55     SPEED_2_5GIG,
     56     SPEED_3GIG,
     57     SPEED_10GIG,
     58     SPEED_12GIG,
     59     SPEED_13GIG,
     60     SPEED_15GIG,
     61     SPEED_16GIG,
     62     SPEED_20GIG,
     63     SPEED_21GIG,
     64     SPEED_24GIG,
     65     SPEED_25GIG,
     66     SPEED_30GIG,
     67     SPEED_32GIG,
     68     SPEED_40GIG,
     69     SPEED_42GIG
     70 } traffic_speed_t;
     71 
     72 #if defined(INCLUDE_MACSEC)
     73 
     74 typedef struct traffic_macsec_key_info_s {
     75     unsigned char   crypto_key[16];
     76     int             assocId;
     77     int             an;
     78 } traffic_macsec_key_info_t;
     79 
     80 typedef struct traffic_macsec_port_info_s {
     81     int             tx_chanId;
     82     int             num_alloc;
     83     int             rx_chanId;
     84     int             cur_an;
     85     traffic_macsec_key_info_t tx_keys[4];
     86     traffic_macsec_key_info_t rx_keys[4];
     87 } traffic_macsec_port_info_t;
     88 
     89 typedef struct traffic_macsec_info_s {
     90     pbmp_t          macsec_pbm;
     91     /* Specify the number of assocs to be cretaed for the test. If
     92      * one, then application will create another assoc just before
     93      * hard expiry and switch to the new one. If 2, application will
     94      * create 2 assoc in the beginning, one active and other as backup. 
     95      * On expiry, switch will happen to backup and application will
     96      * replace the expired assoc with a new backup. */
     97     int             num_assoc;
     98     traffic_macsec_port_info_t  ports[SOC_MAX_NUM_PORTS];
     99 } traffic_macsec_info_t;
    100 
    101 #endif /* INCLUDE_MACSEC */
    102 
    103 /* Core test API structure */
    104 typedef struct traffic_test_s {
    105     bcm_port_info_t         *port_info;
    106     bcm_port_info_t         *saved_port_info;
    107 #ifdef BCM_ESW_SUPPORT
    108     modport_map_entry_t     *saved_modport_map;
    109     modport_map_sw_entry_t  *saved_modport_map_sw;
    110 #else
    111     void     *saved_modport_map;
    112     void     *saved_modport_map_sw;
    113 #endif
    114     traffic_port_stat_t     *port_stats;
    115     traffic_port_config_t   *port_pair;
    116     pbmp_t                   ports;
    117     int                      npkts;
    118     int                      unit;
    119     uint32                   pattern;       /* Data Pattern */
    120     uint32                   pattern_inc;   /* Data Pattern increment  */
    121     int                      pkt_size;
    122     int                      l2agetime;
    123     int                      req_speed;
    124     int                      stop_on_fail;
    125     int                      cleanup;
    126     int                      showstats;
    127     int                      runtime;
    128     int                      poll_interval;
    129     traffic_mode_t           mode;
    130     int                      run2end; /* run till the end */
    131 #if defined(INCLUDE_MACSEC)
    132     int                      macsec_enabled;
    133     traffic_macsec_info_t   *macsec_info;
    134 #endif /* INCLUDE_MACSEC */
    135 } traffic_test_t;
    136 
    137 #define TRAFFIC_VID_BASE                10
    138 #define TRAFFIC_LINK_TIMEOUT            15000000
    139 
    140 #endif /* _TRAFFIC_TEST_H */