Lines Matching refs:sub
55 static void tipc_subscrp_delete(struct tipc_subscription *sub);
70 static void tipc_subscrp_send_event(struct tipc_subscription *sub, in tipc_subscrp_send_event() argument
74 struct tipc_net *tn = net_generic(sub->net, tipc_net_id); in tipc_subscrp_send_event()
75 struct tipc_subscriber *subscriber = sub->subscriber; in tipc_subscrp_send_event()
78 msg_sect.iov_base = (void *)&sub->evt; in tipc_subscrp_send_event()
80 sub->evt.event = htohl(event, sub->swap); in tipc_subscrp_send_event()
81 sub->evt.found_lower = htohl(found_lower, sub->swap); in tipc_subscrp_send_event()
82 sub->evt.found_upper = htohl(found_upper, sub->swap); in tipc_subscrp_send_event()
83 sub->evt.port.ref = htohl(port_ref, sub->swap); in tipc_subscrp_send_event()
84 sub->evt.port.node = htohl(node, sub->swap); in tipc_subscrp_send_event()
95 int tipc_subscrp_check_overlap(struct tipc_subscription *sub, u32 found_lower, in tipc_subscrp_check_overlap() argument
98 if (found_lower < sub->seq.lower) in tipc_subscrp_check_overlap()
99 found_lower = sub->seq.lower; in tipc_subscrp_check_overlap()
100 if (found_upper > sub->seq.upper) in tipc_subscrp_check_overlap()
101 found_upper = sub->seq.upper; in tipc_subscrp_check_overlap()
107 void tipc_subscrp_report_overlap(struct tipc_subscription *sub, u32 found_lower, in tipc_subscrp_report_overlap() argument
111 if (!tipc_subscrp_check_overlap(sub, found_lower, found_upper)) in tipc_subscrp_report_overlap()
113 if (!must && !(sub->filter & TIPC_SUB_PORTS)) in tipc_subscrp_report_overlap()
116 tipc_subscrp_send_event(sub, found_lower, found_upper, event, port_ref, in tipc_subscrp_report_overlap()
122 struct tipc_subscription *sub = (struct tipc_subscription *)data; in tipc_subscrp_timeout() local
123 struct tipc_subscriber *subscriber = sub->subscriber; in tipc_subscrp_timeout()
126 tipc_subscrp_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper, in tipc_subscrp_timeout()
130 tipc_subscrp_delete(sub); in tipc_subscrp_timeout()
173 struct tipc_subscription *sub, *temp; in tipc_subscrb_delete() local
177 list_for_each_entry_safe(sub, temp, &subscriber->subscrp_list, in tipc_subscrb_delete()
179 if (del_timer(&sub->timer)) { in tipc_subscrb_delete()
180 tipc_subscrp_delete(sub); in tipc_subscrb_delete()
189 static void tipc_subscrp_delete(struct tipc_subscription *sub) in tipc_subscrp_delete() argument
191 struct tipc_net *tn = net_generic(sub->net, tipc_net_id); in tipc_subscrp_delete()
193 tipc_nametbl_unsubscribe(sub); in tipc_subscrp_delete()
194 list_del(&sub->subscrp_list); in tipc_subscrp_delete()
195 kfree(sub); in tipc_subscrp_delete()
202 struct tipc_subscription *sub, *temp; in tipc_subscrp_cancel() local
206 list_for_each_entry_safe(sub, temp, &subscriber->subscrp_list, in tipc_subscrp_cancel()
208 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) { in tipc_subscrp_cancel()
209 if (del_timer(&sub->timer)) { in tipc_subscrp_cancel()
210 tipc_subscrp_delete(sub); in tipc_subscrp_cancel()
224 struct tipc_subscription *sub; in tipc_subscrp_create() local
245 sub = kmalloc(sizeof(*sub), GFP_ATOMIC); in tipc_subscrp_create()
246 if (!sub) { in tipc_subscrp_create()
252 sub->net = net; in tipc_subscrp_create()
253 sub->seq.type = htohl(s->seq.type, swap); in tipc_subscrp_create()
254 sub->seq.lower = htohl(s->seq.lower, swap); in tipc_subscrp_create()
255 sub->seq.upper = htohl(s->seq.upper, swap); in tipc_subscrp_create()
256 sub->timeout = msecs_to_jiffies(htohl(s->timeout, swap)); in tipc_subscrp_create()
257 sub->filter = htohl(s->filter, swap); in tipc_subscrp_create()
258 if ((!(sub->filter & TIPC_SUB_PORTS) == in tipc_subscrp_create()
259 !(sub->filter & TIPC_SUB_SERVICE)) || in tipc_subscrp_create()
260 (sub->seq.lower > sub->seq.upper)) { in tipc_subscrp_create()
262 kfree(sub); in tipc_subscrp_create()
266 list_add(&sub->subscrp_list, &subscriber->subscrp_list); in tipc_subscrp_create()
268 sub->subscriber = subscriber; in tipc_subscrp_create()
269 sub->swap = swap; in tipc_subscrp_create()
270 memcpy(&sub->evt.s, s, sizeof(*s)); in tipc_subscrp_create()
272 setup_timer(&sub->timer, tipc_subscrp_timeout, (unsigned long)sub); in tipc_subscrp_create()
273 if (sub->timeout != TIPC_WAIT_FOREVER) in tipc_subscrp_create()
274 sub->timeout += jiffies; in tipc_subscrp_create()
275 if (!mod_timer(&sub->timer, sub->timeout)) in tipc_subscrp_create()
277 *sub_p = sub; in tipc_subscrp_create()
293 struct tipc_subscription *sub = NULL; in tipc_subscrb_rcv_cb() local
296 if (tipc_subscrp_create(net, (struct tipc_subscr *)buf, subscrb, &sub)) in tipc_subscrb_rcv_cb()
299 tipc_nametbl_subscribe(sub); in tipc_subscrb_rcv_cb()