diff options
author | Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> | 2016-02-02 04:52:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-06 03:40:43 -0500 |
commit | 3086523149ef4c15f5e75bb2ed9f43a8f3f95015 (patch) | |
tree | 8c5bcac4254537d5b6c606eff976ca7000e89fb6 /net/tipc | |
parent | 4f61d4ef7088581997ad95ad37db2d8a459844e4 (diff) |
tipc: remove filter and timeout elements from struct tipc_subscription
Until now, struct tipc_subscription has duplicate timeout and filter
attributes present:
1. directly as members of struct tipc_subscription
2. in struct tipc_subscr, which is contained in struct tipc_event
In this commit, we remove the references to these elements as
members of struct tipc_subscription and replace them with elements
from struct tipc_subscr.
Acked-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/subscr.c | 15 | ||||
-rw-r--r-- | net/tipc/subscr.h | 5 |
2 files changed, 8 insertions, 12 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 7e61a907d860..cef0b6b967d3 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -110,7 +110,8 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, u32 found_lower, | |||
110 | { | 110 | { |
111 | if (!tipc_subscrp_check_overlap(sub, found_lower, found_upper)) | 111 | if (!tipc_subscrp_check_overlap(sub, found_lower, found_upper)) |
112 | return; | 112 | return; |
113 | if (!must && !(sub->filter & TIPC_SUB_PORTS)) | 113 | if (!must && |
114 | !(htohl(sub->evt.s.filter, sub->swap) & TIPC_SUB_PORTS)) | ||
114 | return; | 115 | return; |
115 | 116 | ||
116 | tipc_subscrp_send_event(sub, found_lower, found_upper, event, port_ref, | 117 | tipc_subscrp_send_event(sub, found_lower, found_upper, event, port_ref, |
@@ -222,6 +223,7 @@ static int tipc_subscrp_create(struct net *net, struct tipc_subscr *s, | |||
222 | { | 223 | { |
223 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 224 | struct tipc_net *tn = net_generic(net, tipc_net_id); |
224 | struct tipc_subscription *sub; | 225 | struct tipc_subscription *sub; |
226 | u32 timeout, filter; | ||
225 | int swap; | 227 | int swap; |
226 | 228 | ||
227 | /* Determine subscriber's endianness */ | 229 | /* Determine subscriber's endianness */ |
@@ -253,10 +255,8 @@ static int tipc_subscrp_create(struct net *net, struct tipc_subscr *s, | |||
253 | sub->seq.type = htohl(s->seq.type, swap); | 255 | sub->seq.type = htohl(s->seq.type, swap); |
254 | sub->seq.lower = htohl(s->seq.lower, swap); | 256 | sub->seq.lower = htohl(s->seq.lower, swap); |
255 | sub->seq.upper = htohl(s->seq.upper, swap); | 257 | sub->seq.upper = htohl(s->seq.upper, swap); |
256 | sub->timeout = msecs_to_jiffies(htohl(s->timeout, swap)); | 258 | filter = htohl(s->filter, swap); |
257 | sub->filter = htohl(s->filter, swap); | 259 | if (((filter & TIPC_SUB_PORTS) && (filter & TIPC_SUB_SERVICE)) || |
258 | if ((!(sub->filter & TIPC_SUB_PORTS) == | ||
259 | !(sub->filter & TIPC_SUB_SERVICE)) || | ||
260 | (sub->seq.lower > sub->seq.upper)) { | 260 | (sub->seq.lower > sub->seq.upper)) { |
261 | pr_warn("Subscription rejected, illegal request\n"); | 261 | pr_warn("Subscription rejected, illegal request\n"); |
262 | kfree(sub); | 262 | kfree(sub); |
@@ -265,13 +265,14 @@ static int tipc_subscrp_create(struct net *net, struct tipc_subscr *s, | |||
265 | spin_lock_bh(&subscriber->lock); | 265 | spin_lock_bh(&subscriber->lock); |
266 | list_add(&sub->subscrp_list, &subscriber->subscrp_list); | 266 | list_add(&sub->subscrp_list, &subscriber->subscrp_list); |
267 | spin_unlock_bh(&subscriber->lock); | 267 | spin_unlock_bh(&subscriber->lock); |
268 | |||
268 | sub->subscriber = subscriber; | 269 | sub->subscriber = subscriber; |
269 | sub->swap = swap; | 270 | sub->swap = swap; |
270 | memcpy(&sub->evt.s, s, sizeof(*s)); | 271 | memcpy(&sub->evt.s, s, sizeof(*s)); |
271 | atomic_inc(&tn->subscription_count); | 272 | atomic_inc(&tn->subscription_count); |
272 | setup_timer(&sub->timer, tipc_subscrp_timeout, (unsigned long)sub); | 273 | setup_timer(&sub->timer, tipc_subscrp_timeout, (unsigned long)sub); |
273 | sub->timeout += jiffies; | 274 | timeout = htohl(sub->evt.s.timeout, swap); |
274 | if (!mod_timer(&sub->timer, sub->timeout)) | 275 | if (!mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout))) |
275 | tipc_subscrb_get(subscriber); | 276 | tipc_subscrb_get(subscriber); |
276 | *sub_p = sub; | 277 | *sub_p = sub; |
277 | return 0; | 278 | return 0; |
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h index 92ee18cc5fe6..9e69dbf05626 100644 --- a/net/tipc/subscr.h +++ b/net/tipc/subscr.h | |||
@@ -50,12 +50,9 @@ struct tipc_subscriber; | |||
50 | * @subscriber: pointer to its subscriber | 50 | * @subscriber: pointer to its subscriber |
51 | * @seq: name sequence associated with subscription | 51 | * @seq: name sequence associated with subscription |
52 | * @net: point to network namespace | 52 | * @net: point to network namespace |
53 | * @timeout: duration of subscription (in ms) | ||
54 | * @filter: event filtering to be done for subscription | ||
55 | * @timer: timer governing subscription duration (optional) | 53 | * @timer: timer governing subscription duration (optional) |
56 | * @nameseq_list: adjacent subscriptions in name sequence's subscription list | 54 | * @nameseq_list: adjacent subscriptions in name sequence's subscription list |
57 | * @subscrp_list: adjacent subscriptions in subscriber's subscription list | 55 | * @subscrp_list: adjacent subscriptions in subscriber's subscription list |
58 | * @server_ref: object reference of server port associated with subscription | ||
59 | * @swap: indicates if subscriber uses opposite endianness in its messages | 56 | * @swap: indicates if subscriber uses opposite endianness in its messages |
60 | * @evt: template for events generated by subscription | 57 | * @evt: template for events generated by subscription |
61 | */ | 58 | */ |
@@ -63,8 +60,6 @@ struct tipc_subscription { | |||
63 | struct tipc_subscriber *subscriber; | 60 | struct tipc_subscriber *subscriber; |
64 | struct tipc_name_seq seq; | 61 | struct tipc_name_seq seq; |
65 | struct net *net; | 62 | struct net *net; |
66 | unsigned long timeout; | ||
67 | u32 filter; | ||
68 | struct timer_list timer; | 63 | struct timer_list timer; |
69 | struct list_head nameseq_list; | 64 | struct list_head nameseq_list; |
70 | struct list_head subscrp_list; | 65 | struct list_head subscrp_list; |