OpenNSL API Guide and Reference Manual
Data Structures | Files | Macros | Typedefs | Functions
Mirroring

Data Structures

struct  opennsl_mirror_destination_s
 Mirror destination Structure. More...
 
struct  opennsl_mirror_options_s
 represents the options for the mirroring of packets More...
 
struct  opennsl_mirror_pkt_erspan_encap_s
 Contains information required for ERSPAN encapsulation header. More...
 
struct  opennsl_mirror_port_info_s
 Mirror port Structure. More...
 

Files

file  mirror.h
 
file  mirrorX.h
 

Macros

#define OPENNSL_MIRROR_DEST_DEST_MULTICAST   (1 << 9)
 destination is ingress multicast
 
#define OPENNSL_MIRROR_DEST_DROP_FWD_IF_SNIFF_DROPPED   (1 << 22)
 Drop the original packet if the sniff packet is dropped.
 
#define OPENNSL_MIRROR_DEST_DROP_SNIFF_IF_FWD_DROPPED   (1 << 21)
 Drop the sniff packet if the original packet is dropped.
 
#define OPENNSL_MIRROR_DEST_EGRESS_ADD_ORIG_SYSTEM_HEADER   (1 << 18)
 The start of the original packet system header will be included in the outbound mirrored packets.
 
#define OPENNSL_MIRROR_DEST_EGRESS_TRAP_WITH_SYSTEM_HEADER   (1 << 28)
 For packets recycled by egress applications and not forwarded, retain the incoming packet's system headers as received from the fabric, and in case of an Egress MC packet, stamp the FTMH.OutLIF field with the CUD.
 
#define OPENNSL_MIRROR_DEST_FIELD   (1 << 19)
 Specify that mirror destination owner is FP.
 
#define OPENNSL_MIRROR_DEST_FLAGS2_TUNNEL_VXLAN   (1 << 0)
 Mirror Tunnel is VXLAN.
 
#define OPENNSL_MIRROR_DEST_ID_SHARE   (1 << 24)
 Share mirror destination id among multi ports.
 
#define OPENNSL_MIRROR_DEST_INT_PRI_SET   (1 << 13)
 Mirrored packet should set with internal priority.
 
#define OPENNSL_MIRROR_DEST_IS_SNOOP   (1 << 16)
 Specify that the destination type is a snoop destination.
 
#define OPENNSL_MIRROR_DEST_IS_STAT_SAMPLE   (1 << 17)
 Specify that the destination type is a STATISTIC SAMPLING destination.
 
#define OPENNSL_MIRROR_DEST_IS_TRAP   (1 << 17)
 Specify that the destination is a trap destination.
 
#define OPENNSL_MIRROR_DEST_MTP_ADD   (1 << 25)
 Add an MTP into a shared-id mirror destination.
 
#define OPENNSL_MIRROR_DEST_MTP_DELETE   (1 << 26)
 Delete an MTP from a shared-id mirror destination.
 
#define OPENNSL_MIRROR_DEST_MTP_REPLACE   (1 << 27)
 REPLACE an MTP of a shared-id mirror destination.
 
#define OPENNSL_MIRROR_DEST_NO_COUNT   -2
 Value to disable counting of the snooped/mirrored copy.
 
#define OPENNSL_MIRROR_DEST_OUT_MIRROR_DISABLE   (1 << 30)
 Assert out mirror disable.
 
#define OPENNSL_MIRROR_DEST_PAYLOAD_UNTAGGED   (1 << 4)
 Strip vlan tag from mirrored packet.
 
#define OPENNSL_MIRROR_DEST_PORT   (1 << 20)
 Specify that mirror destination owner is PORT.
 
#define OPENNSL_MIRROR_DEST_REPLACE   (1 << 0)
 Replace mirror destination.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_ETAG   (1 << 14)
 Mirrored packet should be ETAG tunneled.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_IP_GRE   (1 << 3)
 Mirrored packet should be L3 GRE tunneled.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_L2   (1 << 2)
 Mirrored packet should be L2 tunneled.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_NIV   (1 << 6)
 Mirrored packet should be NIV tunneled.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_PSAMP   (1 << 29)
 Update mirror destination with PSAMP encapsulation.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_RSPAN   (1 << 12)
 Mirrored packet should be RSPAN (VLAN) tunneled.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_SFLOW   (1 << 15)
 Mirrored packet should be with sFlow encapsulation.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_TRILL   (1 << 5)
 Mirrored packet should be TRILL tunneled.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_WITH_ENCAP_ID   (1 << 10)
 Mirror destination encap_id is valid.
 
#define OPENNSL_MIRROR_DEST_TUNNEL_WITH_SEQ   (1 << 31)
 Include Sequence number in header.
 
#define OPENNSL_MIRROR_DEST_UPDATE_COUNTER   (1 << 8)
 update counter using stat_id
 
