aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-03-13 16:08:11 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-14 14:38:32 -0400
commite3eea1eb47ac616ee09cf0ae5d1e7790ef8461ea (patch)
tree8d940842c102ed18354bc51ef64598374deb893c /net/tipc/link.c
parent05dcc5aa4dcced4f59f925625cea669e82b75519 (diff)
tipc: clean up handling of message priorities
Messages transferred by TIPC are assigned an "importance priority", -an integer value indicating how to treat the message when there is link or destination socket congestion. There is no separate header field for this value. Instead, the message user values have been chosen in ascending order according to perceived importance, so that the message user field can be used for this. This is not a good solution. First, we have many more users than the needed priority levels, so we end up with treating more priority levels than necessary. Second, the user field cannot always accurately reflect the priority of the message. E.g., a message fragment packet should really have the priority of the enveloped user data message, and not the priority of the MSG_FRAGMENTER user. Until now, we have been working around this problem in different ways, but it is now time to implement a consistent way of handling such priorities, although still within the constraint that we cannot allocate any more bits in the regular data message header for this. In this commit, we define a new priority level, TIPC_SYSTEM_IMPORTANCE, that will be the only one used apart from the four (lower) user data levels. All non-data messages map down to this priority. Furthermore, we take some free bits from the MSG_FRAGMENTER header and allocate them to store the priority of the enveloped message. We then adjust the functions msg_importance()/msg_set_importance() so that they read/set the correct header fields depending on user type. This small protocol change is fully compatible, because the code at the receiving end of a link currently reads the importance level only from user data messages, where there is no change. Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 7e0036f5a364..bc49120bfb44 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -35,6 +35,7 @@
35 */ 35 */
36 36
37#include "core.h" 37#include "core.h"
38#include "subscr.h"
38#include "link.h" 39#include "link.h"
39#include "bcast.h" 40#include "bcast.h"
40#include "socket.h" 41#include "socket.h"
@@ -305,12 +306,10 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
305 msg_set_session(msg, (tn->random & 0xffff)); 306 msg_set_session(msg, (tn->random & 0xffff));
306 msg_set_bearer_id(msg, b_ptr->identity); 307 msg_set_bearer_id(msg, b_ptr->identity);
307 strcpy((char *)msg_data(msg), if_name); 308 strcpy((char *)msg_data(msg), if_name);
308
309 l_ptr->priority = b_ptr->priority;
310 tipc_link_set_queue_limits(l_ptr, b_ptr->window);
311
312 l_ptr->net_plane = b_ptr->net_plane; 309 l_ptr->net_plane = b_ptr->net_plane;
313 link_init_max_pkt(l_ptr); 310 link_init_max_pkt(l_ptr);
311 l_ptr->priority = b_ptr->priority;
312 tipc_link_set_queue_limits(l_ptr, b_ptr->window);
314 313
315 l_ptr->next_out_no = 1; 314 l_ptr->next_out_no = 1;
316 __skb_queue_head_init(&l_ptr->transmq); 315 __skb_queue_head_init(&l_ptr->transmq);
@@ -708,7 +707,7 @@ static int tipc_link_cong(struct tipc_link *link, struct sk_buff_head *list)
708{ 707{
709 struct sk_buff *skb = skb_peek(list); 708 struct sk_buff *skb = skb_peek(list);
710 struct tipc_msg *msg = buf_msg(skb); 709 struct tipc_msg *msg = buf_msg(skb);
711 uint imp = tipc_msg_tot_importance(msg); 710 int imp = msg_importance(msg);
712 u32 oport = msg_tot_origport(msg); 711 u32 oport = msg_tot_origport(msg);
713 712
714 if (unlikely(imp > TIPC_CRITICAL_IMPORTANCE)) { 713 if (unlikely(imp > TIPC_CRITICAL_IMPORTANCE)) {
@@ -745,7 +744,7 @@ int __tipc_link_xmit(struct net *net, struct tipc_link *link,
745{ 744{
746 struct tipc_msg *msg = buf_msg(skb_peek(list)); 745 struct tipc_msg *msg = buf_msg(skb_peek(list));
747 unsigned int maxwin = link->window; 746 unsigned int maxwin = link->window;
748 uint imp = tipc_msg_tot_importance(msg); 747 unsigned int imp = msg_importance(msg);
749 uint mtu = link->max_pkt; 748 uint mtu = link->max_pkt;
750 uint ack = mod(link->next_in_no - 1); 749 uint ack = mod(link->next_in_no - 1);
751 uint seqno = link->next_out_no; 750 uint seqno = link->next_out_no;
@@ -755,7 +754,7 @@ int __tipc_link_xmit(struct net *net, struct tipc_link *link,
755 struct sk_buff_head *backlogq = &link->backlogq; 754 struct sk_buff_head *backlogq = &link->backlogq;
756 struct sk_buff *skb, *tmp; 755 struct sk_buff *skb, *tmp;
757 756
758 /* Match queue limits against msg importance: */ 757 /* Match queue limit against msg importance: */
759 if (unlikely(skb_queue_len(backlogq) >= link->queue_limit[imp])) 758 if (unlikely(skb_queue_len(backlogq) >= link->queue_limit[imp]))
760 return tipc_link_cong(link, list); 759 return tipc_link_cong(link, list);
761 760
@@ -1811,25 +1810,16 @@ static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tol)
1811 l_ptr->abort_limit = tol / (jiffies_to_msecs(l_ptr->cont_intv) / 4); 1810 l_ptr->abort_limit = tol / (jiffies_to_msecs(l_ptr->cont_intv) / 4);
1812} 1811}
1813 1812
1814void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window) 1813void tipc_link_set_queue_limits(struct tipc_link *l, u32 win)
1815{ 1814{
1816 l_ptr->window = window; 1815 int max_bulk = TIPC_MAX_PUBLICATIONS / (l->max_pkt / ITEM_SIZE);
1817 1816
1818 /* Data messages from this node, inclusive FIRST_FRAGM */ 1817 l->window = win;
1819 l_ptr->queue_limit[TIPC_LOW_IMPORTANCE] = window; 1818 l->queue_limit[TIPC_LOW_IMPORTANCE] = win / 2;
1820 l_ptr->queue_limit[TIPC_MEDIUM_IMPORTANCE] = (window / 3) * 4; 1819 l->queue_limit[TIPC_MEDIUM_IMPORTANCE] = win;
1821 l_ptr->queue_limit[TIPC_HIGH_IMPORTANCE] = (window / 3) * 5; 1820 l->queue_limit[TIPC_HIGH_IMPORTANCE] = win / 2 * 3;
1822 l_ptr->queue_limit[TIPC_CRITICAL_IMPORTANCE] = (window / 3) * 6; 1821 l->queue_limit[TIPC_CRITICAL_IMPORTANCE] = win * 2;
1823 /* Transiting data messages,inclusive FIRST_FRAGM */ 1822 l->queue_limit[TIPC_SYSTEM_IMPORTANCE] = max_bulk;
1824 l_ptr->queue_limit[TIPC_LOW_IMPORTANCE + 4] = 300;
1825 l_ptr->queue_limit[TIPC_MEDIUM_IMPORTANCE + 4] = 600;
1826 l_ptr->queue_limit[TIPC_HIGH_IMPORTANCE + 4] = 900;
1827 l_ptr->queue_limit[TIPC_CRITICAL_IMPORTANCE + 4] = 1200;
1828 l_ptr->queue_limit[CONN_MANAGER] = 1200;
1829 l_ptr->queue_limit[CHANGEOVER_PROTOCOL] = 2500;
1830 l_ptr->queue_limit[NAME_DISTRIBUTOR] = 3000;
1831 /* FRAGMENT and LAST_FRAGMENT packets */
1832 l_ptr->queue_limit[MSG_FRAGMENTER] = 4000;
1833} 1823}
1834 1824
1835/* tipc_link_find_owner - locate owner node of link by link's name 1825/* tipc_link_find_owner - locate owner node of link by link's name