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

client_rx.c (19575B)


      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:        client_rx.c
      8  * Purpose:     Client implementation of bcm_rx* functions.
      9  * Requires:
     10  */
     11 
     12 #include <bcm/rx.h>
     13 #include <bcm/error.h>
     14 #include <bcm_int/esw_dispatch.h>
     15 
     16 /*
     17  * Function:
     18  *      bcm_client_rx_init
     19  * Purpose:
     20  *      Software initialization for RX API on client
     21  * Parameters:
     22  *      unit - Unit to init
     23  * Returns:
     24  *      BCM_E_XXX
     25  * Notes:
     26  *      Allocates rx control structure
     27  *      Copies default config into active config
     28  *      Adds discard handler
     29  */
     30 
     31 int
     32 bcm_client_rx_init(int unit)
     33 {
     34 #ifdef	BCM_ESW_SUPPORT
     35     return bcm_esw_rx_init(unit);
     36 #else
     37     return BCM_E_UNAVAIL;
     38 #endif
     39 }
     40 
     41 /*
     42  * Function:
     43  *      bcm_client_rx_cfg_init
     44  * Purpose:
     45  *      Re-initialize the user level configuration on client
     46  * Parameters:
     47  *      unit - StrataXGS unit number
     48  * Returns:
     49  *      BCM_E_XXX
     50  * Notes:
     51  *      Can't use if currently running.  Should be called before
     52  *      doing a simple modification of the RX configuration in case
     53  *      the previous user has left it in a strange state.
     54  */
     55 
     56 int
     57 bcm_client_rx_cfg_init(int unit)
     58 {
     59 #ifdef	BCM_ESW_SUPPORT
     60     return bcm_esw_rx_cfg_init(unit);
     61 #else
     62     return BCM_E_UNAVAIL;
     63 #endif
     64 }
     65 
     66 /*
     67  * Function:
     68  *      bcm_client_rx_start
     69  * Purpose:
     70  *      Initialize and configure the RX subsystem for a given client unit
     71  * Parameters:
     72  *      unit - Unit to configure
     73  *      cfg - Configuration to use.  See include/bcm/rx.h
     74  * Returns:
     75  *      BCM_E_XXX
     76  * Notes:
     77  *      Starts the packet receive thread if not already running.
     78  *      cfg may be null:  Use default config.
     79  *      alloc/free in cfg may be null:  Use default alloc/free functions
     80  */
     81 
     82 int
     83 bcm_client_rx_start(int unit, bcm_rx_cfg_t *cfg)
     84 {
     85 #ifdef	BCM_ESW_SUPPORT
     86     return bcm_esw_rx_start(unit, cfg);
     87 #else
     88     return BCM_E_UNAVAIL;
     89 #endif
     90 }
     91 
     92 /*
     93  * Function:
     94  *      bcm_client_rx_stop
     95  * Purpose:
     96  *      Stop RX for the given client unit; saves current configuration
     97  * Parameters:
     98  *      unit - The unit to stop
     99  *      cfg - OUT Configuration copied to this parameter
    100  * Returns:
    101  *      BCM_E_XXX
    102  * Notes:
    103  *      This signals the thread to exit.
    104  */
    105 
    106 int
    107 bcm_client_rx_stop(int unit, bcm_rx_cfg_t *cfg)
    108 {
    109 #ifdef	BCM_ESW_SUPPORT
    110     return bcm_esw_rx_stop(unit, cfg);
    111 #else
    112     return BCM_E_UNAVAIL;
    113 #endif
    114 }
    115 
    116 /*
    117  * Function:
    118  *      bcm_client_rx_clear
    119  * Purpose:
    120  *      Clear all RX info on client
    121  * Returns:
    122  *      BCM_E_NONE
    123  */
    124 
    125 int
    126 bcm_client_rx_clear(int unit)
    127 {
    128 #ifdef	BCM_ESW_SUPPORT
    129     return bcm_esw_rx_clear(unit);
    130 #else
    131     return BCM_E_UNAVAIL;
    132 #endif
    133 }
    134 
    135 /*
    136  * Function:
    137  *      bcm_client_rx_cfg_get
    138  * Purpose:
    139  *      Check if init done; get the current RX configuration on client
    140  * Parameters:
    141  *      unit - Strata device ID
    142  *      cfg - OUT Configuration copied to this parameter.  May be NULL
    143  * Returns:
    144  *      BCM_E_INIT if not running on unit
    145  *      BCM_E_NONE if running on unit
    146  *      < 0 BCM_E_XXX error code
    147  * Notes:
    148  */
    149 
    150 int
    151 bcm_client_rx_cfg_get(int unit, bcm_rx_cfg_t *cfg)
    152 {
    153 #ifdef	BCM_ESW_SUPPORT
    154     return bcm_esw_rx_cfg_get(unit, cfg);
    155 #else
    156     return BCM_E_UNAVAIL;
    157 #endif
    158 }
    159 
    160 /*
    161  * Function:
    162  *      bcm_client_rx_register
    163  * Purpose:
    164  *      Register an upper layer driver on client
    165  * Parameters:
    166  *      unit - StrataSwitch unit number.
    167  *      chan - DMA channel number
    168  *      name - constant character string for debug purposes.
    169  *      priority - priority of handler in list (0 is lowest priority).
    170  *      f - function to call for that driver.
    171  *      cookie - cookie passed to driver when packet arrives.
    172  *      flags - Register for interrupt or non-interrupt callback
    173  * Returns:
    174  *      BCM_E_NONE - callout registered.
    175  *      BCM_E_MEMORY - memory allocation failed.
    176  */
    177 
    178 int
    179 bcm_client_rx_register(int unit, const char *name, bcm_rx_cb_f callback,
    180                 uint8 priority, void *cookie, uint32 flags)
    181 {
    182 #ifdef	BCM_ESW_SUPPORT
    183     return bcm_esw_rx_register(unit, name, callback,
    184                                   priority, cookie, flags);
    185 #else
    186     return BCM_E_UNAVAIL;
    187 #endif
    188 }
    189 
    190 /*
    191  * Function:
    192  *      bcm_client_rx_unregister
    193  * Purpose:
    194  *      De-register a callback function on client
    195  * Parameters:
    196  *      unit - Unit reference
    197  *      priority - Priority of registered callback
    198  *      callback - The function being registered
    199  * Returns:
    200  *      BCM_E_XXX
    201  * Notes:
    202  *      Run through linked list looking for match of function and priority
    203  */
    204 
    205 int
    206 bcm_client_rx_unregister(int unit, bcm_rx_cb_f callback, uint8 priority)
    207 {
    208 #ifdef	BCM_ESW_SUPPORT
    209     return bcm_esw_rx_unregister(unit, callback, priority);
    210 #else
    211     return BCM_E_UNAVAIL;
    212 #endif
    213 }
    214 
    215 /*
    216  * Function:
    217  *      bcm_client_rx_active
    218  * Purpose:
    219  *      Return boolean as to whether client unit is running
    220  * Parameters:
    221  *      unit - StrataXGS to check
    222  * Returns:
    223  *      Boolean:   TRUE if unit is running.
    224  * Notes:
    225  */
    226 int
    227 bcm_client_rx_active(int unit)
    228 {
    229 #ifdef	BCM_ESW_SUPPORT
    230     return bcm_esw_rx_active(unit);
    231 #else
    232     return BCM_E_UNAVAIL;
    233 #endif
    234 }
    235 
    236 
    237 /*
    238  * Function:
    239  *      bcm_rx_queue_register
    240  * Purpose:
    241  *      Register an application callback for the specified CPU queue
    242  * Parameters:
    243  *      unit - StrataSwitch unit number.
    244  *      name - constant character string for debug purposes.
    245  *      cosq - CPU cos queue
    246  *      callback - callback function pointer.
    247  *      priority - priority of handler in list (0 is lowest priority).
    248  *      cookie - cookie passed to driver when packet arrives.
    249  *      flags - Register for interrupt or non-interrupt callback
    250  * Returns:
    251  *      BCM_E_NONE - callout registered.
    252  *      BCM_E_MEMORY - memory allocation failed.
    253  */
    254 
    255 int
    256 bcm_client_rx_queue_register(int unit, const char *name, bcm_cos_queue_t cosq,
    257                              bcm_rx_cb_f callback, uint8 priority, void *cookie,
    258                              uint32 flags)
    259 {
    260 #ifdef	BCM_ESW_SUPPORT
    261     return bcm_esw_rx_queue_register(unit, name, cosq, callback,
    262                                      priority, cookie, flags);
    263 #else
    264     return BCM_E_UNAVAIL;
    265 #endif
    266 }
    267 
    268 /*
    269  * Function:
    270  *      bcm_rx_queue_unregister
    271  * Purpose:
    272  *      Unregister a callback function
    273  * Parameters:
    274  *      unit - Unit reference
    275  *      cosq - CPU cos queue
    276  *      priority - Priority of registered callback
    277  *      callback - The function being registered
    278  * Returns:
    279  *      BCM_E_XXX
    280  */ 
    281 
    282 int 
    283 bcm_client_rx_queue_unregister(int unit, bcm_cos_queue_t cosq,
    284                                bcm_rx_cb_f callback, uint8 priority)
    285 {
    286 #ifdef	BCM_ESW_SUPPORT
    287     return bcm_esw_rx_queue_unregister(unit, cosq, callback, priority);
    288 #else
    289     return BCM_E_UNAVAIL;
    290 #endif
    291 }
    292 
    293 # if 0
    294 /* WAIT */
    295 /*
    296  * Function:
    297  *      bcm_rx_cosq_mapping_size_get
    298  * Purpose:
    299  *      Get number of COSQ mapping entries
    300  * Parameters:
    301  *      unit - Unit reference
    302  *      size - (OUT) number of entries
    303  * Returns:
    304  *      BCM_E_XXX
    305  */
    306 int     
    307 bcm_client_rx_cosq_mapping_size_get(int unit, int *size)
    308 {
    309 #ifdef	BCM_ESW_SUPPORT
    310     return bcm_esw_rx_cosq_mapping_size_get(unit, size);
    311 #else
    312     return BCM_E_UNAVAIL;
    313 #endif
    314 }
    315  
    316 /* 
    317  * Function:
    318  *      bcm_rx_cosq_mapping_set
    319  * Purpose:
    320  *      Set the COSQ mapping to map qualified packets to the a CPU cos queue.
    321  * Parameters:
    322  *      unit - Unit reference 
    323  *      index - Index into COSQ mapping table (0 is lowest match priority)
    324  *      reasons - packet "reasons" bitmap
    325  *      reasons_mask - mask for packet "reasons" bitmap
    326  *      int_prio - internal priority value
    327  *      int_prio_mask - mask for internal priority value
    328  *      packet_type - packet type bitmap (BCM_RX_COSQ_PACKET_TYPE_*)
    329  *      packet_type_mask - mask for packet type bitmap
    330  *      cosq - CPU cos queue
    331  * Returns:
    332  *      BCM_E_XXX
    333  */
    334 int
    335 bcm_client_rx_cosq_mapping_set(int unit, int index,
    336                                bcm_rx_reasons_t reasons, bcm_rx_reasons_t reasons_mask,
    337                                uint8 int_prio, uint8 int_prio_mask,
    338                                uint32 packet_type, uint32 packet_type_mask,
    339                                bcm_cos_queue_t cosq)
    340 {
    341 #ifdef	BCM_ESW_SUPPORT
    342     return bcm_esw_rx_cosq_mapping_set(unit, index, reasons, reasons_mask,
    343                                        int_prio, int_prio_mask, packet_type,
    344                                        packet_type_mask, cosq);
    345 #else
    346     return BCM_E_UNAVAIL;
    347 #endif
    348 }
    349 
    350 /*
    351  * Function:
    352  *      bcm_rx_cosq_mapping_get
    353  * Purpose:
    354  *      Get the COSQ mapping at the specified index
    355  * Parameters:
    356  *      unit - Unit reference
    357  *      index - Index into COSQ mapping table (0 is lowest match priority)
    358  *      reasons - packet "reasons" bitmap
    359  *      reasons_mask - mask for packet "reasons" bitmap
    360  *      int_prio - internal priority value
    361  *      int_prio_mask - mask for internal priority value
    362  *      packet_type - packet type bitmap (BCM_RX_COSQ_PACKET_TYPE_*)
    363  *      packet_type_mask - mask for packet type bitmap
    364  *      cosq - CPU cos queue
    365  * Returns:
    366  *      BCM_E_XXX
    367  */
    368 int
    369 bcm_client_rx_cosq_mapping_get(int unit, int index,
    370                                bcm_rx_reasons_t *reasons, bcm_rx_reasons_t *reasons_mask,
    371                                uint8 *int_prio, uint8 *int_prio_mask,
    372                                uint32 *packet_type, uint32 *packet_type_mask,
    373                                bcm_cos_queue_t *cosq)
    374 {
    375 #ifdef	BCM_ESW_SUPPORT
    376     return bcm_esw_rx_cosq_mapping_get(unit, index, reasons, reasons_mask,
    377                                        int_prio, int_prio_mask, packet_type,
    378                                        packet_type_mask, cosq);
    379 #else
    380     return BCM_E_UNAVAIL;
    381 #endif
    382 }
    383 
    384 /*
    385  * Function:
    386  *      bcm_rx_cosq_mapping_delete
    387  * Purpose:
    388  *      Delete the COSQ mapping at the specified index
    389  * Parameters:
    390  *      unit - Unit reference
    391  *      index - Index into COSQ mapping table
    392  * Returns:
    393  *      BCM_E_XXX
    394  */
    395 int
    396 bcm_client_rx_cosq_mapping_delete(int unit, int index)
    397 {
    398 #ifdef	BCM_ESW_SUPPORT
    399     return bcm_esw_rx_cosq_mapping_delete(unit, index);
    400 #else
    401     return BCM_E_UNAVAIL;
    402 #endif
    403 }
    404 
    405 /*
    406  * Function:
    407  *      bcm_rx_cosq_mapping_reasons_get
    408  * Purpose:
    409  *      Get the supported reasons for CPU rx cosq mapping
    410  * Parameters:
    411  *      unit - Unit reference
    412  *      reasons - rx packet "reasons" used to map COS queue 
    413  * Returns:
    414  *      BCM_E_XXX
    415  */
    416 int
    417 bcm_client_rx_cosq_mapping_reasons_get(int unit, bcm_rx_reasons_t *reasons)
    418 {
    419 #ifdef  BCM_ESW_SUPPORT
    420     return bcm_esw_rx_cosq_mapping_reasons_get(unit, reasons);
    421 #else
    422     return BCM_E_UNAVAIL;
    423 #endif
    424 }
    425 
    426 /*
    427  * Function:
    428  *      bcm_rx_reasons_get
    429  * Purpose:
    430  *      Get the supported reasons for CPU Rx packets
    431  * Parameters:
    432  *      unit - Unit reference
    433  *      reasons - rx packet "reasons" 
    434  * Returns:
    435  *      BCM_E_XXX
    436  */
    437 int
    438 bcm_client_rx_reasons_get(int unit, bcm_rx_reasons_t *reasons)
    439 {
    440 #ifdef  BCM_ESW_SUPPORT
    441     return bcm_esw_rx_reasons_get(unit, reasons);
    442 #else
    443     return BCM_E_UNAVAIL;
    444 #endif
    445 }
    446 
    447 #endif
    448 /* WAIT */
    449 
    450 /*
    451  * Function:
    452  *      bcm_client_rx_running_channels
    453  * Purpose:
    454  *      Returns a bitmap indicating which channels are active on client
    455  * Parameters:
    456  *      unit       - Which unit to operate on
    457  * Returns:
    458  *      Bitmap of active channels
    459  * Notes:
    460  */
    461 
    462 int
    463 bcm_client_rx_channels_running(int unit, uint32 *channels)
    464 {
    465 #ifdef	BCM_ESW_SUPPORT
    466     return bcm_esw_rx_channels_running(unit, channels);
    467 #else
    468     return BCM_E_UNAVAIL;
    469 #endif
    470 }
    471 
    472 /*
    473  * Function:
    474  *      bcm_client_rx_alloc
    475  * Purpose:
    476  *      Gateway to configured RX allocation function on client
    477  * Parameters:
    478  *      unit - Unit reference
    479  *      pkt_size - Packet size, see notes.
    480  *      flags - Used to set up packet flags
    481  * Returns:
    482  *      Pointer to new packet buffer or NULL if cannot alloc memory
    483  * Notes:
    484  *      Although the packet size is normally configured per unit,
    485  *      the option of using a different size is given here.  If
    486  *      pkt_size <= 0, then the default packet size for the unit
    487  *      is used.
    488  */
    489 
    490 int
    491 bcm_client_rx_alloc(int unit, int pkt_size, uint32 flags, void **buf)
    492 {
    493 #ifdef	BCM_ESW_SUPPORT
    494     return bcm_esw_rx_alloc(unit, pkt_size, flags, buf);
    495 #else
    496     return BCM_E_UNAVAIL;
    497 #endif
    498 }
    499 
    500 /*
    501  * Function:
    502  *      bcm_client_rx_free
    503  * Purpose:
    504  *      Gateway to configured RX free function on client.
    505  *      Generally, packet buffer was allocated with bcm_rx_alloc.
    506  * Parameters:
    507  *      unit - Unit reference
    508  *      pkt - Packet to free
    509  * Returns:
    510  * Notes:
    511  *      In particular, packets stolen from RX with BCM_RX_HANDLED_OWNED
    512  *      should use this to free packets.
    513  */
    514 
    515 int
    516 bcm_client_rx_free(int unit, void *pkt_data)
    517 {
    518 #ifdef	BCM_ESW_SUPPORT
    519     return bcm_esw_rx_free(unit, pkt_data);
    520 #else
    521     return BCM_E_UNAVAIL;
    522 #endif
    523 }
    524 
    525 /*
    526  * Function:
    527  *      bcm_client_rx_free_enqueue
    528  * Purpose:
    529  *      Queue a packet to be freed by the RX thread on client.
    530  * Parameters:
    531  *      unit - Unit reference
    532  *      pkt - Packet to free
    533  * Returns:
    534  * Notes:
    535  *      This may be called in interrupt context to queue
    536  *      a packet to be freed.
    537  *
    538  *      Assumes pkt_data is 32-bit aligned.
    539  *      Uses the first word of the freed data as a "next" pointer
    540  *      for the free list.
    541  */
    542 
    543 int
    544 bcm_client_rx_free_enqueue(int unit, void *pkt_data)
    545 {
    546 #ifdef	BCM_ESW_SUPPORT
    547     return bcm_esw_rx_free_enqueue(unit, pkt_data);
    548 #else
    549     return BCM_E_UNAVAIL;
    550 #endif
    551 }
    552 
    553 /*
    554  * Functions:
    555  *      bcm_client_rx_burst_set, get; bcm_client_rx_rate_set, get
    556  *      bcm_client_rx_cos_burst_set, get; bcm_client_rx_cos_rate_set, get;
    557  *      bcm_client_rx_cos_max_len_set, get
    558  * Purpose:
    559  *      Get/Set the global and per COS limits on client:
    560  *           rate:      Packets/second
    561  *           burst:     Packets (max tokens in bucket)
    562  *           max_len:   Packets (max permitted in queue).
    563  * Parameters:
    564  *      unit - Unit reference
    565  *      cos - For per COS functions, which COS queue affected
    566  *      pps - Rate in packets per second (OUT for get functions)
    567  *      burst - Burst rate for the system in packets (OUT for get functions)
    568  *      max_q_len - Burst rate for the system in packets (OUT for get functions)
    569  * Returns:
    570  *      BCM_E_XXX
    571  * Notes:
    572  *      PPS must be >= 0 and
    573  *      Max queue length must be >= 0;
    574  *          otherwise param error.
    575  *
    576  *      PPS == 0 -> rate limiting disabled.
    577  *      max_q_len == 0 -> no limit on queue length (not recommended)
    578  */
    579 
    580 int
    581 bcm_client_rx_rate_set(int unit, int pps)
    582 {
    583 #ifdef	BCM_ESW_SUPPORT
    584     return bcm_esw_rx_rate_set(unit, pps);
    585 #else
    586     return BCM_E_UNAVAIL;
    587 #endif
    588 }
    589 
    590 int
    591 bcm_client_rx_rate_get(int unit, int *pps)
    592 {
    593 #ifdef	BCM_ESW_SUPPORT
    594     return bcm_esw_rx_rate_get(unit, pps);
    595 #else
    596     return BCM_E_UNAVAIL;
    597 #endif
    598 }
    599 
    600 int
    601 bcm_client_rx_cpu_rate_set(int unit, int pps)
    602 {
    603 #ifdef	BCM_ESW_SUPPORT
    604     return bcm_esw_rx_cpu_rate_set(unit, pps);
    605 #else
    606     return BCM_E_UNAVAIL;
    607 #endif
    608 }
    609 
    610 int
    611 bcm_client_rx_cpu_rate_get(int unit, int *pps)
    612 {
    613 #ifdef	BCM_ESW_SUPPORT
    614     return bcm_esw_rx_cpu_rate_get(unit, pps);
    615 #else
    616     return BCM_E_UNAVAIL;
    617 #endif
    618 }
    619 
    620 
    621 int
    622 bcm_client_rx_burst_set(int unit, int burst)
    623 {
    624 #ifdef	BCM_ESW_SUPPORT
    625     return bcm_esw_rx_burst_set(unit, burst);
    626 #else
    627     return BCM_E_UNAVAIL;
    628 #endif
    629 }
    630 
    631 int
    632 bcm_client_rx_burst_get(int unit, int *burst)
    633 {
    634 #ifdef	BCM_ESW_SUPPORT
    635     return bcm_esw_rx_burst_get(unit, burst);
    636 #else
    637     return BCM_E_UNAVAIL;
    638 #endif
    639 }
    640 
    641 int
    642 bcm_client_rx_cos_rate_set(int unit, int cos, int pps)
    643 {
    644 #ifdef	BCM_ESW_SUPPORT
    645     return bcm_esw_rx_cos_rate_set(unit, cos, pps);
    646 #else
    647     return BCM_E_UNAVAIL;
    648 #endif
    649 }
    650 
    651 int
    652 bcm_client_rx_cos_rate_get(int unit, int cos, int *pps)
    653 {
    654 #ifdef	BCM_ESW_SUPPORT
    655     return bcm_esw_rx_cos_rate_get(unit, cos, pps);
    656 #else
    657     return BCM_E_UNAVAIL;
    658 #endif
    659 }
    660 
    661 int
    662 bcm_client_rx_cos_burst_set(int unit, int cos, int burst)
    663 {
    664 #ifdef	BCM_ESW_SUPPORT
    665     return bcm_esw_rx_cos_burst_set(unit, cos, burst);
    666 #else
    667     return BCM_E_UNAVAIL;
    668 #endif
    669 }
    670 
    671 int
    672 bcm_client_rx_cos_burst_get(int unit, int cos, int *burst)
    673 {
    674 #ifdef	BCM_ESW_SUPPORT
    675     return bcm_esw_rx_cos_burst_get(unit, cos, burst);
    676 #else
    677     return BCM_E_UNAVAIL;
    678 #endif
    679 }
    680 
    681 int
    682 bcm_client_rx_cos_max_len_set(int unit, int cos, int max_q_len)
    683 {
    684 #ifdef	BCM_ESW_SUPPORT
    685     return bcm_esw_rx_cos_max_len_set(unit, cos, max_q_len);
    686 #else
    687     return BCM_E_UNAVAIL;
    688 #endif
    689 }
    690 
    691 int
    692 bcm_client_rx_cos_max_len_get(int unit, int cos, int *max_q_len)
    693 {
    694 #ifdef	BCM_ESW_SUPPORT
    695     return bcm_esw_rx_cos_max_len_get(unit, cos, max_q_len);
    696 #else
    697     return BCM_E_UNAVAIL;
    698 #endif
    699 }
    700 
    701 /*
    702  * Function:
    703  *      bcm_client_rx_remote_pkt_enqueue
    704  * Purpose:
    705  *      Enqueue a remote packet for normal RX processing on client
    706  * Parameters:
    707  *      unit          - The BCM unit in which queue the pkt is placed
    708  *      pkt           - The packet to enqueue
    709  * Returns:
    710  *      BCM_E_XXX
    711  */
    712 
    713 int
    714 bcm_client_rx_remote_pkt_enqueue(int unit, bcm_pkt_t *pkt)
    715 {
    716 #ifdef	BCM_ESW_SUPPORT
    717     return bcm_esw_rx_remote_pkt_enqueue(unit, pkt);
    718 #else
    719     return BCM_E_UNAVAIL;
    720 #endif
    721 }
    722 
    723 
    724 /*
    725  * Function:
    726  *      bcm_client_rx_sched_register
    727  * Purpose:
    728  *      Rx scheduler registration function. 
    729  * Parameters:
    730  *      unit       - (IN) Unused. 
    731  *      sched_cb   - (IN) Rx scheduler routine.
    732  * Returns:
    733  *      BCM_E_XXX
    734  */
    735 int
    736 bcm_client_rx_sched_register(int unit, bcm_rx_sched_cb sched_cb)
    737 {
    738 #ifdef	BCM_ESW_SUPPORT
    739     return bcm_esw_rx_sched_register(unit, sched_cb);
    740 #else
    741     return (BCM_E_UNAVAIL);
    742 #endif
    743 }
    744 
    745 /*
    746  * Function:
    747  *      bcm_client_rx_sched_unregister
    748  * Purpose:
    749  *      Rx scheduler de-registration function. 
    750  * Parameters:
    751  *      unit  - (IN) Unused. 
    752  * Returns:
    753  *      BCM_E_XXX
    754  */
    755 int
    756 bcm_client_rx_sched_unregister(int unit)
    757 {
    758 #ifdef	BCM_ESW_SUPPORT
    759     return bcm_esw_rx_sched_unregister(unit);
    760 #else
    761     return (BCM_E_UNAVAIL);
    762 #endif
    763 }
    764 
    765 /*
    766  * Function:
    767  *      bcm_client_rx_unit_next_get
    768  * Purpose:
    769  *      Rx started units iteration routine.
    770  * Parameters:
    771  *      unit       - (IN)  BCM device number. 
    772  *      unit_next  - (OUT) Next attached unit with started rx.
    773  * Returns:
    774  *      BCM_E_XXX
    775  */
    776 int
    777 bcm_client_rx_unit_next_get(int unit, int *unit_next)
    778 {
    779 #ifdef	BCM_ESW_SUPPORT
    780     return bcm_esw_rx_unit_next_get(unit, unit_next);
    781 #else
    782     return (BCM_E_UNAVAIL);
    783 #endif
    784 }
    785 
    786 /*
    787  * Function:
    788  *      bcm_client_rx_queue_packet_count_get
    789  * Purpose:
    790  *      Get number of packets awaiting processing in the specific device/queue.
    791  * Parameters:
    792  *      unit         - (IN) BCM device number. 
    793  *      cosq         - (IN) Queue priority.
    794  *      packet_count - (OUT) Next attached unit with initialized rx.
    795  * Returns:
    796  *      BCM_E_XXX
    797  */
    798 int
    799 bcm_client_rx_queue_packet_count_get(int unit, bcm_cos_queue_t cosq, int *packet_count)
    800 {
    801 #ifdef	BCM_ESW_SUPPORT
    802     return bcm_esw_rx_queue_packet_count_get(unit, cosq, packet_count);
    803 #else
    804     return (BCM_E_UNAVAIL);
    805 #endif
    806 }
    807 
    808 /*
    809  * Function:
    810  *      bcm_client_rx_queue_rate_limit_status
    811  * Purpose:
    812  *      Get number of packet that can be rx scheduled 
    813  *      until system hits queue rx rate limit. 
    814  * Parameters:
    815  *      unit           - (IN) BCM device number. 
    816  *      cosq           - (IN) Queue priority.
    817  *      packet_tokens  - (OUT)Maximum number of packets that can be  scheduled.
    818  * Returns:
    819  *      BCM_E_XXX
    820  */
    821 int
    822 bcm_client_rx_queue_rate_limit_status_get(int unit, bcm_cos_queue_t cosq, 
    823                                           int *packet_tokens)
    824 {
    825 #ifdef	BCM_ESW_SUPPORT
    826     return bcm_esw_rx_queue_rate_limit_status_get(unit, cosq, packet_tokens);
    827 #else
    828     return (BCM_E_UNAVAIL);
    829 #endif
    830 }