#define OPENNSL_MIRROR_DEST_UPDATE_COUNTER_1   (1 << 21)
 update counter No.1
 
#define OPENNSL_MIRROR_DEST_UPDATE_COUNTER_2   (1 << 22)
 update counter No.2
 
#define OPENNSL_MIRROR_DEST_UPDATE_EXT_COUNTERS   (1 << 31)
 Set statistic interfaces for mirrored packets.
 
#define OPENNSL_MIRROR_DEST_UPDATE_POLICER   (1 << 7)
 update policer using policer_id
 
#define OPENNSL_MIRROR_DEST_WITH_ID   (1 << 1)
 Mirror destination id is valid.
 
#define OPENNSL_MIRROR_DISABLE   0
 Disable mirroring.
 
#define OPENNSL_MIRROR_EXT_STAT_ID_COUNT   2
 Number of statistic interfaces for mirrored packets.
 
#define OPENNSL_MIRROR_L2   1
 Enable mirroring.
 
#define OPENNSL_MIRROR_L2_L3   2
 Deprecated.
 
#define OPENNSL_MIRROR_NIV_LOOP   1
 Mirrored packet is a loop in NIV path.
 
#define OPENNSL_MIRROR_PORT_DEST_TRUNK   0x00000010
 Parameter dest_port is a trunk.
 
#define OPENNSL_MIRROR_PORT_EGRESS   0x00000004
 Egress mirroring.
 
#define OPENNSL_MIRROR_PORT_EGRESS_ACL   0x00000020
 Enable Egress Mirroring for ACLs.
 
#define OPENNSL_MIRROR_PORT_EGRESS_TRUE   0x00000008
 True egress mirroring.
 
#define OPENNSL_MIRROR_PORT_ENABLE   0x00000001
 Enable mirroring.
 
#define OPENNSL_MIRROR_PORT_INGRESS   0x00000002
 Ingress mirroring.
 
#define OPENNSL_MIRROR_PORT_SFLOW   0x00000040
 sFlow mirroring
 

Typedefs

typedef struct
opennsl_mirror_destination_s 
opennsl_mirror_destination_t
 Mirror destination Structure.
 
typedef int(* opennsl_mirror_destination_traverse_cb )(int unit, opennsl_mirror_destination_t *mirror_dest, void *user_data)
 
typedef struct
opennsl_mirror_options_s 
opennsl_mirror_options_t
 represents the options for the mirroring of packets
 
typedef struct
opennsl_mirror_pkt_erspan_encap_s 
opennsl_mirror_pkt_erspan_encap_t
 Contains information required for ERSPAN encapsulation header.
 
typedef struct
opennsl_mirror_port_info_s 
opennsl_mirror_port_info_t
 Mirror port Structure.
 

Functions

int opennsl_mirror_destination_create (int unit, opennsl_mirror_destination_t *mirror_dest) LIB_DLL_EXPORTED
 Add mirror destination descriptor.
 
int opennsl_mirror_destination_destroy (int unit, opennsl_gport_t mirror_dest_id) LIB_DLL_EXPORTED
 Remove mirror destination descriptor.
 
int opennsl_mirror_destination_get (int unit, opennsl_gport_t mirror_dest_id, opennsl_mirror_destination_t *mirror_dest) LIB_DLL_EXPORTED
 Read content of mirror destination descriptor.
 
void opennsl_mirror_destination_t_init (opennsl_mirror_destination_t *mirror_dest) LIB_DLL_EXPORTED
 Initialize a mirror destination structure.
 
int opennsl_mirror_destination_traverse (int unit, opennsl_mirror_destination_traverse_cb cb, void *user_data) LIB_DLL_EXPORTED
 Traverse over all installed mirror destination descriptors.
 
int opennsl_mirror_egress_get (int unit, opennsl_port_t port, int *val) LIB_DLL_EXPORTED
 Get the egress mirroring enabled/disabled status for a port on the device.
 
int opennsl_mirror_egress_set (int unit, opennsl_port_t port, int val) LIB_DLL_EXPORTED
 Enable or Disable egress mirroring for a port on the device.
 
int opennsl_mirror_ingress_get (int unit, opennsl_port_t port, int *val) LIB_DLL_EXPORTED
 Get the ingress mirroring enabled/disabled status for a port on the device.
 
int opennsl_mirror_ingress_set (int unit, opennsl_port_t port, int val) LIB_DLL_EXPORTED
 Enable or Disable ingress mirroring for a port on the device.
 
int opennsl_mirror_init (int unit) LIB_DLL_EXPORTED
 Initialize the mirroring module to its initial configuration.
 
int opennsl_mirror_mode_get (int unit, int *mode) LIB_DLL_EXPORTED
 Get the current mirroring mode for the device.
 
int opennsl_mirror_mode_set (int unit, int mode) LIB_DLL_EXPORTED
 Set the current mirroring mode for the device.
 
