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

link.h (4288B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      7  * 
      8  * DO NOT EDIT THIS FILE!
      9  * This file is auto-generated.
     10  * Edits to this file will be lost when it is regenerated.
     11  */
     12 
     13 #ifndef __BCM_LINK_H__
     14 #define __BCM_LINK_H__
     15 
     16 #include <bcm/types.h>
     17 #include <bcm/port.h>
     18 
     19 /* bcm_linkscan_handler_t */
     20 typedef void (*bcm_linkscan_handler_t)(
     21     int unit, 
     22     bcm_port_t port, 
     23     bcm_port_info_t *info);
     24 
     25 /* bcm_linkscan_port_handler_t */
     26 typedef int (*bcm_linkscan_port_handler_t)(
     27     int unit, 
     28     bcm_port_t port, 
     29     int *state);
     30 
     31 #ifndef BCM_HIDE_DISPATCHABLE
     32 
     33 /* Initialize the link scanning subsystem. */
     34 extern int bcm_linkscan_init(
     35     int unit);
     36 
     37 /* Terminate linkscan on the specified unit. */
     38 extern int bcm_linkscan_detach(
     39     int unit);
     40 
     41 #endif /* BCM_HIDE_DISPATCHABLE */
     42 
     43 #define BCM_LINKSCAN_INTERVAL_MIN   10000      
     44 
     45 #define BCM_LINKSCAN_INTERVAL_DEFAULT   250000     
     46 
     47 #ifndef BCM_HIDE_DISPATCHABLE
     48 
     49 /* Enable and disabled link scanning, or set the polling interval. */
     50 extern int bcm_linkscan_enable_set(
     51     int unit, 
     52     int us);
     53 
     54 /* Enable and disabled link scanning, or set the polling interval. */
     55 extern int bcm_linkscan_enable_get(
     56     int unit, 
     57     int *us);
     58 
     59 /* Retrieve if linkscan managing a specified port. */
     60 extern int bcm_linkscan_enable_port_get(
     61     int unit, 
     62     bcm_port_t port);
     63 
     64 #endif /* BCM_HIDE_DISPATCHABLE */
     65 
     66 /* bcm_linkscan_mode_e */
     67 typedef enum bcm_linkscan_mode_e {
     68     BCM_LINKSCAN_MODE_NONE   = 0, 
     69     BCM_LINKSCAN_MODE_SW     = 1, 
     70     BCM_LINKSCAN_MODE_HW     = 2, 
     71     BCM_LINKSCAN_MODE_COUNT = 3 
     72 } bcm_linkscan_mode_t;
     73 
     74 #ifndef BCM_HIDE_DISPATCHABLE
     75 
     76 /* Set the link scanning mode for a port. */
     77 extern int bcm_linkscan_mode_set(
     78     int unit, 
     79     bcm_port_t port, 
     80     int mode);
     81 
     82 /* Set the link scanning mode for a set of ports. */
     83 extern int bcm_linkscan_mode_set_pbm(
     84     int unit, 
     85     bcm_pbmp_t pbm, 
     86     int mode);
     87 
     88 /* Get the link scanning mode for a port. */
     89 extern int bcm_linkscan_mode_get(
     90     int unit, 
     91     bcm_port_t port, 
     92     int *mode);
     93 
     94 /* Register and unregister link notification callouts. */
     95 extern int bcm_linkscan_register(
     96     int unit, 
     97     bcm_linkscan_handler_t f);
     98 
     99 /* Register and unregister link notification callouts. */
    100 extern int bcm_linkscan_unregister(
    101     int unit, 
    102     bcm_linkscan_handler_t f);
    103 
    104 /* Register link status callout. */
    105 extern int bcm_linkscan_port_register(
    106     int unit, 
    107     bcm_port_t port, 
    108     bcm_linkscan_port_handler_t f);
    109 
    110 /* Unregister link status callout. */
    111 extern int bcm_linkscan_port_unregister(
    112     int unit, 
    113     bcm_port_t port, 
    114     bcm_linkscan_port_handler_t f);
    115 
    116 /* Wait for a set of links to recognize link up. */
    117 extern int bcm_link_wait(
    118     int unit, 
    119     bcm_pbmp_t *pbm, 
    120     int us);
    121 
    122 /* Force a transient link down event on a port. */
    123 extern int bcm_link_change(
    124     int unit, 
    125     bcm_pbmp_t pbmp);
    126 
    127 /* Check for a change in link status on each link. */
    128 extern int bcm_linkscan_update(
    129     int unit, 
    130     bcm_pbmp_t pbm);
    131 
    132 #if defined(BROADCOM_DEBUG)
    133 /* bcm_linkscan_dump */
    134 extern int bcm_linkscan_dump(
    135     int unit);
    136 #endif
    137 
    138 #endif /* BCM_HIDE_DISPATCHABLE */
    139 
    140 /* bcm_linkscan_trigger_event_e */
    141 typedef enum bcm_linkscan_trigger_event_e {
    142     BCM_LINKSCAN_TRIGGER_EVENT_FAULT = 0, /* Trigger only link remote fault
    143                                            checking in Linkscan thread. */
    144     BCM_LINKSCAN_TRIGGER_EVENT_REMOTE_FAULT = BCM_LINKSCAN_TRIGGER_EVENT_FAULT, /* Trigger link remote fault checking. */
    145     BCM_LINKSCAN_TRIGGER_EVENT_LOCAL_FAULT = 1 /* Trigger link local fault checking. */
    146 } bcm_linkscan_trigger_event_t;
    147 
    148 #ifndef BCM_HIDE_DISPATCHABLE
    149 
    150 /* Note: links status trigger event is always set, and can't be disabled. */
    151 extern int bcm_linkscan_trigger_event_set(
    152     int unit, 
    153     bcm_port_t port, 
    154     uint32 flags, 
    155     bcm_linkscan_trigger_event_t trigger_event, 
    156     int enable);
    157 
    158 /* Get the link event status. */
    159 extern int bcm_linkscan_trigger_event_get(
    160     int unit, 
    161     bcm_port_t port, 
    162     uint32 flags, 
    163     bcm_linkscan_trigger_event_t trigger_event, 
    164     int *enable);
    165 
    166 #endif /* BCM_HIDE_DISPATCHABLE */
    167 
    168 #endif /* __BCM_LINK_H__ */