Ack.
Not tested.

Regards,
Ramesh.

On 3/18/2016 9:30 PM, Anders Widell wrote:
>   osaf/libs/core/common/ncs_main_pub.c   |  13 ++++---------
>   osaf/libs/core/include/ncs_main_papi.h |  16 ++++++++++++++++
>   osaf/libs/core/include/ncsgl_defs.h    |   7 ++++++-
>   3 files changed, 26 insertions(+), 10 deletions(-)
>
>
> Add new utility functions for extracting Slot, Subslot and Chassis from a Node
> ID. Also add a new constant for the maximum supported number of slots and
> subslots in the system.
>
> diff --git a/osaf/libs/core/common/ncs_main_pub.c 
> b/osaf/libs/core/common/ncs_main_pub.c
> --- a/osaf/libs/core/common/ncs_main_pub.c
> +++ b/osaf/libs/core/common/ncs_main_pub.c
> @@ -139,7 +139,7 @@ typedef struct ncs_main_pub_cb {
>   } NCS_MAIN_PUB_CB;
>   
>   typedef struct ncs_sys_params {
> -     NCS_PHY_SLOT_ID slot_id;
> +     SlotSubslotId slot_subslot_id;
>       NCS_CHASSIS_ID shelf_id;
>       NCS_NODE_ID node_id;
>       uint32_t cluster_id;
> @@ -714,7 +714,6 @@ void ncs_get_sys_params_arg(NCS_SYS_PARA
>       char *p_field;
>       uint32_t tmp_ctr;
>       uint32_t orig_argc;
> -     NCS_SUB_SLOT_ID sub_slot_id = 0;
>       NCS_SYS_PARAMS params;
>       char *ptr;
>       int argc = 0;
> @@ -756,17 +755,13 @@ void ncs_get_sys_params_arg(NCS_SYS_PARA
>   
>       gl_ncs_main_pub_cb.my_nodeid = sys_params->node_id;
>   
> -     if (m_NCS_GET_PHYINFO_FROM_NODE_ID(sys_params->node_id, 
> &sys_params->shelf_id,
> -                                        &sys_params->slot_id, &sub_slot_id) 
> != NCSCC_RC_SUCCESS) {
> -
> -             m_LEAP_DBG_SINK_VOID;
> -             return;
> -     }
> +     sys_params->shelf_id = GetChassisIdFromNodeId(sys_params->node_id);
> +     sys_params->slot_subslot_id = 
> GetSlotSubslotIdFromNodeId(sys_params->node_id);
>   
>       sprintf(gl_pargv[orig_argc + 0], "NONE");
>       sprintf(gl_pargv[orig_argc + 1], "CLUSTER_ID=%d", 
> sys_params->cluster_id);
>       sprintf(gl_pargv[orig_argc + 2], "SHELF_ID=%d", sys_params->shelf_id);
> -     sprintf(gl_pargv[orig_argc + 3], "SLOT_ID=%d", sys_params->slot_id);
> +     sprintf(gl_pargv[orig_argc + 3], "SLOT_ID=%d", 
> sys_params->slot_subslot_id);
>       sprintf(gl_pargv[orig_argc + 4], "NODE_ID=%d", sys_params->node_id);
>       sprintf(gl_pargv[orig_argc + 5], "PCON_ID=%d", sys_params->pcon_id);
>   
> diff --git a/osaf/libs/core/include/ncs_main_papi.h 
> b/osaf/libs/core/include/ncs_main_papi.h
> --- a/osaf/libs/core/include/ncs_main_papi.h
> +++ b/osaf/libs/core/include/ncs_main_papi.h
> @@ -112,6 +112,22 @@ extern "C" {
>                                                  NCS_CHASSIS_ID *o_chassis_id,
>                                                  NCS_PHY_SLOT_ID 
> *o_phy_slot_id, NCS_SUB_SLOT_ID *o_sub_slot_id);
>   
> +static inline NCS_CHASSIS_ID GetChassisIdFromNodeId(NCS_NODE_ID node_id)
> +{
> +     uint32_t kChassisMask = 0xff;
> +     uint32_t chassis_id = (((uint32_t) node_id) >> 16) & kChassisMask;
> +     return chassis_id;
> +}
> +
> +static inline SlotSubslotId GetSlotSubslotIdFromNodeId(NCS_NODE_ID node_id)
> +{
> +     uint32_t kSubslotMask = 0xf;
> +     uint32_t kSlotMask = 0xff;
> +     uint32_t subslot_id = ((uint32_t) node_id) & kSubslotMask;
> +     uint32_t slot_id = (((uint32_t) node_id) >> 8) & kSlotMask;
> +     return ((subslot_id ^ kSubslotMask) << 8) | slot_id;
> +}
> +
>   #ifdef  __cplusplus
>   }
>   #endif
> diff --git a/osaf/libs/core/include/ncsgl_defs.h 
> b/osaf/libs/core/include/ncsgl_defs.h
> --- a/osaf/libs/core/include/ncsgl_defs.h
> +++ b/osaf/libs/core/include/ncsgl_defs.h
> @@ -73,8 +73,12 @@ extern "C" {
>   
>   /*************************************************
>    * Maximum Slots (Including sub slots) supported
> - * 16 slots x 8 subslots
> + * 256 slots x 16 subslots
>    *************************************************/
> +enum {
> +     kMaxSlotsSubslots = 4096
> +};
> +
>   #define NCS_SLOT_MAX 16
>   
>   #define NCS_SUB_SLOT_MAX 16
> @@ -86,6 +90,7 @@ extern "C" {
>       typedef uint8_t NCS_CHASSIS_ID;
>       typedef uint8_t NCS_PHY_SLOT_ID;
>       typedef uint8_t NCS_SUB_SLOT_ID;
> +     typedef uint32_t SlotSubslotId;
>   
>   /* m_NCS_NODE_ID_FROM_MDS_DEST: Returns node-id if the MDS_DEST provided
>                                   is an absolute destination. Returns 0


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to