int opennsl_mirror_port_dest_add (int unit, opennsl_port_t port, uint32 flags, opennsl_gport_t mirror_dest_id) LIB_DLL_EXPORTED
 Add mirroring destination to a port.
 
int opennsl_mirror_port_dest_delete (int unit, opennsl_port_t port, uint32 flags, opennsl_gport_t mirror_dest_id) LIB_DLL_EXPORTED
 Delete mirroring destination from a port.
 
int opennsl_mirror_port_dest_delete_all (int unit, opennsl_port_t port, uint32 flags) LIB_DLL_EXPORTED
 Delete all mirroring destinations from a port.
 
int opennsl_mirror_port_dest_get (int unit, opennsl_port_t port, uint32 flags, int mirror_dest_size, opennsl_gport_t *mirror_dest, int *mirror_dest_count) LIB_DLL_EXPORTED
 Get port mirroring destinations.
 
int opennsl_mirror_port_get (int unit, opennsl_port_t port, opennsl_module_t *dest_mod, opennsl_port_t *dest_port, uint32 *flags) LIB_DLL_EXPORTED
 Get mirroring configuration for a port.
 
int opennsl_mirror_port_info_get (int unit, opennsl_port_t port, uint32 flags, opennsl_mirror_port_info_t *info) LIB_DLL_EXPORTED
 Get mirroring information per port.
 
int opennsl_mirror_port_info_set (int unit, opennsl_port_t port, uint32 flags, opennsl_mirror_port_info_t *info) LIB_DLL_EXPORTED
 Set mirroring information per port.
 
void opennsl_mirror_port_info_t_init (opennsl_mirror_port_info_t *info) LIB_DLL_EXPORTED
 Initialize a mirror port information structure.
 
int opennsl_mirror_port_set (int unit, opennsl_port_t port, opennsl_module_t dest_mod, opennsl_port_t dest_port, uint32 flags) LIB_DLL_EXPORTED
 Set mirroring configuration for a port.
 
int opennsl_mirror_port_vlan_dest_add (int unit, opennsl_port_t port, opennsl_vlan_t vlan, uint32 flags, opennsl_gport_t destid) LIB_DLL_EXPORTED
 Add mirroring destination to a port-vlan.
 
int opennsl_mirror_port_vlan_dest_delete (int unit, opennsl_port_t port, opennsl_vlan_t vlan, uint32 flags, opennsl_gport_t destid) LIB_DLL_EXPORTED
 Delete mirroring destination from a port-vlan.
 
int opennsl_mirror_port_vlan_dest_delete_all (int unit, opennsl_port_t port, opennsl_vlan_t vlan, uint32 flags) LIB_DLL_EXPORTED
 Delete all mirroring destinations from a port-vlan.
 
int opennsl_mirror_port_vlan_dest_get (int unit, opennsl_port_t port, opennsl_vlan_t vlan, uint32 flags, uint32 mirror_dest_size, opennsl_gport_t *destid, uint32 *destcount) LIB_DLL_EXPORTED
 Get port-vlan mirroring destinations.
 
int opennsl_mirror_port_vlan_get (int unit, opennsl_port_t port, opennsl_vlan_t vlan, opennsl_gport_t *dest_port, uint32 *flags) LIB_DLL_EXPORTED
 Get mirroring configuration for a port-vlan.
 
int opennsl_mirror_port_vlan_set (int unit, opennsl_port_t port, opennsl_vlan_t vlan, opennsl_gport_t destport, uint32 flags) LIB_DLL_EXPORTED
 Set mirroring configuration for a port-vlan.
 
int opennsl_mirror_to_get (int unit, opennsl_port_t *port) LIB_DLL_EXPORTED
 Get the mirror-to port for the device.
 
int opennsl_mirror_to_pbmp_get (int unit, opennsl_port_t port, opennsl_pbmp_t *pbmp) LIB_DLL_EXPORTED
 Get the mirror-to port bitmap for the device.
 
int opennsl_mirror_to_pbmp_set (int unit, opennsl_port_t port, opennsl_pbmp_t pbmp) LIB_DLL_EXPORTED
 Set the mirror-to port bitmap for the device.
 
int opennsl_mirror_to_set (int unit, opennsl_port_t port) LIB_DLL_EXPORTED
 Set the mirror-to port for the device.
 
int opennsl_mirror_vlan_get (int unit, opennsl_port_t port, uint16 *tpid, uint16 *vlan) LIB_DLL_EXPORTED
 Get VLAN for egressing mirrored packets on a port (RSPAN).
 
int opennsl_mirror_vlan_set (int unit, opennsl_port_t port, uint16 tpid, uint16 vlan) LIB_DLL_EXPORTED
 Set VLAN for egressing mirrored packets on a port (RSPAN).
 

Detailed Description

Macro Definition Documentation

