aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/subscr.c35
-rw-r--r--net/tipc/subscr.h2
2 files changed, 18 insertions, 19 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 81e2bd5f2413..a62e5d30638c 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -47,7 +47,6 @@
47 * @subscriber_list: adjacent subscribers in top. server's list of subscribers 47 * @subscriber_list: adjacent subscribers in top. server's list of subscribers
48 * @subscription_list: list of subscription objects for this subscriber 48 * @subscription_list: list of subscription objects for this subscriber
49 * @port_ref: object reference to port used to communicate with subscriber 49 * @port_ref: object reference to port used to communicate with subscriber
50 * @swap: indicates if subscriber uses opposite endianness in its messages
51 */ 50 */
52 51
53struct subscriber { 52struct subscriber {
@@ -56,7 +55,6 @@ struct subscriber {
56 struct list_head subscriber_list; 55 struct list_head subscriber_list;
57 struct list_head subscription_list; 56 struct list_head subscription_list;
58 u32 port_ref; 57 u32 port_ref;
59 int swap;
60}; 58};
61 59
62/** 60/**
@@ -109,11 +107,11 @@ static void subscr_send_event(struct subscription *sub,
109 msg_sect.iov_base = (void *)&sub->evt; 107 msg_sect.iov_base = (void *)&sub->evt;
110 msg_sect.iov_len = sizeof(struct tipc_event); 108 msg_sect.iov_len = sizeof(struct tipc_event);
111 109
112 sub->evt.event = htohl(event, sub->owner->swap); 110 sub->evt.event = htohl(event, sub->swap);
113 sub->evt.found_lower = htohl(found_lower, sub->owner->swap); 111 sub->evt.found_lower = htohl(found_lower, sub->swap);
114 sub->evt.found_upper = htohl(found_upper, sub->owner->swap); 112 sub->evt.found_upper = htohl(found_upper, sub->swap);
115 sub->evt.port.ref = htohl(port_ref, sub->owner->swap); 113 sub->evt.port.ref = htohl(port_ref, sub->swap);
116 sub->evt.port.node = htohl(node, sub->owner->swap); 114 sub->evt.port.node = htohl(node, sub->swap);
117 tipc_send(sub->owner->port_ref, 1, &msg_sect); 115 tipc_send(sub->owner->port_ref, 1, &msg_sect);
118} 116}
119 117
@@ -324,18 +322,16 @@ static void subscr_subscribe(struct tipc_subscr *s,
324 struct subscriber *subscriber) 322 struct subscriber *subscriber)
325{ 323{
326 struct subscription *sub; 324 struct subscription *sub;
325 int swap;
327 326
328 /* Determine/update subscriber's endianness */ 327 /* Determine subscriber's endianness */
329 328
330 if (s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE)) 329 swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE));
331 subscriber->swap = 0;
332 else
333 subscriber->swap = 1;
334 330
335 /* Detect & process a subscription cancellation request */ 331 /* Detect & process a subscription cancellation request */
336 332
337 if (s->filter & htohl(TIPC_SUB_CANCEL, subscriber->swap)) { 333 if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) {
338 s->filter &= ~htohl(TIPC_SUB_CANCEL, subscriber->swap); 334 s->filter &= ~htohl(TIPC_SUB_CANCEL, swap);
339 subscr_cancel(s, subscriber); 335 subscr_cancel(s, subscriber);
340 return; 336 return;
341 } 337 }
@@ -360,11 +356,11 @@ static void subscr_subscribe(struct tipc_subscr *s,
360 356
361 /* Initialize subscription object */ 357 /* Initialize subscription object */
362 358
363 sub->seq.type = htohl(s->seq.type, subscriber->swap); 359 sub->seq.type = htohl(s->seq.type, swap);
364 sub->seq.lower = htohl(s->seq.lower, subscriber->swap); 360 sub->seq.lower = htohl(s->seq.lower, swap);
365 sub->seq.upper = htohl(s->seq.upper, subscriber->swap); 361 sub->seq.upper = htohl(s->seq.upper, swap);
366 sub->timeout = htohl(s->timeout, subscriber->swap); 362 sub->timeout = htohl(s->timeout, swap);
367 sub->filter = htohl(s->filter, subscriber->swap); 363 sub->filter = htohl(s->filter, swap);
368 if ((!(sub->filter & TIPC_SUB_PORTS) 364 if ((!(sub->filter & TIPC_SUB_PORTS)
369 == !(sub->filter & TIPC_SUB_SERVICE)) 365 == !(sub->filter & TIPC_SUB_SERVICE))
370 || (sub->seq.lower > sub->seq.upper)) { 366 || (sub->seq.lower > sub->seq.upper)) {
@@ -378,6 +374,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
378 INIT_LIST_HEAD(&sub->subscription_list); 374 INIT_LIST_HEAD(&sub->subscription_list);
379 INIT_LIST_HEAD(&sub->nameseq_list); 375 INIT_LIST_HEAD(&sub->nameseq_list);
380 list_add(&sub->subscription_list, &subscriber->subscription_list); 376 list_add(&sub->subscription_list, &subscriber->subscription_list);
377 sub->swap = swap;
381 atomic_inc(&topsrv.subscription_count); 378 atomic_inc(&topsrv.subscription_count);
382 if (sub->timeout != TIPC_WAIT_FOREVER) { 379 if (sub->timeout != TIPC_WAIT_FOREVER) {
383 k_init_timer(&sub->timer, 380 k_init_timer(&sub->timer,
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index d95536832907..3e3e0265146e 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -49,6 +49,7 @@ typedef void (*tipc_subscr_event) (struct subscription *sub,
49 * @timeout: duration of subscription (in ms) 49 * @timeout: duration of subscription (in ms)
50 * @filter: event filtering to be done for subscription 50 * @filter: event filtering to be done for subscription
51 * @event_cb: routine invoked when a subscription event is detected 51 * @event_cb: routine invoked when a subscription event is detected
52 * @swap: indicates if subscriber uses opposite endianness in its messages
52 * @evt: template for events generated by subscription 53 * @evt: template for events generated by subscription
53 * @subscription_list: adjacent subscriptions in subscriber's subscription list 54 * @subscription_list: adjacent subscriptions in subscriber's subscription list
54 * @nameseq_list: adjacent subscriptions in name sequence's subscription list 55 * @nameseq_list: adjacent subscriptions in name sequence's subscription list
@@ -61,6 +62,7 @@ struct subscription {
61 u32 timeout; 62 u32 timeout;
62 u32 filter; 63 u32 filter;
63 tipc_subscr_event event_cb; 64 tipc_subscr_event event_cb;
65 int swap;
64 struct tipc_event evt; 66 struct tipc_event evt;
65 struct list_head subscription_list; 67 struct list_head subscription_list;
66 struct list_head nameseq_list; 68 struct list_head nameseq_list;