Commit e3d2716c authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: lnet: change lnet_route_t to proper structure

Change lnet_route_t from typedef to proper structure.
Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/20831Reviewed-by: default avatarOlaf Weber <olaf@sgi.com>
Reviewed-by: default avatarDoug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5716397a
...@@ -65,7 +65,7 @@ extern lnet_t the_lnet; /* THE network */ ...@@ -65,7 +65,7 @@ extern lnet_t the_lnet; /* THE network */
/** exclusive lock */ /** exclusive lock */
#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX #define LNET_LOCK_EX CFS_PERCPT_LOCK_EX
static inline int lnet_is_route_alive(lnet_route_t *route) static inline int lnet_is_route_alive(struct lnet_route *route)
{ {
/* gateway is down */ /* gateway is down */
if (!route->lr_gateway->lp_alive) if (!route->lr_gateway->lp_alive)
......
...@@ -340,7 +340,7 @@ struct lnet_peer { ...@@ -340,7 +340,7 @@ struct lnet_peer {
lnet_nid_t lp_nid; /* peer's NID */ lnet_nid_t lp_nid; /* peer's NID */
int lp_refcount; /* # refs */ int lp_refcount; /* # refs */
int lp_cpt; /* CPT this peer attached on */ int lp_cpt; /* CPT this peer attached on */
/* # refs from lnet_route_t::lr_gateway */ /* # refs from lnet_route::lr_gateway */
int lp_rtr_refcount; int lp_rtr_refcount;
/* returned RC ping features */ /* returned RC ping features */
unsigned int lp_ping_feats; unsigned int lp_ping_feats;
...@@ -369,7 +369,7 @@ struct lnet_peer_table { ...@@ -369,7 +369,7 @@ struct lnet_peer_table {
#define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing && \ #define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing && \
(lp)->lp_ni->ni_peertimeout > 0) (lp)->lp_ni->ni_peertimeout > 0)
typedef struct { struct lnet_route {
struct list_head lr_list; /* chain on net */ struct list_head lr_list; /* chain on net */
struct list_head lr_gwlist; /* chain on gateway */ struct list_head lr_gwlist; /* chain on gateway */
struct lnet_peer *lr_gateway; /* router node */ struct lnet_peer *lr_gateway; /* router node */
...@@ -378,7 +378,7 @@ typedef struct { ...@@ -378,7 +378,7 @@ typedef struct {
unsigned int lr_downis; /* number of down NIs */ unsigned int lr_downis; /* number of down NIs */
__u32 lr_hops; /* how far I am */ __u32 lr_hops; /* how far I am */
unsigned int lr_priority; /* route priority */ unsigned int lr_priority; /* route priority */
} lnet_route_t; };
#define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7) #define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7)
#define LNET_REMOTE_NETS_HASH_MAX (1U << 16) #define LNET_REMOTE_NETS_HASH_MAX (1U << 16)
......
...@@ -957,7 +957,7 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg) ...@@ -957,7 +957,7 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)
} }
static int static int
lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2) lnet_compare_routes(struct lnet_route *r1, struct lnet_route *r2)
{ {
struct lnet_peer *p1 = r1->lr_gateway; struct lnet_peer *p1 = r1->lr_gateway;
struct lnet_peer *p2 = r2->lr_gateway; struct lnet_peer *p2 = r2->lr_gateway;
...@@ -999,9 +999,9 @@ lnet_find_route_locked(struct lnet_ni *ni, lnet_nid_t target, ...@@ -999,9 +999,9 @@ lnet_find_route_locked(struct lnet_ni *ni, lnet_nid_t target,
lnet_nid_t rtr_nid) lnet_nid_t rtr_nid)
{ {
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; struct lnet_route *route;
lnet_route_t *best_route; struct lnet_route *best_route;
lnet_route_t *last_route; struct lnet_route *last_route;
struct lnet_peer *lp_best; struct lnet_peer *lp_best;
struct lnet_peer *lp; struct lnet_peer *lp;
int rc; int rc;
...@@ -2351,8 +2351,8 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) ...@@ -2351,8 +2351,8 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp)
rnet = list_entry(e, lnet_remotenet_t, lrn_list); rnet = list_entry(e, lnet_remotenet_t, lrn_list);
if (rnet->lrn_net == dstnet) { if (rnet->lrn_net == dstnet) {
lnet_route_t *route; struct lnet_route *route;
lnet_route_t *shortest = NULL; struct lnet_route *shortest = NULL;
__u32 shortest_hops = LNET_UNDEFINED_HOPS; __u32 shortest_hops = LNET_UNDEFINED_HOPS;
__u32 route_hops; __u32 route_hops;
......
...@@ -268,7 +268,7 @@ static void lnet_shuffle_seed(void) ...@@ -268,7 +268,7 @@ static void lnet_shuffle_seed(void)
/* NB expects LNET_LOCK held */ /* NB expects LNET_LOCK held */
static void static void
lnet_add_route_to_rnet(lnet_remotenet_t *rnet, lnet_route_t *route) lnet_add_route_to_rnet(lnet_remotenet_t *rnet, struct lnet_route *route)
{ {
unsigned int len = 0; unsigned int len = 0;
unsigned int offset = 0; unsigned int offset = 0;
...@@ -301,7 +301,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, ...@@ -301,7 +301,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
struct list_head *e; struct list_head *e;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_remotenet_t *rnet2; lnet_remotenet_t *rnet2;
lnet_route_t *route; struct lnet_route *route;
struct lnet_ni *ni; struct lnet_ni *ni;
int add_route; int add_route;
int rc; int rc;
...@@ -368,8 +368,9 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, ...@@ -368,8 +368,9 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
/* Search for a duplicate route (it's a NOOP if it is) */ /* Search for a duplicate route (it's a NOOP if it is) */
add_route = 1; add_route = 1;
list_for_each(e, &rnet2->lrn_routes) { list_for_each(e, &rnet2->lrn_routes) {
lnet_route_t *route2 = list_entry(e, lnet_route_t, lr_list); struct lnet_route *route2;
route2 = list_entry(e, struct lnet_route, lr_list);
if (route2->lr_gateway == route->lr_gateway) { if (route2->lr_gateway == route->lr_gateway) {
add_route = 0; add_route = 0;
break; break;
...@@ -416,8 +417,8 @@ int ...@@ -416,8 +417,8 @@ int
lnet_check_routes(void) lnet_check_routes(void)
{ {
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; struct lnet_route *route;
lnet_route_t *route2; struct lnet_route *route2;
struct list_head *e1; struct list_head *e1;
struct list_head *e2; struct list_head *e2;
int cpt; int cpt;
...@@ -437,7 +438,7 @@ lnet_check_routes(void) ...@@ -437,7 +438,7 @@ lnet_check_routes(void)
lnet_nid_t nid2; lnet_nid_t nid2;
int net; int net;
route = list_entry(e2, lnet_route_t, lr_list); route = list_entry(e2, struct lnet_route, lr_list);
if (!route2) { if (!route2) {
route2 = route; route2 = route;
...@@ -472,7 +473,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid) ...@@ -472,7 +473,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid)
{ {
struct lnet_peer *gateway; struct lnet_peer *gateway;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; struct lnet_route *route;
struct list_head *e1; struct list_head *e1;
struct list_head *e2; struct list_head *e2;
int rc = -ENOENT; int rc = -ENOENT;
...@@ -501,7 +502,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid) ...@@ -501,7 +502,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid)
continue; continue;
list_for_each(e2, &rnet->lrn_routes) { list_for_each(e2, &rnet->lrn_routes) {
route = list_entry(e2, lnet_route_t, lr_list); route = list_entry(e2, struct lnet_route, lr_list);
gateway = route->lr_gateway; gateway = route->lr_gateway;
if (!(gw_nid == LNET_NID_ANY || if (!(gw_nid == LNET_NID_ANY ||
...@@ -588,7 +589,7 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops, ...@@ -588,7 +589,7 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
struct list_head *e1; struct list_head *e1;
struct list_head *e2; struct list_head *e2;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; struct lnet_route *route;
int cpt; int cpt;
int i; int i;
struct list_head *rn_list; struct list_head *rn_list;
...@@ -601,7 +602,8 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops, ...@@ -601,7 +602,8 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
rnet = list_entry(e1, lnet_remotenet_t, lrn_list); rnet = list_entry(e1, lnet_remotenet_t, lrn_list);
list_for_each(e2, &rnet->lrn_routes) { list_for_each(e2, &rnet->lrn_routes) {
route = list_entry(e2, lnet_route_t, lr_list); route = list_entry(e2, struct lnet_route,
lr_list);
if (!idx--) { if (!idx--) {
*net = rnet->lrn_net; *net = rnet->lrn_net;
...@@ -646,7 +648,7 @@ lnet_parse_rc_info(struct lnet_rc_data *rcd) ...@@ -646,7 +648,7 @@ lnet_parse_rc_info(struct lnet_rc_data *rcd)
{ {
struct lnet_ping_info *info = rcd->rcd_pinginfo; struct lnet_ping_info *info = rcd->rcd_pinginfo;
struct lnet_peer *gw = rcd->rcd_gateway; struct lnet_peer *gw = rcd->rcd_gateway;
lnet_route_t *rte; struct lnet_route *rte;
if (!gw->lp_alive) if (!gw->lp_alive)
return; return;
...@@ -823,7 +825,7 @@ lnet_wait_known_routerstate(void) ...@@ -823,7 +825,7 @@ lnet_wait_known_routerstate(void)
void void
lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net) lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net)
{ {
lnet_route_t *rte; struct lnet_route *rte;
if ((gw->lp_ping_feats & LNET_PING_FEAT_NI_STATUS)) { if ((gw->lp_ping_feats & LNET_PING_FEAT_NI_STATUS)) {
list_for_each_entry(rte, &gw->lp_routes, lr_gwlist) { list_for_each_entry(rte, &gw->lp_routes, lr_gwlist) {
......
...@@ -171,7 +171,7 @@ static int proc_lnet_routes(struct ctl_table *table, int write, ...@@ -171,7 +171,7 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
} else { } else {
struct list_head *n; struct list_head *n;
struct list_head *r; struct list_head *r;
lnet_route_t *route = NULL; struct lnet_route *route = NULL;
lnet_remotenet_t *rnet = NULL; lnet_remotenet_t *rnet = NULL;
int skip = off - 1; int skip = off - 1;
struct list_head *rn_list; struct list_head *rn_list;
...@@ -197,9 +197,10 @@ static int proc_lnet_routes(struct ctl_table *table, int write, ...@@ -197,9 +197,10 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
r = rnet->lrn_routes.next; r = rnet->lrn_routes.next;
while (r != &rnet->lrn_routes) { while (r != &rnet->lrn_routes) {
lnet_route_t *re = struct lnet_route *re;
list_entry(r, lnet_route_t,
lr_list); re = list_entry(r, struct lnet_route,
lr_list);
if (!skip) { if (!skip) {
route = re; route = re;
break; break;
...@@ -331,7 +332,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, ...@@ -331,7 +332,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
int last_ping = cfs_duration_sec(cfs_time_sub(now, int last_ping = cfs_duration_sec(cfs_time_sub(now,
peer->lp_ping_timestamp)); peer->lp_ping_timestamp));
int down_ni = 0; int down_ni = 0;
lnet_route_t *rtr; struct lnet_route *rtr;
if ((peer->lp_ping_feats & if ((peer->lp_ping_feats &
LNET_PING_FEAT_NI_STATUS)) { LNET_PING_FEAT_NI_STATUS)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment