Skip to content

Commit f905730

Browse files
ajstephensPaul Gortmaker
authored andcommitted
tipc: Allow use of buf_seqno() helper routine by unicast links
Migrates the buf_seqno() helper routine from broadcast link level to unicast link level so that it can be used both types of TIPC links. This is a cosmetic change only, and does not affect the operation of TIPC. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
1 parent 3655959 commit f905730

3 files changed

Lines changed: 24 additions & 25 deletions

File tree

‎net/tipc/bcast.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ static void tipc_nmap_diff(struct tipc_node_map *nm_a,
115115
struct tipc_node_map *nm_b,
116116
struct tipc_node_map *nm_diff);
117117

118-
static u32 buf_seqno(struct sk_buff *buf)
119-
{
120-
return msg_seqno(buf_msg(buf));
121-
}
122-
123118
static u32 bcbuf_acks(struct sk_buff *buf)
124119
{
125120
return (u32)(unsigned long)TIPC_SKB_CB(buf)->handle;

‎net/tipc/link.c‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void link_init_max_pkt(struct link *l_ptr)
130130
static u32 link_next_sent(struct link *l_ptr)
131131
{
132132
if (l_ptr->next_out)
133-
return msg_seqno(buf_msg(l_ptr->next_out));
133+
return buf_seqno(l_ptr->next_out);
134134
return mod(l_ptr->next_out_no);
135135
}
136136

@@ -1354,7 +1354,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
13541354
if (r_q_size && buf) {
13551355
u32 last = lesser(mod(r_q_head + r_q_size),
13561356
link_last_sent(l_ptr));
1357-
u32 first = msg_seqno(buf_msg(buf));
1357+
u32 first = buf_seqno(buf);
13581358

13591359
while (buf && less(first, r_q_head)) {
13601360
first = mod(first + 1);
@@ -1403,7 +1403,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
14031403
if (buf) {
14041404
struct tipc_msg *msg = buf_msg(buf);
14051405
u32 next = msg_seqno(msg);
1406-
u32 first = msg_seqno(buf_msg(l_ptr->first_out));
1406+
u32 first = buf_seqno(l_ptr->first_out);
14071407

14081408
if (mod(next - first) < l_ptr->queue_limit[0]) {
14091409
msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
@@ -1558,7 +1558,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
15581558
} else {
15591559
tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
15601560
l_ptr->stats.bearer_congs++;
1561-
l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
1561+
l_ptr->retransm_queue_head = buf_seqno(buf);
15621562
l_ptr->retransm_queue_size = retransmits;
15631563
return;
15641564
}
@@ -1579,7 +1579,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr,
15791579
if (l_ptr->oldest_deferred_in == NULL)
15801580
return buf;
15811581

1582-
seq_no = msg_seqno(buf_msg(l_ptr->oldest_deferred_in));
1582+
seq_no = buf_seqno(l_ptr->oldest_deferred_in);
15831583
if (seq_no == mod(l_ptr->next_in_no)) {
15841584
l_ptr->newest_deferred_in->next = buf;
15851585
buf = l_ptr->oldest_deferred_in;
@@ -1738,7 +1738,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
17381738

17391739
crs = l_ptr->first_out;
17401740
while ((crs != l_ptr->next_out) &&
1741-
less_eq(msg_seqno(buf_msg(crs)), ackd)) {
1741+
less_eq(buf_seqno(crs), ackd)) {
17421742
struct sk_buff *next = crs->next;
17431743

17441744
buf_discard(crs);
@@ -1861,7 +1861,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
18611861
{
18621862
struct sk_buff *prev = NULL;
18631863
struct sk_buff *crs = *head;
1864-
u32 seq_no = msg_seqno(buf_msg(buf));
1864+
u32 seq_no = buf_seqno(buf);
18651865

18661866
buf->next = NULL;
18671867

@@ -1872,7 +1872,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
18721872
}
18731873

18741874
/* Last ? */
1875-
if (less(msg_seqno(buf_msg(*tail)), seq_no)) {
1875+
if (less(buf_seqno(*tail), seq_no)) {
18761876
(*tail)->next = buf;
18771877
*tail = buf;
18781878
return 1;
@@ -1909,7 +1909,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
19091909
static void link_handle_out_of_seq_msg(struct link *l_ptr,
19101910
struct sk_buff *buf)
19111911
{
1912-
u32 seq_no = msg_seqno(buf_msg(buf));
1912+
u32 seq_no = buf_seqno(buf);
19131913

19141914
if (likely(msg_user(buf_msg(buf)) == LINK_PROTOCOL)) {
19151915
link_recv_proto_msg(l_ptr, buf);
@@ -1971,10 +1971,10 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
19711971
if (!tipc_link_is_up(l_ptr))
19721972
return;
19731973
if (l_ptr->next_out)
1974-
next_sent = msg_seqno(buf_msg(l_ptr->next_out));
1974+
next_sent = buf_seqno(l_ptr->next_out);
19751975
msg_set_next_sent(msg, next_sent);
19761976
if (l_ptr->oldest_deferred_in) {
1977-
u32 rec = msg_seqno(buf_msg(l_ptr->oldest_deferred_in));
1977+
u32 rec = buf_seqno(l_ptr->oldest_deferred_in);
19781978
gap = mod(rec - mod(l_ptr->next_in_no));
19791979
}
19801980
msg_set_seq_gap(msg, gap);
@@ -2589,7 +2589,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
25892589

25902590
/* Is there an incomplete message waiting for this fragment? */
25912591

2592-
while (pbuf && ((msg_seqno(buf_msg(pbuf)) != long_msg_seq_no) ||
2592+
while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) ||
25932593
(msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) {
25942594
prev = pbuf;
25952595
pbuf = pbuf->next;
@@ -3112,13 +3112,12 @@ static void link_print(struct link *l_ptr, const char *str)
31123112
tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no));
31133113
tipc_printf(buf, "SQUE");
31143114
if (l_ptr->first_out) {
3115-
tipc_printf(buf, "[%u..", msg_seqno(buf_msg(l_ptr->first_out)));
3115+
tipc_printf(buf, "[%u..", buf_seqno(l_ptr->first_out));
31163116
if (l_ptr->next_out)
3117-
tipc_printf(buf, "%u..",
3118-
msg_seqno(buf_msg(l_ptr->next_out)));
3119-
tipc_printf(buf, "%u]", msg_seqno(buf_msg(l_ptr->last_out)));
3120-
if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) -
3121-
msg_seqno(buf_msg(l_ptr->first_out)))
3117+
tipc_printf(buf, "%u..", buf_seqno(l_ptr->next_out));
3118+
tipc_printf(buf, "%u]", buf_seqno(l_ptr->last_out));
3119+
if ((mod(buf_seqno(l_ptr->last_out) -
3120+
buf_seqno(l_ptr->first_out))
31223121
!= (l_ptr->out_queue_size - 1)) ||
31233122
(l_ptr->last_out->next != NULL)) {
31243123
tipc_printf(buf, "\nSend queue inconsistency\n");
@@ -3130,8 +3129,8 @@ static void link_print(struct link *l_ptr, const char *str)
31303129
tipc_printf(buf, "[]");
31313130
tipc_printf(buf, "SQSIZ(%u)", l_ptr->out_queue_size);
31323131
if (l_ptr->oldest_deferred_in) {
3133-
u32 o = msg_seqno(buf_msg(l_ptr->oldest_deferred_in));
3134-
u32 n = msg_seqno(buf_msg(l_ptr->newest_deferred_in));
3132+
u32 o = buf_seqno(l_ptr->oldest_deferred_in);
3133+
u32 n = buf_seqno(l_ptr->newest_deferred_in);
31353134
tipc_printf(buf, ":RQUE[%u..%u]", o, n);
31363135
if (l_ptr->deferred_inqueue_sz != mod((n + 1) - o)) {
31373136
tipc_printf(buf, ":RQSIZ(%u)",

‎net/tipc/link.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retrans
254254
* Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
255255
*/
256256

257+
static inline u32 buf_seqno(struct sk_buff *buf)
258+
{
259+
return msg_seqno(buf_msg(buf));
260+
}
261+
257262
static inline u32 mod(u32 x)
258263
{
259264
return x & 0xffffu;

0 commit comments

Comments
 (0)