#define OPENNSL_MIRROR_DEST_DEST_MULTICAST   (1 << 9)

destination is ingress multicast

Definition at line 40 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_DROP_FWD_IF_SNIFF_DROPPED   (1 << 22)

Drop the original packet if the sniff packet is dropped.

Definition at line 82 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_DROP_SNIFF_IF_FWD_DROPPED   (1 << 21)

Drop the sniff packet if the original packet is dropped.

Definition at line 77 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_EGRESS_ADD_ORIG_SYSTEM_HEADER   (1 << 18)

The start of the original packet system header will be included in the outbound mirrored packets.

Definition at line 65 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_EGRESS_TRAP_WITH_SYSTEM_HEADER   (1 << 28)

For packets recycled by egress applications and not forwarded, retain the incoming packet's system headers as received from the fabric, and in case of an Egress MC packet, stamp the FTMH.OutLIF field with the CUD.

Definition at line 97 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_FIELD   (1 << 19)

Specify that mirror destination owner is FP.

Definition at line 71 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_FLAGS2_TUNNEL_VXLAN   (1 << 0)

Mirror Tunnel is VXLAN.

Definition at line 118 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_ID_SHARE   (1 << 24)

Share mirror destination id among multi ports.

Definition at line 85 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_INT_PRI_SET   (1 << 13)

Mirrored packet should set with internal priority.

Definition at line 47 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_IS_SNOOP   (1 << 16)

Specify that the destination type is a snoop destination.

Definition at line 55 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_IS_STAT_SAMPLE   (1 << 17)

Specify that the destination type is a STATISTIC SAMPLING destination.

Definition at line 61 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_IS_TRAP   (1 << 17)

Specify that the destination is a trap destination.

Definition at line 58 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_MTP_ADD   (1 << 25)

Add an MTP into a shared-id mirror destination.

Definition at line 88 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_MTP_DELETE   (1 << 26)

Delete an MTP from a shared-id mirror destination.

Definition at line 91 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_MTP_REPLACE   (1 << 27)

REPLACE an MTP of a shared-id mirror destination.

Definition at line 94 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_NO_COUNT   -2

Value to disable counting of the snooped/mirrored copy.

Definition at line 385 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_OUT_MIRROR_DISABLE   (1 << 30)

Assert out mirror disable.

Definition at line 111 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_PAYLOAD_UNTAGGED   (1 << 4)

Strip vlan tag from mirrored packet.

Definition at line 30 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_PORT   (1 << 20)

Specify that mirror destination owner is PORT.

Definition at line 74 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_REPLACE   (1 << 0)

Replace mirror destination.

Definition at line 22 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_ETAG   (1 << 14)

Mirrored packet should be ETAG tunneled.

Definition at line 50 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_IP_GRE   (1 << 3)

Mirrored packet should be L3 GRE tunneled.

Definition at line 28 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_L2   (1 << 2)

Mirrored packet should be L2 tunneled.

Definition at line 26 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_NIV   (1 << 6)

Mirrored packet should be NIV tunneled.

Definition at line 34 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_PSAMP   (1 << 29)

Update mirror destination with PSAMP encapsulation.

Definition at line 108 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_RSPAN   (1 << 12)

Mirrored packet should be RSPAN (VLAN) tunneled.

Definition at line 44 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_SFLOW   (1 << 15)

Mirrored packet should be with sFlow encapsulation.

Definition at line 52 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_TRILL   (1 << 5)

Mirrored packet should be TRILL tunneled.

Definition at line 32 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_WITH_ENCAP_ID   (1 << 10)

Mirror destination encap_id is valid.

Definition at line 42 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_TUNNEL_WITH_SEQ   (1 << 31)

Include Sequence number in header.

Definition at line 113 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_UPDATE_COUNTER   (1 << 8)

update counter using stat_id

Definition at line 38 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_UPDATE_COUNTER_1   (1 << 21)

update counter No.1

Definition at line 80 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_UPDATE_COUNTER_2   (1 << 22)

update counter No.2

Definition at line 81 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_UPDATE_EXT_COUNTERS   (1 << 31)

Set statistic interfaces for mirrored packets.

Definition at line 115 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_UPDATE_POLICER   (1 << 7)

update policer using policer_id

Definition at line 36 of file mirrorX.h.

#define OPENNSL_MIRROR_DEST_WITH_ID   (1 << 1)

Mirror destination id is valid.

Definition at line 24 of file mirrorX.h.

#define OPENNSL_MIRROR_DISABLE   0

Disable mirroring.

Definition at line 30 of file mirror.h.

#define OPENNSL_MIRROR_EXT_STAT_ID_COUNT   2

Number of statistic interfaces for mirrored packets.

Definition at line 44 of file mirror.h.

#define OPENNSL_MIRROR_L2   1

Enable mirroring.

Definition at line 31 of file mirror.h.

#define OPENNSL_MIRROR_L2_L3   2

Deprecated.

Definition at line 32 of file mirror.h.

#define OPENNSL_MIRROR_NIV_LOOP   1

Mirrored packet is a loop in NIV path.

Definition at line 42 of file mirror.h.

#define OPENNSL_MIRROR_PORT_DEST_TRUNK   0x00000010

Parameter dest_port is a trunk.

Definition at line 37 of file mirror.h.

#define OPENNSL_MIRROR_PORT_EGRESS   0x00000004

Egress mirroring.

Definition at line 35 of file mirror.h.

#define OPENNSL_MIRROR_PORT_EGRESS_ACL   0x00000020

Enable Egress Mirroring for ACLs.

Definition at line 39 of file mirror.h.

#define OPENNSL_MIRROR_PORT_EGRESS_TRUE   0x00000008

True egress mirroring.

Definition at line 36 of file mirror.h.

#define OPENNSL_MIRROR_PORT_ENABLE   0x00000001

Enable mirroring.

Definition at line 33 of file mirror.h.

#define OPENNSL_MIRROR_PORT_INGRESS   0x00000002

Ingress mirroring.

Definition at line 34 of file mirror.h.

#define OPENNSL_MIRROR_PORT_SFLOW   0x00000040

sFlow mirroring

Definition at line 41 of file mirror.h.

Typedef Documentation

Mirror destination Structure.

Contains information required for manipulating mirror destinations.

typedef int(* opennsl_mirror_destination_traverse_cb)(int unit, opennsl_mirror_destination_t *mirror_dest, void *user_data)

Definition at line 205 of file mirrorX.h.

represents the options for the mirroring of packets

Contains information required for ERSPAN encapsulation header.

Mirror port Structure.

Contains information required for mirror port settings.

Function Documentation

int opennsl_mirror_destination_create ( int  unit,
opennsl_mirror_destination_t mirror_dest 
)

Add mirror destination descriptor.

Description
Add mirroring destination descriptor. Descriptor contains mirrored traffic destination (gport) and mirrored traffic encapsulation. mirror_dest_id: is returned to application to be used in mirror_port_dest_add/delete APIs. If the destination has already been created, a OPENNSL_E_EXISTS error will be returned. But the matching mirror destinations with tunnel type will be skipped. The mirror_dest_id for such a destination may be recovered with =opennsl_mirror_destination_get . .
Parameters
unit[IN] Unit number.
mirror_dest[IN,OUT] Mirrored destination and encapsulation
Return values
OPENNSL_E_XXX
int opennsl_mirror_destination_destroy ( int  unit,
opennsl_gport_t  mirror_dest_id 
)

Remove mirror destination descriptor.

Description
Remove mirroring destination descriptor. OPENNSL_E_BUSY will be returned if descriptor is in use. .
Parameters
unit[IN] Unit number.
mirror_dest_id[IN] Mirrored destination ID to be removed.
Return values
OPENNSL_E_XXX
int opennsl_mirror_destination_get ( int  unit,
opennsl_gport_t  mirror_dest_id,
opennsl_mirror_destination_t mirror_dest 
)

Read content of mirror destination descriptor.

Description
Read content of mirror destination descriptor corresponding to the provided mirror_dest_id. If the mirror_dest_id argument is OPENNSL_GPORT_INVALID, then the mirror_dest information is checked to match an existing mirror destination. But the matching mirror destinations with tunnel type will be skipped. If a match is found, the mirror_dest.mirror_dest_id field is updated with the ID for this destination description. This will recover the mirror_dest_id when =opennsl_mirror_destination_create returns a OPENNSL_E_EXISTS error.
Parameters
unit[IN] Unit number.
mirror_dest_id[IN] Mirrored destination ID to be removed.
mirror_dest[IN,OUT] Mirrored destination ID to be removed.
Return values
OPENNSL_E_XXX
void opennsl_mirror_destination_t_init ( opennsl_mirror_destination_t mirror_dest)

Initialize a mirror destination structure.

Description
Initialize a mirror destination structure.
Parameters
mirror_dest[IN,OUT] Pointer to the struct to be initialized
Return values
None.
int opennsl_mirror_destination_traverse ( int  unit,
opennsl_mirror_destination_traverse_cb  cb,
void *  user_data 
)

Traverse over all installed mirror destination descriptors.

Parameters
unit[IN] Unit number.
cb[IN] Traverse callback.
user_data[IN] User provided cookie.
Return values
OPENNSL_E_XXXTraverse over all installed mirror destination descriptors. For each valid destination user callback is called with user_data provided in function call.
int opennsl_mirror_egress_get ( int  unit,
opennsl_port_t  port,
int *  val 
)

Get the egress mirroring enabled/disabled status for a port on the device.

