X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Futils%2Flnetconfig%2Fliblnetconfig.h;h=b6ea68b60be425d21e578f12806e1684ff617ee0;hb=b67a8e76a50ec744af80db8bc5c4b73cb1a9ccf9;hp=a5cecda921f25066cb6d3c6ad285725a78376727;hpb=f4885dcb32c6f6da2f48f63d04ccafee08e92223;p=fs%2Flustre-release.git diff --git a/lnet/utils/lnetconfig/liblnetconfig.h b/lnet/utils/lnetconfig/liblnetconfig.h index a5cecda..b6ea68b 100644 --- a/lnet/utils/lnetconfig/liblnetconfig.h +++ b/lnet/utils/lnetconfig/liblnetconfig.h @@ -43,6 +43,23 @@ #define LUSTRE_CFG_RC_SKIP -8 #define LUSTRE_CFG_RC_LAST_ELEM -9 +enum lnetctl_cmd { + LNETCTL_CONFIG_CMD = 1, + LNETCTL_UNCONFIG_CMD = 2, + LNETCTL_ADD_CMD = 3, + LNETCTL_DEL_CMD = 4, + LNETCTL_SHOW_CMD = 5, + LNETCTL_DBG_CMD = 6, + LNETCTL_MANAGE_CMD = 7, + LNETCTL_LAST_CMD +}; + +/* + * Max number of nids we'll configure for a single peer via a single DLC + * operation + */ +#define LNET_MAX_NIDS_PER_PEER 128 + struct lnet_dlc_network_descr { struct list_head network_on_rule; __u32 nw_id; @@ -374,11 +391,18 @@ int lustre_lnet_config_retry_count(int count, int seq_no, struct cYAML **err_rc) int lustre_lnet_show_retry_count(int seq_no, struct cYAML **show_rc, struct cYAML **err_rc); +int lustre_lnet_show_lnd_timeout(int seq_no, struct cYAML **show_rc, + struct cYAML **err_rc); + int lustre_lnet_show_local_ni_recovq(int seq_no, struct cYAML **show_rc, struct cYAML **err_rc); int lustre_lnet_show_peer_ni_recovq(int seq_no, struct cYAML **show_rc, struct cYAML **err_rc); +int lustre_lnet_config_response_tracking(int count, int seq_no, + struct cYAML **err_rc); +int lustre_lnet_show_response_tracking(int seq_no, struct cYAML **show_rc, + struct cYAML **err_rc); /* * lustre_lnet_config_max_intf @@ -405,6 +429,12 @@ int lustre_lnet_show_max_intf(int seq_no, struct cYAML **show_rc, struct cYAML **err_rc); /* + * lustre_lnet_calc_service_id + * Calculate the lustre service id to be used for qos + */ +int lustre_lnet_calc_service_id(__u64 *service_id); + +/* * lustre_lnet_config_discovery * Enable or disable peer discovery. Peer discovery is enabled by default. * @@ -493,47 +523,34 @@ int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc, struct cYAML **err_rc); /* - * lustre_lnet_config_peer_nid - * Add a peer nid to a peer with primary nid pnid. If no pnid is given - * then the first nid in the nid list becomes the primary nid for - * a newly created peer. - * Otherwise if pnid is provided and it's unique then a new peer is - * created with pnid as the primary NID and the nids in the nid list as - * secondary nids. - * If any of the peers nids provided in with exception to the pnid is - * not unique the operation fails. Some peer nids might have already - * been added. It's the role of the caller of this API to remove the - * added NIDs if they wish. - * - * pnid - Primary NID of the peer - * nid - list of nids to add - * num_nids - number of nids in the nid array - * mr - true if this peer is MR capable. - * ip2nets - true if a list of nid expressions are given to configure - * multiple peers - * seq_no - sequence number of the command - * err_rc - YAML strucutre of the resultant return code. - */ -int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids, - bool mr, bool ip2nets, int seq_no, - struct cYAML **err_rc); - -/* - * lustre_lnet_del_peer_nid - * Delete the nids given in the nid list from the peer with primary NID - * pnid. If pnid is NULL or it doesn't identify a peer the operation - * fails and no change happens to the system. + * lustre_lnet_modify_peer + * Handle a peer config or delete operation. + * + * Config Operation: + * Add a peer NID to a peer with primary NID pnid. + * If the provided primary NID is unique, then a new peer is + * created with this primary NID, and the NIDs in the NID list are added as + * secondary NIDs to this new peer. + * If any of the NIDs in the NID list are not unique then the operation + * fails. Some peer NIDs might have already been added. It's the responsibility + * of the caller of this API to remove the added NIDs if so desired. + * + * Delete Operation: + * Delete the NIDs given in the NID list from the peer with the primary NID + * pnid. If pnid is NULL, or it doesn't identify a peer, the operation fails, + * and no change happens to the system. * The operation is aborted on the first NID that fails to be deleted. * - * pnid - Primary NID of the peer - * nid - list of nids to add - * num_nids - number of nids in the nid array - * ip2nets - used to specify a range of nids - * seq_no - sequence number of the command - * err_rc - YAML strucutre of the resultant return code. + * prim_nid - The desired primary NID of a new peer, or the primary NID of + * an existing peer. + * nids - a comma separated string of nids + * is_mr - Specifies whether this peer is MR capable. + * cmd - CONFIG or DELETE + * seq_no - sequence number of the command + * err_rc - YAML structure of the resultant return code */ -int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids, - bool ip2nets, int seq_no, struct cYAML **err_rc); +int lustre_lnet_modify_peer(char *prim_nid, char *nids, bool is_mr, + int cmd, int seq_no, struct cYAML **err_rc); /* * lustre_lnet_show_peer @@ -653,21 +670,34 @@ int lustre_lnet_parse_interfaces(char *intf_str, struct lnet_dlc_network_descr *nw_descr); /* - * lustre_lnet_parse_nids - * Parse a set of nids into a locally allocated array and return the - * pointer of the array to the caller. The caller is responsible for - * freeing the array. If an initial array is provided then copy over - * the contents of that array into the new array and append to it the - * new content. - * The nids can be of the form "nid [,nid, nid, nid]" - * nids: nids string to be parsed - * array: initial array of content - * size: num of elements in the array - * out_array: [OUT] new allocated array. - * Returns size of array - * sets the out_array to NULL on failure. - */ -int lustre_lnet_parse_nids(char *nids, char **array, int size, - char ***out_array); + * lustre_lnet_parse_nidstr + * This is a small wrapper around cfs_parse_nidlist. + * nidstr - A string parseable by cfs_parse_nidlist + * lnet_nidlist - An array of lnet_nid_t to hold the nids specified + * by the nidstring. + * max_nids - Size of the lnet_nidlist array, and the maximum number of + * nids that can be expressed by the nidstring. If the + * nidstring expands to a larger number of nids than max_nids + * then an error is returned. + * err_str - char pointer where we store an informative error + * message when an error is encountered + * Returns: + * The number (> 0) of lnet_nid_t stored in the supplied array, or + * LUSTRE_CFG_RC_BAD_PARAM if: + * - nidstr is NULL + * - nidstr contains an asterisk. This character is not allowed + * because it would cause the size of the expanded nidlist to exceed + * the maximum number of nids that is supported by expected callers + * of this function. + * - cfs_parse_nidlist fails to parse the nidstring + * - The nidlist populated by cfs_parse_nidlist is empty + * - The nidstring expands to a larger number of nids than max_nids + * - The nidstring expands to zero nids + * LUSTRE_CFG_RC_OUT_OF_MEM if: + * - cfs_expand_nidlist can return ENOMEM. We return out of mem in + * this case. + */ +int lustre_lnet_parse_nidstr(char *nidstr, lnet_nid_t *lnet_nidlist, + int max_nids, char *err_str); #endif /* LIB_LNET_CONFIG_API_H */