提交 15e979da 编写于 作者: A Allan Stephens 提交者: David S. Miller

tipc: remove abstraction for link_max_pkt

This is just a straight return of a field; there is no
value in the abstraction of hiding it behind a function.
Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8e1c298c
...@@ -232,11 +232,6 @@ static int link_congested(struct link *l_ptr) ...@@ -232,11 +232,6 @@ static int link_congested(struct link *l_ptr)
return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]); return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]);
} }
static u32 link_max_pkt(struct link *l_ptr)
{
return l_ptr->max_pkt;
}
static void link_init_max_pkt(struct link *l_ptr) static void link_init_max_pkt(struct link *l_ptr)
{ {
u32 max_pkt; u32 max_pkt;
...@@ -562,7 +557,7 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) ...@@ -562,7 +557,7 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
if (!list_empty(&p_ptr->wait_list)) if (!list_empty(&p_ptr->wait_list))
goto exit; goto exit;
p_ptr->publ.congested = 1; p_ptr->publ.congested = 1;
p_ptr->waiting_pkts = 1 + ((sz - 1) / link_max_pkt(l_ptr)); p_ptr->waiting_pkts = 1 + ((sz - 1) / l_ptr->max_pkt);
list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports);
l_ptr->stats.link_congs++; l_ptr->stats.link_congs++;
exit: exit:
...@@ -1015,7 +1010,7 @@ static int link_bundle_buf(struct link *l_ptr, ...@@ -1015,7 +1010,7 @@ static int link_bundle_buf(struct link *l_ptr,
return 0; return 0;
if (skb_tailroom(bundler) < (pad + size)) if (skb_tailroom(bundler) < (pad + size))
return 0; return 0;
if (link_max_pkt(l_ptr) < (to_pos + size)) if (l_ptr->max_pkt < (to_pos + size))
return 0; return 0;
skb_put(bundler, pad + size); skb_put(bundler, pad + size);
...@@ -1062,7 +1057,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -1062,7 +1057,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
u32 queue_size = l_ptr->out_queue_size; u32 queue_size = l_ptr->out_queue_size;
u32 imp = msg_tot_importance(msg); u32 imp = msg_tot_importance(msg);
u32 queue_limit = l_ptr->queue_limit[imp]; u32 queue_limit = l_ptr->queue_limit[imp];
u32 max_packet = link_max_pkt(l_ptr); u32 max_packet = l_ptr->max_pkt;
msg_set_prevnode(msg, tipc_own_addr); /* If routed message */ msg_set_prevnode(msg, tipc_own_addr); /* If routed message */
...@@ -1193,7 +1188,7 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, ...@@ -1193,7 +1188,7 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
int res = msg_data_sz(msg); int res = msg_data_sz(msg);
if (likely(!link_congested(l_ptr))) { if (likely(!link_congested(l_ptr))) {
if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) { if (likely(msg_size(msg) <= l_ptr->max_pkt)) {
if (likely(list_empty(&l_ptr->b_ptr->cong_links))) { if (likely(list_empty(&l_ptr->b_ptr->cong_links))) {
link_add_to_outqueue(l_ptr, buf, msg); link_add_to_outqueue(l_ptr, buf, msg);
if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, if (likely(tipc_bearer_send(l_ptr->b_ptr, buf,
...@@ -1210,7 +1205,7 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, ...@@ -1210,7 +1205,7 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
} }
} }
else else
*used_max_pkt = link_max_pkt(l_ptr); *used_max_pkt = l_ptr->max_pkt;
} }
return tipc_link_send_buf(l_ptr, buf); /* All other cases */ return tipc_link_send_buf(l_ptr, buf); /* All other cases */
} }
...@@ -1317,7 +1312,7 @@ int tipc_link_send_sections_fast(struct port *sender, ...@@ -1317,7 +1312,7 @@ int tipc_link_send_sections_fast(struct port *sender,
* then re-try fast path or fragment the message * then re-try fast path or fragment the message
*/ */
sender->publ.max_pkt = link_max_pkt(l_ptr); sender->publ.max_pkt = l_ptr->max_pkt;
tipc_node_unlock(node); tipc_node_unlock(node);
read_unlock_bh(&tipc_net_lock); read_unlock_bh(&tipc_net_lock);
...@@ -1480,8 +1475,8 @@ static int link_send_sections_long(struct port *sender, ...@@ -1480,8 +1475,8 @@ static int link_send_sections_long(struct port *sender,
tipc_node_unlock(node); tipc_node_unlock(node);
goto reject; goto reject;
} }
if (link_max_pkt(l_ptr) < max_pkt) { if (l_ptr->max_pkt < max_pkt) {
sender->publ.max_pkt = link_max_pkt(l_ptr); sender->publ.max_pkt = l_ptr->max_pkt;
tipc_node_unlock(node); tipc_node_unlock(node);
for (; buf_chain; buf_chain = buf) { for (; buf_chain; buf_chain = buf) {
buf = buf_chain->next; buf = buf_chain->next;
...@@ -2679,7 +2674,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -2679,7 +2674,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
u32 dsz = msg_data_sz(inmsg); u32 dsz = msg_data_sz(inmsg);
unchar *crs = buf->data; unchar *crs = buf->data;
u32 rest = insize; u32 rest = insize;
u32 pack_sz = link_max_pkt(l_ptr); u32 pack_sz = l_ptr->max_pkt;
u32 fragm_sz = pack_sz - INT_H_SIZE; u32 fragm_sz = pack_sz - INT_H_SIZE;
u32 fragm_no = 1; u32 fragm_no = 1;
u32 destaddr; u32 destaddr;
...@@ -3125,7 +3120,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) ...@@ -3125,7 +3120,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
tipc_printf(&pb, "Link <%s>\n" tipc_printf(&pb, "Link <%s>\n"
" %s MTU:%u Priority:%u Tolerance:%u ms" " %s MTU:%u Priority:%u Tolerance:%u ms"
" Window:%u packets\n", " Window:%u packets\n",
l_ptr->name, status, link_max_pkt(l_ptr), l_ptr->name, status, l_ptr->max_pkt,
l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]); l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]);
tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
l_ptr->next_in_no - l_ptr->stats.recv_info, l_ptr->next_in_no - l_ptr->stats.recv_info,
...@@ -3270,7 +3265,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector) ...@@ -3270,7 +3265,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
tipc_node_lock(n_ptr); tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector & 1]; l_ptr = n_ptr->active_links[selector & 1];
if (l_ptr) if (l_ptr)
res = link_max_pkt(l_ptr); res = l_ptr->max_pkt;
tipc_node_unlock(n_ptr); tipc_node_unlock(n_ptr);
} }
read_unlock_bh(&tipc_net_lock); read_unlock_bh(&tipc_net_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册