Description
Get the egress mirroring enabled/disabled status for a port on the device.
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number for which to retrieve egress mirroring status.
val[OUT] Boolean value for on/off
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_PORTInvalid port
OPENNSL_E_INITModule is not initialized.
OPENNSL_E_XXXOther errors
int opennsl_mirror_egress_set ( int  unit,
opennsl_port_t  port,
int  val 
)

Enable or Disable egress mirroring for a port on the device.

Description
Enable or Disable the egress mirroring for a port on the device. Mirroring must also be globally enabled using.
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number to enable egress mirroring on.
val[IN] Boolean value for on/off
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_PORTInvalid port
OPENNSL_E_INITModule is not initialized.
OPENNSL_E_XXXOther errors
int opennsl_mirror_ingress_get ( int  unit,
opennsl_port_t  port,
int *  val 
)

Get the ingress mirroring enabled/disabled status for a port on the device.

Description
Get the ingress mirroring enabled/disabled status for a port on the device. This call supersedes opennsl_port_mirror_enable_get.
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number for which to retrieve ingress mirroring status.
val[OUT] Boolean value for on/off
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_PORTInvalid port
OPENNSL_E_INITModule is not initialized.
OPENNSL_E_XXXOther errors
int opennsl_mirror_ingress_set ( int  unit,
opennsl_port_t  port,
int  val 
)

Enable or Disable ingress mirroring for a port on the device.

Description
Enable or Disable the ingress mirroring for a port on the device. This call supersedes opennsl_port_mirror_enable_set. Mirroring must also be globally enabled using =opennsl_mirror_mode_set .
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number to get ingress mirroring enable status on.
val[IN] Boolean value for on/off
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_PORTInvalid port
OPENNSL_E_INITModule is not initialized.
OPENNSL_E_XXXOther errors
int opennsl_mirror_init ( int  unit)

Initialize the mirroring module to its initial configuration.

Description
Initializes the mirroring module. Mirroring is disabled on the device. .
Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_XXXOther errors
int opennsl_mirror_mode_get ( int  unit,
int *  mode 
)

Get the current mirroring mode for the device.

Description
Get the current mirroring mode for the device.
Parameters
unit[IN] Unit number.
mode[OUT] OPENNSL Mirroring mode
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_XXXOther errors
int opennsl_mirror_mode_set ( int  unit,
int  mode 
)

Set the current mirroring mode for the device.

Description
Enable or disable mirroring according to the mirror mode. This API function is intended to be used when the configuration of ONE (and only one) mirror-to-port per device is used, and in conjunction with opennsl_mirror_to_set. When enabling mirroring, the device is only configured after opennsl_mirror_to_set is called to set up the mirror-to-port. If multiple mirror-to-port operation is needed, use opennsl_mirror_port_dest_add for switch family III switch chips and opennsl_mirror_to_pbmp_set for network switch fabric chips. Other switch chips do not support multiple mirror-to-ports. .
Parameters
unit[IN] Unit number.
mode[IN] OPENNSL Mirroring mode
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNAVAILOn non switch family switch devices
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_XXXOther errors
int opennsl_mirror_port_dest_add ( int  unit,
opennsl_port_t  port,
uint32  flags,
opennsl_gport_t  mirror_dest_id 
)

Add mirroring destination to a port.

Description
Add mirroring destination to a port. This API can be called multiple times on devices that support multiple mirror destinations per-port.
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
flags[IN] OPENNSL_MIRROR_PORT_*
mirror_dest_id[IN]
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_dest_delete ( int  unit,
opennsl_port_t  port,
uint32  flags,
opennsl_gport_t  mirror_dest_id 
)

Delete mirroring destination from a port.

Description
Delete mirroring destination from a port.
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
flags[IN] OPENNSL_MIRROR_PORT_*
mirror_dest_id[IN]
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_dest_delete_all ( int  unit,
opennsl_port_t  port,
uint32  flags 
)

Delete all mirroring destinations from a port.

Description
Delete all mirroring destinations of the specified type(s) from a port.
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
flags[IN] OPENNSL_MIRROR_PORT_*
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_dest_get ( int  unit,
opennsl_port_t  port,
uint32  flags,
int  mirror_dest_size,
opennsl_gport_t mirror_dest,
int *  mirror_dest_count 
)

Get port mirroring destinations.

Description
Get port mirroring destinations. .
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
flags[IN] OPENNSL_MIRROR_PORT_*
mirror_dest_size[IN] Size of allocated entries in mirror_dest array.
mirror_dest[OUT] Size of allocated entries in mirror_dest array.
mirror_dest_count[OUT] Actual number of mirror destinations. This will be a value less than or equal to the value passed in as mirror_dest_size unless mirror_dest_size is 0. If mirror_dest_size is 0 then mirror_dest is ignored and mirror_dest_count is filled in with the number of entries that would have been filled into mirror_dest if mirror_dest_size was arbitrarily large.
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_get ( int  unit,
opennsl_port_t  port,
opennsl_module_t dest_mod,
opennsl_port_t dest_port,
uint32 flags 
)

