: Network topology server modifications
Subsystems (3)
cover : Network topology server modifications
This patch set includes a number of enhancements and fixes to TIPC's network topology service. Please see each individual patch for further description.
Summary:
net/tipc/core.c | 3 - net/tipc/subscr.c | 250 +++++++++++++++++++++++++++++------------------------ net/tipc/subscr.h | 34 +++++-- 3 files changed, 159 insertions(+), 128 deletions(-)
Allan Stephens (5):
[TIPC]: Add support for customized subscription overlap handling [TIPC]: Add support for customized subscription endianness [TIPC]: Fix bug in topology server byte swapping routine [TIPC]: Consolidate subscriber & subscriber port references [TIPC]: Cosmetic cleanup of topology service code
Thanks,
Al
PATCH 1/5 : Add support for customized subscription overlap handling
This patch enables TIPC's topology server code to do customized overlap detection handling on a per-subscription basis. (This capability is needed to support the upcoming introduction of multi-cluster TIPC networks.)
--- net/tipc/subscr.c | 4 +++- net/tipc/subscr.h | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletions(-)
net/tipc/subscr.c +3 -1
@@ -157,7 +157,8 @@ void tipc_subscr_report_overlap(struct subscription *sub,return ;if (!must && !(sub->filter &TIPC_SUB_PORTS ))return ; -subscr_send_event (sub, found_lower, found_upper, event, port_ref, node); + + sub->event_cb (sub, found_lower, found_upper, event, port_ref, node); }/**
@@ -372,6 +373,7 @@ static void subscr_subscribe(struct tipc_subscr *s,subscr_terminate (subscriber);return ; } + sub->event_cb = subscr_send_event;memcpy (&sub->evt.s, s,sizeof (struct tipc_subscr ));INIT_LIST_HEAD (&sub->subscription_list);INIT_LIST_HEAD (&sub->nameseq_list);
net/tipc/subscr.h +8 -0
@@ -37,11 +37,18 @@#ifndef _TIPC_SUBSCR_H#define _TIPC_SUBSCR_H +struct subscription ; + +typedef void (*tipc_subscr_event ) (struct subscription *sub, +u32 found_lower,u32 found_upper, +u32 event,u32 port_ref,u32 node); +/** * struct subscription - TIPC network topology subscription object * @seq: name sequence associated with subscription * @timeout: duration of subscription (in ms) * @filter: event filtering to be done for subscription +* @event_cb: routine invoked when a subscription event is detected * @evt: template for events generated by subscription * @subscription_list: adjacent subscriptions in subscriber's subscription list * @nameseq_list: adjacent subscriptions in name sequence's subscription list
@@ -53,6 +60,7 @@ struct subscription {struct tipc_name_seq seq;u32 timeout;u32 filter; +tipc_subscr_event event_cb;struct tipc_event evt;struct list_head subscription_list;struct list_head nameseq_list;
Signature · 1 line
1.5.3.2
Re: [PATCH 1/5 net-next-2.6] [TIPC]: Add support for customized subscription overlap handling
From: Allan Stephens <[email protected]>
Date: Tue, 13 May 2008 14:17:41 -0400
Quoted 6 lines
This patch enables TIPC's topology server code to do customized overlap detection handling on a per-subscription basis. (This capability is needed to support the upcoming introduction of multi-cluster TIPC networks.)
Signed-off-by Allan Stephens <[email protected]>
Applied.
PATCH 2/5 : Add support for customized subscription endianness
In reply to Allan StephensThis patch enables TIPC's topology server code to do customized endianness conversions on a per-subscription basis. (This capability is needed to support the upcoming consolidation of subscriber and subscription object references.)
--- net/tipc/subscr.c | 35 ++++++++++++++++------------------- net/tipc/subscr.h | 2 ++ 2 files changed, 18 insertions(+), 19 deletions(-)
net/tipc/subscr.c +16 -19
@@ -47,7 +47,6 @@* @subscriber_list: adjacent subscribers in top. server's list of subscribers * @subscription_list: list of subscription objects for this subscriber * @port_ref: object reference to port used to communicate with subscriber -* @swap: indicates if subscriber uses opposite endianness in its messages */ struct subscriber {
@@ -56,7 +55,6 @@ struct subscriber {struct list_head subscriber_list;struct list_head subscription_list;u32 port_ref; -int swap; };/**
@@ -109,11 +107,11 @@ static void subscr_send_event(struct subscription *sub, msg_sect.iov_base = (void *)&sub->evt; msg_sect.iov_len =sizeof (struct tipc_event ); - sub->evt.event =htohl (event, sub->owner->swap); - sub->evt.found_lower =htohl (found_lower, sub->owner->swap); - sub->evt.found_upper =htohl (found_upper, sub->owner->swap); - sub->evt.port.ref =htohl (port_ref, sub->owner->swap); - sub->evt.port.node =htohl (node, sub->owner->swap); + sub->evt.event =htohl (event, sub->swap); + sub->evt.found_lower =htohl (found_lower, sub->swap); + sub->evt.found_upper =htohl (found_upper, sub->swap); + sub->evt.port.ref =htohl (port_ref, sub->swap); + sub->evt.port.node =htohl (node, sub->swap);tipc_send (sub->owner->port_ref,1 , &msg_sect); }
@@ -324,18 +322,16 @@ static void subscr_subscribe(struct tipc_subscr *s, struct subscriber *subscriber) {struct subscription *sub; +int swap; -/* Determine/update subscriber's endianness */ +/* Determine subscriber's endianness */ -if (s->filter & (TIPC_SUB_PORTS |TIPC_SUB_SERVICE )) - subscriber->swap =0 ; -else - subscriber->swap =1 ; + swap = !(s->filter & (TIPC_SUB_PORTS |TIPC_SUB_SERVICE ));/* Detect & process a subscription cancellation request */ -if (s->filter &htohl (TIPC_SUB_CANCEL , subscriber->swap)) { - s->filter &= ~htohl (TIPC_SUB_CANCEL , subscriber->swap); +if (s->filter &htohl (TIPC_SUB_CANCEL , swap)) { + s->filter &= ~htohl (TIPC_SUB_CANCEL , swap);subscr_cancel (s, subscriber);return ; }
@@ -360,11 +356,11 @@ static void subscr_subscribe(struct tipc_subscr *s,/* Initialize subscription object */ - sub->seq.type =htohl (s->seq.type, subscriber->swap); - sub->seq.lower =htohl (s->seq.lower, subscriber->swap); - sub->seq.upper =htohl (s->seq.upper, subscriber->swap); - sub->timeout =htohl (s->timeout, subscriber->swap); - sub->filter =htohl (s->filter, subscriber->swap); + sub->seq.type =htohl (s->seq.type, swap); + sub->seq.lower =htohl (s->seq.lower, swap); + sub->seq.upper =htohl (s->seq.upper, swap); + sub->timeout =htohl (s->timeout, swap); + sub->filter =htohl (s->filter, swap);if ((!(sub->filter &TIPC_SUB_PORTS ) == !(sub->filter &TIPC_SUB_SERVICE )) || (sub->seq.lower > sub->seq.upper)) {
@@ -378,6 +374,7 @@ static void subscr_subscribe(struct tipc_subscr *s,INIT_LIST_HEAD (&sub->subscription_list);INIT_LIST_HEAD (&sub->nameseq_list);list_add (&sub->subscription_list, &subscriber->subscription_list); + sub->swap = swap;atomic_inc (&topsrv.subscription_count);if (sub->timeout !=TIPC_WAIT_FOREVER ) { k_init_timer(&sub->timer,
net/tipc/subscr.h +2 -0
@@ -49,6 +49,7 @@ typedef void (*tipc_subscr_event) (struct subscription *sub,* @timeout: duration of subscription (in ms) * @filter: event filtering to be done for subscription * @event_cb: routine invoked when a subscription event is detected +* @swap: indicates if subscriber uses opposite endianness in its messages * @evt: template for events generated by subscription * @subscription_list: adjacent subscriptions in subscriber's subscription list * @nameseq_list: adjacent subscriptions in name sequence's subscription list
@@ -61,6 +62,7 @@ struct subscription {u32 timeout;u32 filter;tipc_subscr_event event_cb; +int swap;struct tipc_event evt;struct list_head subscription_list;struct list_head nameseq_list;
Signature · 1 line
1.5.3.2
Re: [PATCH 2/5 net-next-2.6] [TIPC]: Add support for customized subscription endianness
From: Allan Stephens <[email protected]>
Date: Tue, 13 May 2008 14:17:42 -0400
Quoted 6 lines
This patch enables TIPC's topology server code to do customized endianness conversions on a per-subscription basis. (This capability is needed to support the upcoming consolidation of subscriber and subscription object references.)
Signed-off-by Allan Stephens <[email protected]>
Applied.
PATCH 3/5 : Fix bug in topology server byte swapping routine
In reply to Allan StephensThis patch fixes TIPC's topology server so that it does byte swapping correctly when endianness conversion is required. (Note: This bug only impacted an application if it issues a subscription request to a topology server on another node, rather than the server on it's own node; since the topology server is normally not accessible by off-node applications, most TIPC applications were not impacted by the bug.)
--- net/tipc/subscr.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
net/tipc/subscr.c +1 -3
@@ -86,9 +86,7 @@ static struct top_srv topsrv = { 0 };static u32 htohl (u32 in,int swap) { -char *c = (char *)∈ - -return swap ? ((c[3 ] <<3 ) + (c[2 ] <<2 ) + (c[1 ] <<1 ) + c[0 ]) : in; +return swap ? (u32 )___constant_swab32 (in) : in; }/**
Signature · 1 line
1.5.3.2
Re: [PATCH 3/5 net-next-2.6] [TIPC]: Fix bug in topology server byte swapping routine
From: Allan Stephens <[email protected]>
Date: Tue, 13 May 2008 14:17:43 -0400
Quoted 8 lines
This patch fixes TIPC's topology server so that it does byte swapping correctly when endianness conversion is required. (Note: This bug only impacted an application if it issues a subscription request to a topology server on another node, rather than the server on it's own node; since the topology server is normally not accessible by off-node applications, most TIPC applications were not impacted by the bug.)
Signed-off-by Allan Stephens <[email protected]>
Applied.
PATCH 4/5 : Consolidate subscriber & subscriber port references
In reply to Allan StephensThis patch modifies TIPC's network topology service so that it only requires a single reference table entry per subscriber connection, rather than two. This is achieved by letting the reference to the server port communicating with the subscriber act as the reference to the subscriber object itself. (Since the subscriber cannot exist without its port, and vice versa, this dual role for the reference is perfectly natural.) This consolidation reduces the size of the reference table by 50% in the default configuration.
--- net/tipc/core.c | 3 +- net/tipc/subscr.c | 199 ++++++++++++++++++++++++++++++----------------------- net/tipc/subscr.h | 4 +- 3 files changed, 116 insertions(+), 90 deletions(-)
net/tipc/core.c +1 -2
@@ -164,8 +164,7 @@ int tipc_core_start(void) tipc_mode =TIPC_NODE_MODE ; if ((res = tipc_handler_start()) || - (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions, - tipc_random)) || + (res = tipc_ref_table_init(tipc_max_ports, tipc_random)) || (res = tipc_reg_start()) || (res = tipc_nametbl_init()) || (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
net/tipc/subscr.c +113 -86
417 lines not on this page · raw message
net/tipc/subscr.h +2 -2
@@ -49,12 +49,12 @@ typedef void (*tipc_subscr_event) (struct subscription *sub,* @timeout: duration of subscription (in ms) * @filter: event filtering to be done for subscription * @event_cb: routine invoked when a subscription event is detected +* @server_ref: object reference of server port associated with subscription * @swap: indicates if subscriber uses opposite endianness in its messages * @evt: template for events generated by subscription * @subscription_list: adjacent subscriptions in subscriber's subscription list * @nameseq_list: adjacent subscriptions in name sequence's subscription list * @timer_ref: reference to timer governing subscription duration (may be NULL) -* @owner: pointer to subscriber object associated with this subscription */ struct subscription {
@@ -62,12 +62,12 @@ struct subscription {u32 timeout;u32 filter;tipc_subscr_event event_cb; +u32 server_ref;int swap;struct tipc_event evt;struct list_head subscription_list;struct list_head nameseq_list;struct timer_list timer; -struct subscriber *owner; }; int tipc_subscr_overlap(struct subscription * sub,
Signature · 1 line
1.5.3.2
Re: [PATCH 4/5 net-next-2.6] [TIPC]: Consolidate subscriber & subscriber port references
From: Allan Stephens <[email protected]>
Date: Tue, 13 May 2008 14:17:44 -0400
Quoted 11 lines
This patch modifies TIPC's network topology service so that it only requires a single reference table entry per subscriber connection, rather than two. This is achieved by letting the reference to the server port communicating with the subscriber act as the reference to the subscriber object itself. (Since the subscriber cannot exist without its port, and vice versa, this dual role for the reference is perfectly natural.) This consolidation reduces the size of the reference table by 50% in the default configuration.
Signed-off-by Allan Stephens <[email protected]>
Applied.
PATCH 5/5 : Cosmetic cleanup of topology service code
In reply to Allan StephensThis patch contains a set of cosmetic changes to TIPC's network topology service subsystem, including:
- updates to comments (including copyright dates)
- re-ordering structure fields to group them more logically
- removal of optional debugging code that is no longer required
- minor changes to whitespace to conform to Linux coding conventions
--- net/tipc/subscr.c | 8 +++----- net/tipc/subscr.h | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-)
net/tipc/subscr.c +3 -5
@@ -1,8 +1,8 @@/* -* net/tipc/subscr.c: TIPC subscription service +* net/tipc/subscr.c: TIPC network topology service * * Copyright (c) 2000-2006, Ericsson AB -* Copyright (c) 2005, Wind River Systems +* Copyright (c) 2005-2007, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -36,10 +36,10 @@#include "core.h" #include "dbg.h" -#include "subscr.h" #include "name_table.h" #include "port.h" #include "ref.h" +#include "subscr.h" /** * struct subscriber - TIPC network topology subscriber
@@ -149,8 +149,6 @@ void tipc_subscr_report_overlap(struct subscription *sub, u32 node, int must) { -dbg ("Rep overlap %u:%u,%u<->%u,%u\n" , sub->seq.type, sub->seq.lower, - sub->seq.upper, found_lower, found_upper);if (!tipc_subscr_overlap (sub, found_lower, found_upper))return ;if (!must && !(sub->filter &TIPC_SUB_PORTS ))
net/tipc/subscr.h +10 -10
@@ -1,8 +1,8 @@/* -* net/tipc/subscr.h: Include file for TIPC subscription service +* net/tipc/subscr.h: Include file for TIPC network topology service * * Copyright (c) 2003-2006, Ericsson AB -* Copyright (c) 2005, Wind River Systems +* Copyright (c) 2005-2007, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -49,12 +49,12 @@ typedef void (*tipc_subscr_event) (struct subscription *sub,* @timeout: duration of subscription (in ms) * @filter: event filtering to be done for subscription * @event_cb: routine invoked when a subscription event is detected +* @timer: timer governing subscription duration (optional) +* @nameseq_list: adjacent subscriptions in name sequence's subscription list +* @subscription_list: adjacent subscriptions in subscriber's subscription list * @server_ref: object reference of server port associated with subscription * @swap: indicates if subscriber uses opposite endianness in its messages * @evt: template for events generated by subscription -* @subscription_list: adjacent subscriptions in subscriber's subscription list -* @nameseq_list: adjacent subscriptions in name sequence's subscription list -* @timer_ref: reference to timer governing subscription duration (may be NULL) */ struct subscription {
@@ -62,19 +62,19 @@ struct subscription {u32 timeout;u32 filter;tipc_subscr_event event_cb; +struct timer_list timer; +struct list_head nameseq_list; +struct list_head subscription_list;u32 server_ref;int swap;struct tipc_event evt; -struct list_head subscription_list; -struct list_head nameseq_list; -struct timer_list timer; }; -int tipc_subscr_overlap (struct subscription * sub, +int tipc_subscr_overlap (struct subscription *sub,u32 found_lower,u32 found_upper); -void tipc_subscr_report_overlap(struct subscription * sub, +void tipc_subscr_report_overlap(struct subscription *sub, u32 found_lower, u32 found_upper, u32 event,
Signature · 1 line
1.5.3.2
Re: [PATCH 5/5 net-next-2.6] [TIPC]: Cosmetic cleanup of topology service code
From: Allan Stephens <[email protected]>
Date: Tue, 13 May 2008 14:17:45 -0400
Quoted 9 lines
This patch contains a set of cosmetic changes to TIPC's network topology service subsystem, including:
- updates to comments (including copyright dates)
- re-ordering structure fields to group them more logically
- removal of optional debugging code that is no longer required
- minor changes to whitespace to conform to Linux coding conventionsSigned-off-by Allan Stephens <[email protected]>
Applied.