Release 4.17 net/tipc/subscr.c
/*
* net/tipc/subscr.c: TIPC network topology service
*
* Copyright (c) 2000-2017, Ericsson AB
* Copyright (c) 2005-2007, 2010-2013, Wind River Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "core.h"
#include "name_table.h"
#include "subscr.h"
static void tipc_sub_send_event(struct tipc_subscription *sub,
u32 found_lower, u32 found_upper,
u32 event, u32 port, u32 node)
{
struct tipc_event *evt = &sub->evt;
if (sub->inactive)
return;
tipc_evt_write(evt, event, event);
tipc_evt_write(evt, found_lower, found_lower);
tipc_evt_write(evt, found_upper, found_upper);
tipc_evt_write(evt, port.ref, port);
tipc_evt_write(evt, port.node, node);
tipc_topsrv_queue_evt(sub->net, sub->conid, event, evt);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Per Liden | 53 | 49.53% | 1 | 9.09% |
| Jon Paul Maloy | 40 | 37.38% | 6 | 54.55% |
| Ying Xue | 8 | 7.48% | 2 | 18.18% |
| Neil Horman | 5 | 4.67% | 1 | 9.09% |
| Paul Gortmaker | 1 | 0.93% | 1 | 9.09% |
| Total | 107 | 100.00% | 11 | 100.00% |
/**
* tipc_sub_check_overlap - test for subscription overlap with the
* given values
*
* Returns 1 if there is overlap, otherwise 0.
*/
int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower,
u32 found_upper)
{
if (found_lower < seq->lower)
found_lower = seq->lower;
if (found_upper > seq->upper)
found_upper = seq->upper;
if (found_lower > found_upper)
return 0;
return 1;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Per Liden | 49 | 87.50% | 1 | 33.33% |
| Parthasarathy Bhuvaragan | 6 | 10.71% | 1 | 33.33% |
| Jon Paul Maloy | 1 | 1.79% | 1 | 33.33% |
| Total | 56 | 100.00% | 3 | 100.00% |
void tipc_sub_report_overlap(struct tipc_subscription *sub,
u32 found_lower, u32 found_upper,
u32 event, u32 port, u32 node,
u32 scope, int must)
{
struct tipc_subscr *s = &sub->evt.s;
u32 filter = tipc_sub_read(s, filter);
struct tipc_name_seq seq;
seq.type = tipc_sub_read(s, seq.type);
seq.lower = tipc_sub_read(s, seq.lower);
seq.upper = tipc_sub_read(s, seq.upper);
if (!tipc_sub_check_overlap(&seq, found_lower, found_upper))
return;
if (!must && !(filter & TIPC_SUB_PORTS))
return;
if (filter & TIPC_SUB_CLUSTER_SCOPE && scope == TIPC_NODE_SCOPE)
return;
if (filter & TIPC_SUB_NODE_SCOPE && scope != TIPC_NODE_SCOPE)
return;
spin_lock(&sub->lock);
tipc_sub_send_event(sub, found_lower, found_upper,
event, port, node);
spin_unlock(&sub->lock);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Jon Paul Maloy | 101 | 57.39% | 4 | 50.00% |
| Per Liden | 60 | 34.09% | 1 | 12.50% |
| Parthasarathy Bhuvaragan | 12 | 6.82% | 1 | 12.50% |
| Lijun Chen | 2 | 1.14% | 1 | 12.50% |
| Paul Gortmaker | 1 | 0.57% | 1 | 12.50% |
| Total | 176 | 100.00% | 8 | 100.00% |
static void tipc_sub_timeout(struct timer_list *t)
{
struct tipc_subscription *sub = from_timer(sub, t, timer);
struct tipc_subscr *s = &sub->evt.s;
spin_lock(&sub->lock);
tipc_sub_send_event(sub, s->seq.lower, s->seq.upper,
TIPC_SUBSCR_TIMEOUT, 0, 0);
sub->inactive = true;
spin_unlock(&sub->lock);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Per Liden | 27 | 32.93% | 1 | 10.00% |
| Ying Xue | 18 | 21.95% | 4 | 40.00% |
| Jon Paul Maloy | 17 | 20.73% | 2 | 20.00% |
| Kees Cook | 12 | 14.63% | 1 | 10.00% |
| Lijun Chen | 7 | 8.54% | 1 | 10.00% |
| Paul Gortmaker | 1 | 1.22% | 1 | 10.00% |
| Total | 82 | 100.00% | 10 | 100.00% |
static void tipc_sub_kref_release(struct kref *kref)
{
kfree(container_of(kref, struct tipc_subscription, kref));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Parthasarathy Bhuvaragan | 14 | 58.33% | 1 | 25.00% |
| Ying Xue | 7 | 29.17% | 1 | 25.00% |
| Jon Paul Maloy | 3 | 12.50% | 2 | 50.00% |
| Total | 24 | 100.00% | 4 | 100.00% |
void tipc_sub_put(struct tipc_subscription *subscription)
{
kref_put(&subscription->kref, tipc_sub_kref_release);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Parthasarathy Bhuvaragan | 16 | 80.00% | 1 | 33.33% |
| Jon Paul Maloy | 2 | 10.00% | 1 | 33.33% |
| Ying Xue | 2 | 10.00% | 1 | 33.33% |
| Total | 20 | 100.00% | 3 | 100.00% |
void tipc_sub_get(struct tipc_subscription *subscription)
{
kref_get(&subscription->kref);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Parthasarathy Bhuvaragan | 11 | 61.11% | 1 | 33.33% |
| Ying Xue | 6 | 33.33% | 1 | 33.33% |
| Jon Paul Maloy | 1 | 5.56% | 1 | 33.33% |
| Total | 18 | 100.00% | 3 | 100.00% |
struct tipc_subscription *tipc_sub_subscribe(struct net *net,
struct tipc_subscr *s,
int conid)
{
u32 filter = tipc_sub_read(s, filter);
struct tipc_subscription *sub;
u32 timeout;
if ((filter & TIPC_SUB_PORTS && filter & TIPC_SUB_SERVICE) ||
(tipc_sub_read(s, seq.lower) > tipc_sub_read(s, seq.upper))) {
pr_warn("Subscription rejected, illegal request\n");
return NULL;
}
sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
if (!sub) {
pr_warn("Subscription rejected, no memory\n");
return NULL;
}
INIT_LIST_HEAD(&sub->service_list);
INIT_LIST_HEAD(&sub->sub_list);
sub->net = net;
sub->conid = conid;
sub->inactive = false;
memcpy(&sub->evt.s, s, sizeof(*s));
spin_lock_init(&sub->lock);
kref_init(&sub->kref);
if (!tipc_nametbl_subscribe(sub)) {
kfree(sub);
return NULL;
}
timer_setup(&sub->timer, tipc_sub_timeout, 0);
timeout = tipc_sub_read(&sub->evt.s, timeout);
if (timeout != TIPC_WAIT_FOREVER)
mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout));
return sub;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Jon Paul Maloy | 116 | 47.54% | 8 | 33.33% |
| Parthasarathy Bhuvaragan | 52 | 21.31% | 6 | 25.00% |
| Per Liden | 36 | 14.75% | 1 | 4.17% |
| Allan Stephens | 21 | 8.61% | 2 | 8.33% |
| Ying Xue | 12 | 4.92% | 4 | 16.67% |
| Neil Horman | 4 | 1.64% | 1 | 4.17% |
| Kees Cook | 2 | 0.82% | 1 | 4.17% |
| Erik Hugne | 1 | 0.41% | 1 | 4.17% |
| Total | 244 | 100.00% | 24 | 100.00% |
void tipc_sub_unsubscribe(struct tipc_subscription *sub)
{
tipc_nametbl_unsubscribe(sub);
if (sub->evt.s.timeout != TIPC_WAIT_FOREVER)
del_timer_sync(&sub->timer);
list_del(&sub->sub_list);
tipc_sub_put(sub);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Jon Paul Maloy | 31 | 64.58% | 4 | 50.00% |
| Parthasarathy Bhuvaragan | 11 | 22.92% | 2 | 25.00% |
| Per Liden | 5 | 10.42% | 1 | 12.50% |
| Ying Xue | 1 | 2.08% | 1 | 12.50% |
| Total | 48 | 100.00% | 8 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Jon Paul Maloy | 314 | 39.95% | 12 | 30.77% |
| Per Liden | 237 | 30.15% | 1 | 2.56% |
| Parthasarathy Bhuvaragan | 122 | 15.52% | 9 | 23.08% |
| Ying Xue | 54 | 6.87% | 9 | 23.08% |
| Allan Stephens | 23 | 2.93% | 3 | 7.69% |
| Kees Cook | 14 | 1.78% | 1 | 2.56% |
| Neil Horman | 9 | 1.15% | 1 | 2.56% |
| Lijun Chen | 9 | 1.15% | 1 | 2.56% |
| Paul Gortmaker | 3 | 0.38% | 1 | 2.56% |
| Erik Hugne | 1 | 0.13% | 1 | 2.56% |
| Total | 786 | 100.00% | 39 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.