Get mirroring configuration for a port.

Description
Get mirroring configuration for a port. If no flags are set when the function returns, the contents of the dest_* parameters is undefined.
Parameters
unit[IN] Unit number.
port[IN] Port number to get configuration for
dest_mod[OUT] Module ID of mirror-to port
dest_port[OUT] Mirror-to port
flags[OUT] OPENNSL_MIRROR_PORT_* flags
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_port_info_get ( int  unit,
opennsl_port_t  port,
uint32  flags,
opennsl_mirror_port_info_t info 
)

Get mirroring information per port.

Description
Get mirroring information per port, flags. .
Parameters
unit[IN] Unit number.
port[IN] Port number to configure
flags[IN] OPENNSL_MIRROR_PORT_* flags
info[OUT] Mirror port information.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_port_info_set ( int  unit,
opennsl_port_t  port,
uint32  flags,
opennsl_mirror_port_info_t info 
)

Set mirroring information per port.

Description
Set mirroring information per port, flags. Set System-mirror-ID per port.
Parameters
unit[IN] Unit number.
port[IN] Port number to configure
flags[IN] OPENNSL_MIRROR_PORT_* flags
info[IN] Mirror port information.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
void opennsl_mirror_port_info_t_init ( opennsl_mirror_port_info_t info)

Initialize a mirror port information structure.

Description
Initialize a mirror port information structure.
Parameters
info[IN,OUT] Pointer to the struct to be initialized
Return values
None.
int opennsl_mirror_port_set ( int  unit,
opennsl_port_t  port,
opennsl_module_t  dest_mod,
opennsl_port_t  dest_port,
uint32  flags 
)

Set mirroring configuration for a port.

Description
Configure a port to be mirrored on another port or trunk group. The mirror-to port or mirror mode can be changed by calling the _set function repetitively. For example: In case the mirroring mode is changed from, ingress to ingress+egress, both flags must be specified when the _set function is called the second time, that is, if only the egress flag is specified, the currently active ingress mirroring will be disabled. To disable mirroring of a port, set the flags parameter to 0 (zero) in the _set command. In this case the mirror-to port parameters are ignored. If opennslSwitchDirectedMirroring is disabled for the unit and dest_mod is non-negative, then the dest_mod path is looked up using.
Parameters
unit[IN] Unit number.
port[IN] Port number to configure
dest_mod[IN] Module ID of mirror-to port (-1 for local port)
dest_port[IN] Mirror-to port
flags[IN] OPENNSL_MIRROR_PORT_* flags
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_port_vlan_dest_add ( int  unit,
opennsl_port_t  port,
opennsl_vlan_t  vlan,
uint32  flags,
opennsl_gport_t  destid 
)

Add mirroring destination to a port-vlan.

Description
Add mirroring destination to a port-vlan. This API can be called multiple times on devices that support multiple mirror destinations per-port-vlan.
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
vlan[IN] Mirrored vlan
flags[IN] OPENNSL_MIRROR_PORT_*
destid[IN] Destination GPORT Must be OPENNSL_GPORT_MIRROR.
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_vlan_dest_delete ( int  unit,
opennsl_port_t  port,
opennsl_vlan_t  vlan,
uint32  flags,
opennsl_gport_t  destid 
)

Delete mirroring destination from a port-vlan.

Description
Delete mirroring destination from a port-vlan.
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
vlan[IN] Mirrored vlan
flags[IN] OPENNSL_MIRROR_PORT_*
destid[IN] Destination GPORT Must be OPENNSL_GPORT_MIRROR.
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_vlan_dest_delete_all ( int  unit,
opennsl_port_t  port,
opennsl_vlan_t  vlan,
uint32  flags 
)

Delete all mirroring destinations from a port-vlan.

Description
Delete all mirroring destinations of the specified type(s) from a port-vlan.
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
vlan[IN] Mirrored vlan
flags[IN] OPENNSL_MIRROR_PORT_*
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_vlan_dest_get ( int  unit,
opennsl_port_t  port,
opennsl_vlan_t  vlan,
uint32  flags,
uint32  mirror_dest_size,
opennsl_gport_t destid,
uint32 destcount 
)

Get port-vlan mirroring destinations.

Description
Get port-vlan mirroring destinations. .
Parameters
unit[IN] Unit number.
port[IN] Mirrored port
vlan[IN] Mirrored vlan
flags[IN] OPENNSL_MIRROR_PORT_*
mirror_dest_size[IN] Size of allocated entries in mirror_dest array.
destid[OUT] Array for mirror destinations information
destcount[OUT] Actual number of mirror destinations. This will be a value less than or equal to the value passed in as mirror_dest_size unless mirror_dest_size is 0. If mirror_dest_size is 0 then mirror_dest is ignored and mirror_dest_count is filled in with the number of entries that would have been filled into mirror_dest if mirror_dest_size was arbitrarily large.
Return values
OPENNSL_E_XXX
int opennsl_mirror_port_vlan_get ( int  unit,
opennsl_port_t  port,
opennsl_vlan_t  vlan,
opennsl_gport_t dest_port,
uint32 flags 
)

