Hi,

The function opensm/osm_lin_fwd_table.c:osm_lin_tbl_new() invokes __osm_lin_tbl_compute_obj_size with a 'size' parameter that is obviously a LID (uint16_t). However, the prototype for __osm_lin_tbl_compute_obj_size is:

static inline size_t __osm_lin_tbl_compute_obj_size(IN const uint32_t num_ports)

Furthermore, the comments in the osm_lin_fwd_tbl_t declaration say:

*    port_tbl
*        The array that specifies the port number which routes the
*        corresponding LID.  Index is by LID.
*

Am I right in saying that the prototype for __osm_lin_tbl_compute_obj_size() should be:

static inline size_t __osm_lin_tbl_compute_obj_size(IN const uint16_t num_lids)

This would avoid casting its return value as follows in osm_lin_tbl_new():

p_tbl->size = (uint16_t) size;

Also, could anyone explain why the osm_lin_fwd_tbl_t is declared as follows:

typedef struct _osm_lin_fwd_tbl {
   uint16_t size;
   uint8_t port_tbl[1];
} osm_lin_fwd_tbl_t;

This prototype is obviously quite different than the corresponding malloc'ed space in __osm_lin_tbl_compute_obj_size():

return (sizeof(osm_lin_fwd_tbl_t) + (num_ports - 1));

Thanks,

Vincent


_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to