X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Flnet%2Fconfig.c;h=446eb8ad42101a4c58776d42ad80d3b527866e20;hb=refs%2Fchanges%2F06%2F12206%2F15;hp=a8960f9d294b67a56d2be55468ca1d8f82623418;hpb=8fab48a8ef0bad6961c2ca1e2959726252ba43ac;p=fs%2Flustre-release.git diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index a8960f9..446eb8a 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -48,7 +48,7 @@ static int lnet_tbnob = 0; /* track text buf allocation */ #define LNET_MAX_TEXTBUF_NOB (64<<10) /* bound allocation */ #define LNET_SINGLE_TEXTBUF_NOB (4<<10) -void +static void lnet_syntax(char *name, char *str, int offset, int width) { static char dots[LNET_SINGLE_TEXTBUF_NOB]; @@ -65,7 +65,7 @@ lnet_syntax(char *name, char *str, int offset, int width) (width < 1) ? 0 : width - 1, dashes); } -int +static int lnet_issep (char c) { switch (c) { @@ -204,6 +204,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks) struct lnet_ni *ni; __u32 net; int nnets = 0; + struct list_head *temp_node; if (networks == NULL) { CERROR("networks string is undefined\n"); @@ -228,11 +229,6 @@ lnet_parse_networks(struct list_head *nilist, char *networks) memcpy(tokens, networks, tokensize); str = tmp = tokens; - /* Add in the loopback network */ - ni = lnet_ni_alloc(LNET_MKNET(LOLND, 0), NULL, nilist); - if (ni == NULL) - goto failed; - while (str != NULL && *str != 0) { char *comma = strchr(str, ','); char *bracket = strchr(str, '('); @@ -305,7 +301,6 @@ lnet_parse_networks(struct list_head *nilist, char *networks) goto failed_syntax; } - nnets++; ni = lnet_ni_alloc(net, el, nilist); if (ni == NULL) goto failed; @@ -381,7 +376,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks) } } - LASSERT(!list_empty(nilist)); + list_for_each(temp_node, nilist) + nnets++; LIBCFS_FREE(tokens, tokensize); return nnets; @@ -404,7 +400,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks) return -EINVAL; } -struct lnet_text_buf *lnet_new_text_buf(int str_len) +static struct lnet_text_buf *lnet_new_text_buf(int str_len) { struct lnet_text_buf *ltb; int nob; @@ -432,14 +428,14 @@ struct lnet_text_buf *lnet_new_text_buf(int str_len) return ltb; } -void +static void lnet_free_text_buf(struct lnet_text_buf *ltb) { lnet_tbnob -= ltb->ltb_size; LIBCFS_FREE(ltb, ltb->ltb_size); } -void +static void lnet_free_text_bufs(struct list_head *tbs) { struct lnet_text_buf *ltb; @@ -467,7 +463,7 @@ lnet_print_text_bufs(struct list_head *tbs) CDEBUG(D_WARNING, "%d allocated\n", lnet_tbnob); } -int +static int lnet_str2tbs_sep(struct list_head *tbs, char *str) { struct list_head pending; @@ -525,7 +521,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str) return 0; } -int +static int lnet_expand1tb(struct list_head *list, char *str, char *sep1, char *sep2, char *item, int itemlen) @@ -550,7 +546,7 @@ lnet_expand1tb(struct list_head *list, return 0; } -int +static int lnet_str2tbs_expand(struct list_head *tbs, char *str) { char num[16]; @@ -630,7 +626,7 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str) return -1; } -int +static int lnet_parse_hops (char *str, unsigned int *hops) { int len = strlen(str); @@ -643,7 +639,7 @@ lnet_parse_hops (char *str, unsigned int *hops) #define LNET_PRIORITY_SEPARATOR (':') -int +static int lnet_parse_priority(char *str, unsigned int *priority, char **token) { int nob; @@ -673,7 +669,7 @@ lnet_parse_priority(char *str, unsigned int *priority, char **token) return 0; } -int +static int lnet_parse_route (char *str, int *im_a_router) { /* static scratch buffer OK (single threaded) */ @@ -796,7 +792,7 @@ lnet_parse_route (char *str, int *im_a_router) } rc = lnet_add_route(net, hops, nid, priority); - if (rc != 0) { + if (rc != 0 && rc != -EEXIST && rc != -EHOSTUNREACH) { CERROR("Can't create route " "to %s via %s\n", libcfs_net2str(net), @@ -817,7 +813,7 @@ out: return myrc; } -int +static int lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router) { struct lnet_text_buf *ltb; @@ -858,7 +854,7 @@ lnet_parse_routes (char *routes, int *im_a_router) return rc; } -int +static int lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip) { struct list_head list = LIST_HEAD_INIT(list); @@ -877,7 +873,7 @@ lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip) return rc; } -int +static int lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) { static char tokens[LNET_SINGLE_TEXTBUF_NOB]; @@ -934,7 +930,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) return 1; } -__u32 +static __u32 lnet_netspec2net(char *netspec) { char *bracket = strchr(netspec, '('); @@ -951,7 +947,7 @@ lnet_netspec2net(char *netspec) return net; } -int +static int lnet_splitnets(char *source, struct list_head *nets) { int offset = 0; @@ -1033,7 +1029,7 @@ lnet_splitnets(char *source, struct list_head *nets) } } -int +static int lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) { static char networks[LNET_SINGLE_TEXTBUF_NOB]; @@ -1154,13 +1150,13 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) } #ifdef __KERNEL__ -void +static void lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip) { LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs)); } -int +static int lnet_ipaddr_enumerate (__u32 **ipaddrsp) { int up; @@ -1229,7 +1225,7 @@ lnet_ipaddr_enumerate (__u32 **ipaddrsp) int lnet_parse_ip2nets (char **networksp, char *ip2nets) { - __u32 *ipaddrs; + __u32 *ipaddrs = NULL; int nip = lnet_ipaddr_enumerate(&ipaddrs); int rc;