Get mirroring configuration for a port-vlan.

Description
Get mirroring configuration for a port-vlan. If no flags are set when the function returns, the contents of the dest_* parameters is undefined.
Parameters
unit[IN] Unit number.
port[IN] Port number to get configuration for
vlan[IN] Vlan number to get configuration for
dest_port[OUT]
flags[OUT] OPENNSL_MIRROR_PORT_* flags
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_port_vlan_set ( int  unit,
opennsl_port_t  port,
opennsl_vlan_t  vlan,
opennsl_gport_t  destport,
uint32  flags 
)

Set mirroring configuration for a port-vlan.

Description
Configure a port-vlan to be mirrored on another port-vlan or trunk group. The mirror-to port-vlan or mirror mode can be changed by calling the _set function repetitively. For example: In case the mirroring mode is changed from, ingress to ingress+egress, both flags must be specified when the _set function is called the second time, that is, if only the egress flag is specified, the currently active ingress mirroring will be disabled. To disable mirroring of a port-vlan, set the flags parameter to 0 (zero) in the _set command. In this case the mirror-to port-vlan parameters are ignored.
Parameters
unit[IN] Unit number.
port[IN] Port number to configure
vlan[IN] Vlan number to configure
destport[IN] Mirror-to port
flags[IN] OPENNSL_MIRROR_PORT_* flags
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_to_get ( int  unit,
opennsl_port_t port 
)

Get the mirror-to port for the device.

Description
Get the mirror-to port for the device. port = -1 if no mirror-to port has been set.
Parameters
unit[IN] Unit number.
port[OUT] Device or logical port number to mirror all ingress/egress selections to.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_XXXOther errors
int opennsl_mirror_to_pbmp_get ( int  unit,
opennsl_port_t  port,
opennsl_pbmp_t pbmp 
)

Get the mirror-to port bitmap for the device.

Description
Get the mirror-to port bitmap for the device. This API interface is only supported on network switch fabric chips.
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number
pbmp[OUT] The port bitmap of mirror-to ports for this port
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_to_pbmp_set ( int  unit,
opennsl_port_t  port,
opennsl_pbmp_t  pbmp 
)

Set the mirror-to port bitmap for the device.

Description
Set the mirror-to port bitmap for the device. This API interface is only supported on network switch fabric chips.
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number
pbmp[IN] The port bitmap of mirror-to ports for this port
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_to_set ( int  unit,
opennsl_port_t  port 
)

Set the mirror-to port for the device.

Description
Set the mirror-to port for the device. This API function set ONE (and only one) mirror-to-port per device. If multiple mirror-to-port operation is needed, use opennsl_mirror_port_dest_add for switch family III switch chips and opennsl_mirror_to_pbmp_set for network switch fabric chips. Other switch chips do not support multiple mirror-to-ports. If the opennslSwitchDirectedMirroring switch control is disabled (or unsupported), the mirror-to port must be a member of the same VLANs as the mirrored port. If the opennslSwitchDirectedMirroring switch control is enabled, or the unit only supports directed mirroring, then OPENNSL_E_CONFIG will be returned.
Parameters
unit[IN] Unit number.
port[IN] Device or logical port number to mirror all ingress/egress selections to.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID.
OPENNSL_E_CONFIGOperation not supported for directed mirroring configurations.
OPENNSL_E_XXXOther errors
int opennsl_mirror_vlan_get ( int  unit,
opennsl_port_t  port,
uint16 tpid,
uint16 vlan 
)

Get VLAN for egressing mirrored packets on a port (RSPAN).

Description
When a tag protocol ID and VLAN is configured for a port, all packets mirrored to this port will be tagged with the corresponding RSPAN tag.
Parameters
unit[IN] Unit number.
port[IN] Port number to configure
tpid[OUT] Tag protocol ID
vlan[OUT] VLAN number
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors
int opennsl_mirror_vlan_set ( int  unit,
opennsl_port_t  port,
uint16  tpid,
uint16  vlan 
)

Set VLAN for egressing mirrored packets on a port (RSPAN).

Description
When a tag protocol ID and VLAN is configured for a port, all packets mirrored to this port will be tagged with the corresponding RSPAN tag.
Parameters
unit[IN] Unit number.
port[IN] Port number to configure
tpid[IN] Tag protocol ID (0 to disable)
vlan[IN] VLAN number (0 to disable)
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_UNITInvalid OPENNSL device ID
OPENNSL_E_PORTInvalid port
OPENNSL_E_XXXOther errors