msp_hash.h File Reference

Data structure for MSP HASH computation API. More...


Data Structures

union  msp_l4_info_s
struct  msp_ip_hash_selector_s

Defines

#define MSP_IPV6_ADDR_LEN   16
 IPv6 address length.
#define MSP_HASH_HDR_3T   0
 hash for header based on 3-tuple
#define MSP_HASH_HDR_5T   1
 hash for header based on 5-tuple
#define MSP_AF_INET   0
 IPv4 family address.
#define MSP_AF_INET6   1
 IPv6 family address.

Typedefs

typedef msp_l4_info_s msp_l4_info_t
 msp_l4_info_t
typedef msp_ip_hash_selector_s msp_ip_hash_selector_t
 msp_ip_hash_selector_t

Functions

u_int32_t msp_hash (msp_ip_hash_selector_t *sel)
 Calculate hash value based on IPv4/IPv6 addresses and L4 proto information.
int msp_cpu_affinity (msp_ip_hash_selector_t *sel, u_int8_t *vcpu)
 Find the Control Plane CPU number based on IPv4/IPv6 addresses and L4 proto information.
int msp_data_cpu_affinity (msp_ip_hash_selector_t *sel, u_int8_t *vcpu)
 Find the Data Plane CPU number based on IPv4/IPv6 addresses and L4 proto information.
int msp_data_flow_affinity_enabled (void)
 Checks whether data flow affinity is enabled in the system.


Detailed Description

Data structure for MSP HASH computation API.


Typedef Documentation

typedef struct msp_ip_hash_selector_s msp_ip_hash_selector_t
 

msp_ip_hash_selector_t

This structure holds layer 3 flow selector information and is used to calculate hash values for 3 or 5 tuple flows based on IPv4 or IPv6 address.

typedef union msp_l4_info_s msp_l4_info_t
 

msp_l4_info_t

This structure holds layer 4 flow selector information and is used as part of the msp_flow_selector_v4_t selector structure.


Function Documentation

int msp_cpu_affinity msp_ip_hash_selector_t sel,
u_int8_t *  vcpu
 

Find the Control Plane CPU number based on IPv4/IPv6 addresses and L4 proto information.

The cpu affinity is calculated based on the hash value provided by msp_hash API.

Parameters:
[in] *sel Pointer to the msp_ip_hash_selector_t selector struct
[out] *vcpu calculated Control CPU number
Returns:
MSP_OK on success; otherwise, MSP_ERROR for error

int msp_data_cpu_affinity msp_ip_hash_selector_t sel,
u_int8_t *  vcpu
 

Find the Data Plane CPU number based on IPv4/IPv6 addresses and L4 proto information.

The cpu affinity is calculated based on the hash value provided by msp_hash API.

Parameters:
[in] *sel Pointer to the msp_ip_hash_selector_t selector struct
[out] *vcpu calculated Data CPU number
Returns:
MSP_OK on success; otherwise, MSP_ERROR for error or MSP_DATA_FLOWAFF_ERR if data_flow_affinty is not configured on the PIC or MSP_DATA_FLOWAFF_NOFIFO_ERR if there does not exist at least one fifo for data core.

int msp_data_flow_affinity_enabled void   ) 
 

Checks whether data flow affinity is enabled in the system.

Returns:
1, if flow affinity is enabled; otherwise 0.

u_int32_t msp_hash msp_ip_hash_selector_t sel  ) 
 

Calculate hash value based on IPv4/IPv6 addresses and L4 proto information.

Supported L4 protocol and their values are as follows:

  • IGMP (IPPROTO_IGMP 0x2)
  • TCP (IPPROTO_TCP 0x6)
  • UDP (IPPROTO_UDP 0x11)
  • ESP (IPPROTO_ESP 0x32)
  • AH (IPPROTO_AH 0x33)

Note: If unknown L4 protocol value is supplied, the API won't return an error. The hash is still calculated but the L4 bytes are ignored in the calculation.

Parameters:
[in] *sel Pointer to the msp_ip_hash_selector_t selector struct
Returns:
calculated hash value


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:47 2010 for libmp-sdk by Doxygen 1.4.5