Lines Matching +full:sub +full:-

4  * Copyright (c) 2000-2017, Ericsson AB
5 * Copyright (c) 2005-2007, 2010-2013, Wind River Systems
6 * Copyright (c) 2020-2021, Red Hat Inc
42 static void tipc_sub_send_event(struct tipc_subscription *sub, in tipc_sub_send_event() argument
46 struct tipc_subscr *s = &sub->evt.s; in tipc_sub_send_event()
47 struct tipc_event *evt = &sub->evt; in tipc_sub_send_event()
49 if (sub->inactive) in tipc_sub_send_event()
53 tipc_evt_write(evt, found_lower, p->sr.lower); in tipc_sub_send_event()
54 tipc_evt_write(evt, found_upper, p->sr.upper); in tipc_sub_send_event()
55 tipc_evt_write(evt, port.ref, p->sk.ref); in tipc_sub_send_event()
56 tipc_evt_write(evt, port.node, p->sk.node); in tipc_sub_send_event()
58 tipc_evt_write(evt, found_lower, s->seq.lower); in tipc_sub_send_event()
59 tipc_evt_write(evt, found_upper, s->seq.upper); in tipc_sub_send_event()
63 tipc_topsrv_queue_evt(sub->net, sub->conid, event, evt); in tipc_sub_send_event()
67 * tipc_sub_check_overlap - test for subscription overlap with the given values
76 u32 found_lower = found->lower; in tipc_sub_check_overlap()
77 u32 found_upper = found->upper; in tipc_sub_check_overlap()
79 if (found_lower < subscribed->lower) in tipc_sub_check_overlap()
80 found_lower = subscribed->lower; in tipc_sub_check_overlap()
81 if (found_upper > subscribed->upper) in tipc_sub_check_overlap()
82 found_upper = subscribed->upper; in tipc_sub_check_overlap()
86 void tipc_sub_report_overlap(struct tipc_subscription *sub, in tipc_sub_report_overlap() argument
90 struct tipc_service_range *sr = &sub->s.seq; in tipc_sub_report_overlap()
91 u32 filter = sub->s.filter; in tipc_sub_report_overlap()
93 if (!tipc_sub_check_overlap(sr, &p->sr)) in tipc_sub_report_overlap()
97 if (filter & TIPC_SUB_CLUSTER_SCOPE && p->scope == TIPC_NODE_SCOPE) in tipc_sub_report_overlap()
99 if (filter & TIPC_SUB_NODE_SCOPE && p->scope != TIPC_NODE_SCOPE) in tipc_sub_report_overlap()
101 spin_lock(&sub->lock); in tipc_sub_report_overlap()
102 tipc_sub_send_event(sub, p, event); in tipc_sub_report_overlap()
103 spin_unlock(&sub->lock); in tipc_sub_report_overlap()
108 struct tipc_subscription *sub = from_timer(sub, t, timer); in tipc_sub_timeout() local
110 spin_lock(&sub->lock); in tipc_sub_timeout()
111 tipc_sub_send_event(sub, NULL, TIPC_SUBSCR_TIMEOUT); in tipc_sub_timeout()
112 sub->inactive = true; in tipc_sub_timeout()
113 spin_unlock(&sub->lock); in tipc_sub_timeout()
123 kref_put(&subscription->kref, tipc_sub_kref_release); in tipc_sub_put()
128 kref_get(&subscription->kref); in tipc_sub_get()
138 struct tipc_subscription *sub; in tipc_sub_subscribe() local
146 sub = kmalloc(sizeof(*sub), GFP_ATOMIC); in tipc_sub_subscribe()
147 if (!sub) { in tipc_sub_subscribe()
151 INIT_LIST_HEAD(&sub->service_list); in tipc_sub_subscribe()
152 INIT_LIST_HEAD(&sub->sub_list); in tipc_sub_subscribe()
153 sub->net = net; in tipc_sub_subscribe()
154 sub->conid = conid; in tipc_sub_subscribe()
155 sub->inactive = false; in tipc_sub_subscribe()
156 memcpy(&sub->evt.s, s, sizeof(*s)); in tipc_sub_subscribe()
157 sub->s.seq.type = tipc_sub_read(s, seq.type); in tipc_sub_subscribe()
158 sub->s.seq.lower = lower; in tipc_sub_subscribe()
159 sub->s.seq.upper = upper; in tipc_sub_subscribe()
160 sub->s.filter = filter; in tipc_sub_subscribe()
161 sub->s.timeout = tipc_sub_read(s, timeout); in tipc_sub_subscribe()
162 memcpy(sub->s.usr_handle, s->usr_handle, 8); in tipc_sub_subscribe()
163 spin_lock_init(&sub->lock); in tipc_sub_subscribe()
164 kref_init(&sub->kref); in tipc_sub_subscribe()
165 if (!tipc_nametbl_subscribe(sub)) { in tipc_sub_subscribe()
166 kfree(sub); in tipc_sub_subscribe()
169 timer_setup(&sub->timer, tipc_sub_timeout, 0); in tipc_sub_subscribe()
170 timeout = tipc_sub_read(&sub->evt.s, timeout); in tipc_sub_subscribe()
172 mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout)); in tipc_sub_subscribe()
173 return sub; in tipc_sub_subscribe()
176 void tipc_sub_unsubscribe(struct tipc_subscription *sub) in tipc_sub_unsubscribe() argument
178 tipc_nametbl_unsubscribe(sub); in tipc_sub_unsubscribe()
179 if (sub->evt.s.timeout != TIPC_WAIT_FOREVER) in tipc_sub_unsubscribe()
180 del_timer_sync(&sub->timer); in tipc_sub_unsubscribe()
181 list_del(&sub->sub_list); in tipc_sub_unsubscribe()
182 tipc_sub_put(sub); in tipc_sub_unsubscribe()