Commit 097916ec authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

parents 3da38566 29f8f632
...@@ -1398,7 +1398,7 @@ IRDA SUBSYSTEM ...@@ -1398,7 +1398,7 @@ IRDA SUBSYSTEM
P: Jean Tourrilhes P: Jean Tourrilhes
L: irda-users@lists.sourceforge.net (subscribers-only) L: irda-users@lists.sourceforge.net (subscribers-only)
W: http://irda.sourceforge.net/ W: http://irda.sourceforge.net/
S: Maintained S: Odd Fixes
ISAPNP ISAPNP
P: Jaroslav Kysela P: Jaroslav Kysela
...@@ -1843,7 +1843,14 @@ M: yoshfuji@linux-ipv6.org ...@@ -1843,7 +1843,14 @@ M: yoshfuji@linux-ipv6.org
P: Patrick McHardy P: Patrick McHardy
M: kaber@coreworks.de M: kaber@coreworks.de
L: netdev@vger.kernel.org L: netdev@vger.kernel.org
T: git kernel.org:/pub/scm/linux/kernel/davem/net-2.6.git T: git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git
S: Maintained
NETWORKING [WIRELESS]
P: John W. Linville
M: linville@tuxdriver.com
L: netdev@vger.kernel.org
T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
S: Maintained S: Maintained
IPVS IPVS
...@@ -2536,11 +2543,11 @@ S: Maintained ...@@ -2536,11 +2543,11 @@ S: Maintained
TIPC NETWORK LAYER TIPC NETWORK LAYER
P: Per Liden P: Per Liden
M: per.liden@nospam.ericsson.com M: per.liden@ericsson.com
P: Jon Maloy P: Jon Maloy
M: jon.maloy@nospam.ericsson.com M: jon.maloy@ericsson.com
P: Allan Stephens P: Allan Stephens
M: allan.stephens@nospam.windriver.com M: allan.stephens@windriver.com
L: tipc-discussion@lists.sourceforge.net L: tipc-discussion@lists.sourceforge.net
W: http://tipc.sourceforge.net/ W: http://tipc.sourceforge.net/
W: http://tipc.cslab.ericsson.net/ W: http://tipc.cslab.ericsson.net/
......
...@@ -335,6 +335,30 @@ static inline void cas_mask_intr(struct cas *cp) ...@@ -335,6 +335,30 @@ static inline void cas_mask_intr(struct cas *cp)
cas_disable_irq(cp, i); cas_disable_irq(cp, i);
} }
static inline void cas_buffer_init(cas_page_t *cp)
{
struct page *page = cp->buffer;
atomic_set((atomic_t *)&page->lru.next, 1);
}
static inline int cas_buffer_count(cas_page_t *cp)
{
struct page *page = cp->buffer;
return atomic_read((atomic_t *)&page->lru.next);
}
static inline void cas_buffer_inc(cas_page_t *cp)
{
struct page *page = cp->buffer;
atomic_inc((atomic_t *)&page->lru.next);
}
static inline void cas_buffer_dec(cas_page_t *cp)
{
struct page *page = cp->buffer;
atomic_dec((atomic_t *)&page->lru.next);
}
static void cas_enable_irq(struct cas *cp, const int ring) static void cas_enable_irq(struct cas *cp, const int ring)
{ {
if (ring == 0) { /* all but TX_DONE */ if (ring == 0) { /* all but TX_DONE */
...@@ -472,6 +496,7 @@ static int cas_page_free(struct cas *cp, cas_page_t *page) ...@@ -472,6 +496,7 @@ static int cas_page_free(struct cas *cp, cas_page_t *page)
{ {
pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
cas_buffer_dec(page);
__free_pages(page->buffer, cp->page_order); __free_pages(page->buffer, cp->page_order);
kfree(page); kfree(page);
return 0; return 0;
...@@ -501,6 +526,7 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags) ...@@ -501,6 +526,7 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags)
page->buffer = alloc_pages(flags, cp->page_order); page->buffer = alloc_pages(flags, cp->page_order);
if (!page->buffer) if (!page->buffer)
goto page_err; goto page_err;
cas_buffer_init(page);
page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0,
cp->page_size, PCI_DMA_FROMDEVICE); cp->page_size, PCI_DMA_FROMDEVICE);
return page; return page;
...@@ -579,7 +605,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) ...@@ -579,7 +605,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags)
list_for_each_safe(elem, tmp, &list) { list_for_each_safe(elem, tmp, &list) {
cas_page_t *page = list_entry(elem, cas_page_t, list); cas_page_t *page = list_entry(elem, cas_page_t, list);
if (page_count(page->buffer) > 1) if (cas_buffer_count(page) > 1)
continue; continue;
list_del(elem); list_del(elem);
...@@ -1347,7 +1373,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index) ...@@ -1347,7 +1373,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index)
cas_page_t *page = cp->rx_pages[1][index]; cas_page_t *page = cp->rx_pages[1][index];
cas_page_t *new; cas_page_t *new;
if (page_count(page->buffer) == 1) if (cas_buffer_count(page) == 1)
return page; return page;
new = cas_page_dequeue(cp); new = cas_page_dequeue(cp);
...@@ -1367,7 +1393,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring, ...@@ -1367,7 +1393,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring,
cas_page_t **page1 = cp->rx_pages[1]; cas_page_t **page1 = cp->rx_pages[1];
/* swap if buffer is in use */ /* swap if buffer is in use */
if (page_count(page0[index]->buffer) > 1) { if (cas_buffer_count(page0[index]) > 1) {
cas_page_t *new = cas_page_spare(cp, index); cas_page_t *new = cas_page_spare(cp, index);
if (new) { if (new) {
page1[index] = page0[index]; page1[index] = page0[index];
...@@ -2039,6 +2065,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, ...@@ -2039,6 +2065,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
skb->len += hlen - swivel; skb->len += hlen - swivel;
get_page(page->buffer); get_page(page->buffer);
cas_buffer_inc(page);
frag->page = page->buffer; frag->page = page->buffer;
frag->page_offset = off; frag->page_offset = off;
frag->size = hlen - swivel; frag->size = hlen - swivel;
...@@ -2063,6 +2090,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, ...@@ -2063,6 +2090,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
frag++; frag++;
get_page(page->buffer); get_page(page->buffer);
cas_buffer_inc(page);
frag->page = page->buffer; frag->page = page->buffer;
frag->page_offset = 0; frag->page_offset = 0;
frag->size = hlen; frag->size = hlen;
...@@ -2225,7 +2253,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) ...@@ -2225,7 +2253,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num)
released = 0; released = 0;
while (entry != last) { while (entry != last) {
/* make a new buffer if it's still in use */ /* make a new buffer if it's still in use */
if (page_count(page[entry]->buffer) > 1) { if (cas_buffer_count(page[entry]) > 1) {
cas_page_t *new = cas_page_dequeue(cp); cas_page_t *new = cas_page_dequeue(cp);
if (!new) { if (!new) {
/* let the timer know that we need to /* let the timer know that we need to
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
* over Ethernet * over Ethernet
*/ */
#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
#define ETH_P_TIPC 0x88CA /* TIPC */
/* /*
* Non DIX types. Won't clash for 1500 types. * Non DIX types. Won't clash for 1500 types.
......
...@@ -168,10 +168,13 @@ ...@@ -168,10 +168,13 @@
#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */ #define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
/* /*
* Link priority limits (range from 0 to # priorities - 1) * Link priority limits (min, default, max, media default)
*/ */
#define TIPC_NUM_LINK_PRI 32 #define TIPC_MIN_LINK_PRI 0
#define TIPC_DEF_LINK_PRI 10
#define TIPC_MAX_LINK_PRI 31
#define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1)
/* /*
* Link tolerance limits (min, default, max), in ms * Link tolerance limits (min, default, max), in ms
......
...@@ -150,6 +150,7 @@ endif ...@@ -150,6 +150,7 @@ endif
source "net/dccp/Kconfig" source "net/dccp/Kconfig"
source "net/sctp/Kconfig" source "net/sctp/Kconfig"
source "net/tipc/Kconfig"
source "net/atm/Kconfig" source "net/atm/Kconfig"
source "net/bridge/Kconfig" source "net/bridge/Kconfig"
source "net/8021q/Kconfig" source "net/8021q/Kconfig"
...@@ -159,7 +160,6 @@ source "net/ipx/Kconfig" ...@@ -159,7 +160,6 @@ source "net/ipx/Kconfig"
source "drivers/net/appletalk/Kconfig" source "drivers/net/appletalk/Kconfig"
source "net/x25/Kconfig" source "net/x25/Kconfig"
source "net/lapb/Kconfig" source "net/lapb/Kconfig"
source "net/tipc/Kconfig"
config NET_DIVERT config NET_DIVERT
bool "Frame Diverter (EXPERIMENTAL)" bool "Frame Diverter (EXPERIMENTAL)"
......
...@@ -1860,13 +1860,14 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, ...@@ -1860,13 +1860,14 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
*/ */
mod_cur_headers(pkt_dev); mod_cur_headers(pkt_dev);
skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16, GFP_ATOMIC); datalen = (odev->hard_header_len + 16) & ~0xf;
skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen, GFP_ATOMIC);
if (!skb) { if (!skb) {
sprintf(pkt_dev->result, "No memory"); sprintf(pkt_dev->result, "No memory");
return NULL; return NULL;
} }
skb_reserve(skb, 16); skb_reserve(skb, datalen);
/* Reserve for ethernet and IP header */ /* Reserve for ethernet and IP header */
eth = (__u8 *) skb_push(skb, 14); eth = (__u8 *) skb_push(skb, 14);
......
...@@ -233,7 +233,18 @@ static int is_in(struct ip_mc_list *pmc, struct ip_sf_list *psf, int type, ...@@ -233,7 +233,18 @@ static int is_in(struct ip_mc_list *pmc, struct ip_sf_list *psf, int type,
case IGMPV3_MODE_IS_EXCLUDE: case IGMPV3_MODE_IS_EXCLUDE:
if (gdeleted || sdeleted) if (gdeleted || sdeleted)
return 0; return 0;
return !(pmc->gsquery && !psf->sf_gsresp); if (!(pmc->gsquery && !psf->sf_gsresp)) {
if (pmc->sfmode == MCAST_INCLUDE)
return 1;
/* don't include if this source is excluded
* in all filters
*/
if (psf->sf_count[MCAST_INCLUDE])
return type == IGMPV3_MODE_IS_INCLUDE;
return pmc->sfcount[MCAST_EXCLUDE] ==
psf->sf_count[MCAST_EXCLUDE];
}
return 0;
case IGMPV3_CHANGE_TO_INCLUDE: case IGMPV3_CHANGE_TO_INCLUDE:
if (gdeleted || sdeleted) if (gdeleted || sdeleted)
return 0; return 0;
...@@ -385,7 +396,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, ...@@ -385,7 +396,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
struct igmpv3_report *pih; struct igmpv3_report *pih;
struct igmpv3_grec *pgr = NULL; struct igmpv3_grec *pgr = NULL;
struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list; struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list;
int scount, first, isquery, truncate; int scount, stotal, first, isquery, truncate;
if (pmc->multiaddr == IGMP_ALL_HOSTS) if (pmc->multiaddr == IGMP_ALL_HOSTS)
return skb; return skb;
...@@ -395,25 +406,13 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, ...@@ -395,25 +406,13 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
truncate = type == IGMPV3_MODE_IS_EXCLUDE || truncate = type == IGMPV3_MODE_IS_EXCLUDE ||
type == IGMPV3_CHANGE_TO_EXCLUDE; type == IGMPV3_CHANGE_TO_EXCLUDE;
stotal = scount = 0;
psf_list = sdeleted ? &pmc->tomb : &pmc->sources; psf_list = sdeleted ? &pmc->tomb : &pmc->sources;
if (!*psf_list) { if (!*psf_list)
if (type == IGMPV3_ALLOW_NEW_SOURCES || goto empty_source;
type == IGMPV3_BLOCK_OLD_SOURCES)
return skb;
if (pmc->crcount || isquery) {
/* make sure we have room for group header and at
* least one source.
*/
if (skb && AVAILABLE(skb) < sizeof(struct igmpv3_grec)+
sizeof(__u32)) {
igmpv3_sendpack(skb);
skb = NULL; /* add_grhead will get a new one */
}
skb = add_grhead(skb, pmc, type, &pgr);
}
return skb;
}
pih = skb ? (struct igmpv3_report *)skb->h.igmph : NULL; pih = skb ? (struct igmpv3_report *)skb->h.igmph : NULL;
/* EX and TO_EX get a fresh packet, if needed */ /* EX and TO_EX get a fresh packet, if needed */
...@@ -426,7 +425,6 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, ...@@ -426,7 +425,6 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
} }
} }
first = 1; first = 1;
scount = 0;
psf_prev = NULL; psf_prev = NULL;
for (psf=*psf_list; psf; psf=psf_next) { for (psf=*psf_list; psf; psf=psf_next) {
u32 *psrc; u32 *psrc;
...@@ -460,7 +458,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, ...@@ -460,7 +458,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
} }
psrc = (u32 *)skb_put(skb, sizeof(u32)); psrc = (u32 *)skb_put(skb, sizeof(u32));
*psrc = psf->sf_inaddr; *psrc = psf->sf_inaddr;
scount++; scount++; stotal++;
if ((type == IGMPV3_ALLOW_NEW_SOURCES || if ((type == IGMPV3_ALLOW_NEW_SOURCES ||
type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) { type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) {
psf->sf_crcount--; psf->sf_crcount--;
...@@ -475,6 +473,21 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, ...@@ -475,6 +473,21 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
} }
psf_prev = psf; psf_prev = psf;
} }
empty_source:
if (!stotal) {
if (type == IGMPV3_ALLOW_NEW_SOURCES ||
type == IGMPV3_BLOCK_OLD_SOURCES)
return skb;
if (pmc->crcount || isquery) {
/* make sure we have room for group header */
if (skb && AVAILABLE(skb)<sizeof(struct igmpv3_grec)) {
igmpv3_sendpack(skb);
skb = NULL; /* add_grhead will get a new one */
}
skb = add_grhead(skb, pmc, type, &pgr);
}
}
if (pgr) if (pgr)
pgr->grec_nsrcs = htons(scount); pgr->grec_nsrcs = htons(scount);
...@@ -557,11 +570,11 @@ static void igmpv3_send_cr(struct in_device *in_dev) ...@@ -557,11 +570,11 @@ static void igmpv3_send_cr(struct in_device *in_dev)
skb = add_grec(skb, pmc, dtype, 1, 1); skb = add_grec(skb, pmc, dtype, 1, 1);
} }
if (pmc->crcount) { if (pmc->crcount) {
pmc->crcount--;
if (pmc->sfmode == MCAST_EXCLUDE) { if (pmc->sfmode == MCAST_EXCLUDE) {
type = IGMPV3_CHANGE_TO_INCLUDE; type = IGMPV3_CHANGE_TO_INCLUDE;
skb = add_grec(skb, pmc, type, 1, 0); skb = add_grec(skb, pmc, type, 1, 0);
} }
pmc->crcount--;
if (pmc->crcount == 0) { if (pmc->crcount == 0) {
igmpv3_clear_zeros(&pmc->tomb); igmpv3_clear_zeros(&pmc->tomb);
igmpv3_clear_zeros(&pmc->sources); igmpv3_clear_zeros(&pmc->sources);
...@@ -594,12 +607,12 @@ static void igmpv3_send_cr(struct in_device *in_dev) ...@@ -594,12 +607,12 @@ static void igmpv3_send_cr(struct in_device *in_dev)
/* filter mode changes */ /* filter mode changes */
if (pmc->crcount) { if (pmc->crcount) {
pmc->crcount--;
if (pmc->sfmode == MCAST_EXCLUDE) if (pmc->sfmode == MCAST_EXCLUDE)
type = IGMPV3_CHANGE_TO_EXCLUDE; type = IGMPV3_CHANGE_TO_EXCLUDE;
else else
type = IGMPV3_CHANGE_TO_INCLUDE; type = IGMPV3_CHANGE_TO_INCLUDE;
skb = add_grec(skb, pmc, type, 0, 0); skb = add_grec(skb, pmc, type, 0, 0);
pmc->crcount--;
} }
spin_unlock_bh(&pmc->lock); spin_unlock_bh(&pmc->lock);
} }
...@@ -735,11 +748,43 @@ static void igmp_timer_expire(unsigned long data) ...@@ -735,11 +748,43 @@ static void igmp_timer_expire(unsigned long data)
ip_ma_put(im); ip_ma_put(im);
} }
static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) /* mark EXCLUDE-mode sources */
static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
{
struct ip_sf_list *psf;
int i, scount;
scount = 0;
for (psf=pmc->sources; psf; psf=psf->sf_next) {
if (scount == nsrcs)
break;
for (i=0; i<nsrcs; i++) {
/* skip inactive filters */
if (pmc->sfcount[MCAST_INCLUDE] ||
pmc->sfcount[MCAST_EXCLUDE] !=
psf->sf_count[MCAST_EXCLUDE])
continue;
if (srcs[i] == psf->sf_inaddr) {
scount++;
break;
}
}
}
pmc->gsquery = 0;
if (scount == nsrcs) /* all sources excluded */
return 0;
return 1;
}
static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
{ {
struct ip_sf_list *psf; struct ip_sf_list *psf;
int i, scount; int i, scount;
if (pmc->sfmode == MCAST_EXCLUDE)
return igmp_xmarksources(pmc, nsrcs, srcs);
/* mark INCLUDE-mode sources */
scount = 0; scount = 0;
for (psf=pmc->sources; psf; psf=psf->sf_next) { for (psf=pmc->sources; psf; psf=psf->sf_next) {
if (scount == nsrcs) if (scount == nsrcs)
...@@ -751,6 +796,12 @@ static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) ...@@ -751,6 +796,12 @@ static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
break; break;
} }
} }
if (!scount) {
pmc->gsquery = 0;
return 0;
}
pmc->gsquery = 1;
return 1;
} }
static void igmp_heard_report(struct in_device *in_dev, u32 group) static void igmp_heard_report(struct in_device *in_dev, u32 group)
...@@ -845,6 +896,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ...@@ -845,6 +896,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
*/ */
read_lock(&in_dev->mc_list_lock); read_lock(&in_dev->mc_list_lock);
for (im=in_dev->mc_list; im!=NULL; im=im->next) { for (im=in_dev->mc_list; im!=NULL; im=im->next) {
int changed;
if (group && group != im->multiaddr) if (group && group != im->multiaddr)
continue; continue;
if (im->multiaddr == IGMP_ALL_HOSTS) if (im->multiaddr == IGMP_ALL_HOSTS)
...@@ -854,10 +907,11 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ...@@ -854,10 +907,11 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
im->gsquery = im->gsquery && mark; im->gsquery = im->gsquery && mark;
else else
im->gsquery = mark; im->gsquery = mark;
if (im->gsquery) changed = !im->gsquery ||
igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs);
spin_unlock_bh(&im->lock); spin_unlock_bh(&im->lock);
igmp_mod_timer(im, max_delay); if (changed)
igmp_mod_timer(im, max_delay);
} }
read_unlock(&in_dev->mc_list_lock); read_unlock(&in_dev->mc_list_lock);
} }
...@@ -1510,7 +1564,7 @@ static void sf_markstate(struct ip_mc_list *pmc) ...@@ -1510,7 +1564,7 @@ static void sf_markstate(struct ip_mc_list *pmc)
static int sf_setstate(struct ip_mc_list *pmc) static int sf_setstate(struct ip_mc_list *pmc)
{ {
struct ip_sf_list *psf; struct ip_sf_list *psf, *dpsf;
int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; int mca_xcount = pmc->sfcount[MCAST_EXCLUDE];
int qrv = pmc->interface->mr_qrv; int qrv = pmc->interface->mr_qrv;
int new_in, rv; int new_in, rv;
...@@ -1522,8 +1576,46 @@ static int sf_setstate(struct ip_mc_list *pmc) ...@@ -1522,8 +1576,46 @@ static int sf_setstate(struct ip_mc_list *pmc)
!psf->sf_count[MCAST_INCLUDE]; !psf->sf_count[MCAST_INCLUDE];
} else } else
new_in = psf->sf_count[MCAST_INCLUDE] != 0; new_in = psf->sf_count[MCAST_INCLUDE] != 0;
if (new_in != psf->sf_oldin) { if (new_in) {
psf->sf_crcount = qrv; if (!psf->sf_oldin) {
struct ip_sf_list *prev = 0;
for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) {
if (dpsf->sf_inaddr == psf->sf_inaddr)
break;
prev = dpsf;
}
if (dpsf) {
if (prev)
prev->sf_next = dpsf->sf_next;
else
pmc->tomb = dpsf->sf_next;
kfree(dpsf);
}
psf->sf_crcount = qrv;
rv++;
}
} else if (psf->sf_oldin) {
psf->sf_crcount = 0;
/*
* add or update "delete" records if an active filter
* is now inactive
*/
for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next)
if (dpsf->sf_inaddr == psf->sf_inaddr)
break;
if (!dpsf) {
dpsf = (struct ip_sf_list *)
kmalloc(sizeof(*dpsf), GFP_ATOMIC);
if (!dpsf)
continue;
*dpsf = *psf;
/* pmc->lock held by callers */
dpsf->sf_next = pmc->tomb;
pmc->tomb = dpsf;
}
dpsf->sf_crcount = qrv;
rv++; rv++;
} }
} }
......
...@@ -241,7 +241,8 @@ static int rt_hash_log; ...@@ -241,7 +241,8 @@ static int rt_hash_log;
static unsigned int rt_hash_rnd; static unsigned int rt_hash_rnd;
static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
#define RT_CACHE_STAT_INC(field) (__get_cpu_var(rt_cache_stat).field++) #define RT_CACHE_STAT_INC(field) \
(per_cpu(rt_cache_stat, raw_smp_processor_id()).field++)
static int rt_intern_hash(unsigned hash, struct rtable *rth, static int rt_intern_hash(unsigned hash, struct rtable *rth,
struct rtable **res); struct rtable **res);
......
...@@ -8,7 +8,12 @@ menu "TIPC Configuration (EXPERIMENTAL)" ...@@ -8,7 +8,12 @@ menu "TIPC Configuration (EXPERIMENTAL)"
config TIPC config TIPC
tristate "The TIPC Protocol (EXPERIMENTAL)" tristate "The TIPC Protocol (EXPERIMENTAL)"
---help--- ---help---
TBD. The Transparent Inter Process Communication (TIPC) protocol is
specially designed for intra cluster communication. This protocol
originates from Ericsson where it has been used in carrier grade
cluster applications for many years.
For more information about TIPC, see http://tipc.sourceforge.net.
This protocol support is also available as a module ( = code which This protocol support is also available as a module ( = code which
can be inserted in and removed from the running kernel whenever you can be inserted in and removed from the running kernel whenever you
......
...@@ -47,7 +47,7 @@ u32 tipc_get_addr(void) ...@@ -47,7 +47,7 @@ u32 tipc_get_addr(void)
} }
/** /**
* addr_domain_valid - validates a network domain address * tipc_addr_domain_valid - validates a network domain address
* *
* Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
* where Z, C, and N are non-zero and do not exceed the configured limits. * where Z, C, and N are non-zero and do not exceed the configured limits.
...@@ -55,7 +55,7 @@ u32 tipc_get_addr(void) ...@@ -55,7 +55,7 @@ u32 tipc_get_addr(void)
* Returns 1 if domain address is valid, otherwise 0 * Returns 1 if domain address is valid, otherwise 0
*/ */
int addr_domain_valid(u32 addr) int tipc_addr_domain_valid(u32 addr)
{ {
u32 n = tipc_node(addr); u32 n = tipc_node(addr);
u32 c = tipc_cluster(addr); u32 c = tipc_cluster(addr);
...@@ -79,7 +79,7 @@ int addr_domain_valid(u32 addr) ...@@ -79,7 +79,7 @@ int addr_domain_valid(u32 addr)
} }
/** /**
* addr_node_valid - validates a proposed network address for this node * tipc_addr_node_valid - validates a proposed network address for this node
* *
* Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed
* the configured limits. * the configured limits.
...@@ -87,8 +87,8 @@ int addr_domain_valid(u32 addr) ...@@ -87,8 +87,8 @@ int addr_domain_valid(u32 addr)
* Returns 1 if address can be used, otherwise 0 * Returns 1 if address can be used, otherwise 0
*/ */
int addr_node_valid(u32 addr) int tipc_addr_node_valid(u32 addr)
{ {
return (addr_domain_valid(addr) && tipc_node(addr)); return (tipc_addr_domain_valid(addr) && tipc_node(addr));
} }
...@@ -122,7 +122,7 @@ static inline char *addr_string_fill(char *string, u32 addr) ...@@ -122,7 +122,7 @@ static inline char *addr_string_fill(char *string, u32 addr)
return string; return string;
} }
int addr_domain_valid(u32); int tipc_addr_domain_valid(u32);
int addr_node_valid(u32 addr); int tipc_addr_node_valid(u32 addr);
#endif #endif
This diff is collapsed.
...@@ -70,14 +70,14 @@ struct port_list { ...@@ -70,14 +70,14 @@ struct port_list {
struct node; struct node;
extern char bc_link_name[]; extern char tipc_bclink_name[];
/** /**
* nmap_get - determine if node exists in a node map * nmap_get - determine if node exists in a node map
*/ */
static inline int nmap_get(struct node_map *nm_ptr, u32 node) static inline int tipc_nmap_get(struct node_map *nm_ptr, u32 node)
{ {
int n = tipc_node(node); int n = tipc_node(node);
int w = n / WSIZE; int w = n / WSIZE;
...@@ -90,7 +90,7 @@ static inline int nmap_get(struct node_map *nm_ptr, u32 node) ...@@ -90,7 +90,7 @@ static inline int nmap_get(struct node_map *nm_ptr, u32 node)
* nmap_add - add a node to a node map * nmap_add - add a node to a node map
*/ */
static inline void nmap_add(struct node_map *nm_ptr, u32 node) static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node)
{ {
int n = tipc_node(node); int n = tipc_node(node);
int w = n / WSIZE; int w = n / WSIZE;
...@@ -106,7 +106,7 @@ static inline void nmap_add(struct node_map *nm_ptr, u32 node) ...@@ -106,7 +106,7 @@ static inline void nmap_add(struct node_map *nm_ptr, u32 node)
* nmap_remove - remove a node from a node map * nmap_remove - remove a node from a node map
*/ */
static inline void nmap_remove(struct node_map *nm_ptr, u32 node) static inline void tipc_nmap_remove(struct node_map *nm_ptr, u32 node)
{ {
int n = tipc_node(node); int n = tipc_node(node);
int w = n / WSIZE; int w = n / WSIZE;
...@@ -122,7 +122,7 @@ static inline void nmap_remove(struct node_map *nm_ptr, u32 node) ...@@ -122,7 +122,7 @@ static inline void nmap_remove(struct node_map *nm_ptr, u32 node)
* nmap_equal - test for equality of node maps * nmap_equal - test for equality of node maps
*/ */
static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) static inline int tipc_nmap_equal(struct node_map *nm_a, struct node_map *nm_b)
{ {
return !memcmp(nm_a, nm_b, sizeof(*nm_a)); return !memcmp(nm_a, nm_b, sizeof(*nm_a));
} }
...@@ -134,8 +134,8 @@ static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) ...@@ -134,8 +134,8 @@ static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b)
* @nm_diff: output node map A-B (i.e. nodes of A that are not in B) * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
*/ */
static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, static inline void tipc_nmap_diff(struct node_map *nm_a, struct node_map *nm_b,
struct node_map *nm_diff) struct node_map *nm_diff)
{ {
int stop = sizeof(nm_a->map) / sizeof(u32); int stop = sizeof(nm_a->map) / sizeof(u32);
int w; int w;
...@@ -159,7 +159,7 @@ static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, ...@@ -159,7 +159,7 @@ static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b,
* port_list_add - add a port to a port list, ensuring no duplicates * port_list_add - add a port to a port list, ensuring no duplicates
*/ */
static inline void port_list_add(struct port_list *pl_ptr, u32 port) static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
{ {
struct port_list *item = pl_ptr; struct port_list *item = pl_ptr;
int i; int i;
...@@ -194,7 +194,7 @@ static inline void port_list_add(struct port_list *pl_ptr, u32 port) ...@@ -194,7 +194,7 @@ static inline void port_list_add(struct port_list *pl_ptr, u32 port)
* Note: First item is on stack, so it doesn't need to be released * Note: First item is on stack, so it doesn't need to be released
*/ */
static inline void port_list_free(struct port_list *pl_ptr) static inline void tipc_port_list_free(struct port_list *pl_ptr)
{ {
struct port_list *item; struct port_list *item;
struct port_list *next; struct port_list *next;
...@@ -206,18 +206,18 @@ static inline void port_list_free(struct port_list *pl_ptr) ...@@ -206,18 +206,18 @@ static inline void port_list_free(struct port_list *pl_ptr)
} }
int bclink_init(void); int tipc_bclink_init(void);
void bclink_stop(void); void tipc_bclink_stop(void);
void bclink_acknowledge(struct node *n_ptr, u32 acked); void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked);
int bclink_send_msg(struct sk_buff *buf); int tipc_bclink_send_msg(struct sk_buff *buf);
void bclink_recv_pkt(struct sk_buff *buf); void tipc_bclink_recv_pkt(struct sk_buff *buf);
u32 bclink_get_last_sent(void); u32 tipc_bclink_get_last_sent(void);
u32 bclink_acks_missing(struct node *n_ptr); u32 tipc_bclink_acks_missing(struct node *n_ptr);
void bclink_check_gap(struct node *n_ptr, u32 seqno); void tipc_bclink_check_gap(struct node *n_ptr, u32 seqno);
int bclink_stats(char *stats_buf, const u32 buf_size); int tipc_bclink_stats(char *stats_buf, const u32 buf_size);
int bclink_reset_stats(void); int tipc_bclink_reset_stats(void);
int bclink_set_queue_limits(u32 limit); int tipc_bclink_set_queue_limits(u32 limit);
void bcbearer_sort(void); void tipc_bcbearer_sort(void);
void bcbearer_push(void); void tipc_bcbearer_push(void);
#endif #endif
This diff is collapsed.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef _TIPC_BEARER_H #ifndef _TIPC_BEARER_H
#define _TIPC_BEARER_H #define _TIPC_BEARER_H
#include <net/tipc/tipc_bearer.h> #include "core.h"
#include "bcast.h" #include "bcast.h"
#define MAX_BEARERS 8 #define MAX_BEARERS 8
...@@ -114,26 +114,24 @@ struct bearer_name { ...@@ -114,26 +114,24 @@ struct bearer_name {
struct link; struct link;
extern struct bearer *bearers; extern struct bearer *tipc_bearers;
void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
struct sk_buff *media_get_names(void); struct sk_buff *tipc_media_get_names(void);
struct sk_buff *bearer_get_names(void); struct sk_buff *tipc_bearer_get_names(void);
void bearer_add_dest(struct bearer *b_ptr, u32 dest); void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest);
void bearer_remove_dest(struct bearer *b_ptr, u32 dest); void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest);
void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr);
struct bearer *bearer_find_interface(const char *if_name); struct bearer *tipc_bearer_find_interface(const char *if_name);
int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr);
int bearer_init(void); int tipc_bearer_init(void);
void bearer_stop(void); void tipc_bearer_stop(void);
int bearer_broadcast(struct sk_buff *buf, struct tipc_bearer *b_ptr, void tipc_bearer_lock_push(struct bearer *b_ptr);
struct tipc_media_addr *dest);
void bearer_lock_push(struct bearer *b_ptr);
/** /**
* bearer_send- sends buffer to destination over bearer * tipc_bearer_send- sends buffer to destination over bearer
* *
* Returns true (1) if successful, or false (0) if unable to send * Returns true (1) if successful, or false (0) if unable to send
* *
...@@ -150,23 +148,23 @@ void bearer_lock_push(struct bearer *b_ptr); ...@@ -150,23 +148,23 @@ void bearer_lock_push(struct bearer *b_ptr);
* and let TIPC's link code deal with the undelivered message. * and let TIPC's link code deal with the undelivered message.
*/ */
static inline int bearer_send(struct bearer *b_ptr, struct sk_buff *buf, static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf,
struct tipc_media_addr *dest) struct tipc_media_addr *dest)
{ {
return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest);
} }
/** /**
* bearer_congested - determines if bearer is currently congested * tipc_bearer_congested - determines if bearer is currently congested
*/ */
static inline int bearer_congested(struct bearer *b_ptr, struct link *l_ptr) static inline int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr)
{ {
if (unlikely(b_ptr->publ.blocked)) if (unlikely(b_ptr->publ.blocked))
return 1; return 1;
if (likely(list_empty(&b_ptr->cong_links))) if (likely(list_empty(&b_ptr->cong_links)))
return 0; return 0;
return !bearer_resolve_congestion(b_ptr, l_ptr); return !tipc_bearer_resolve_congestion(b_ptr, l_ptr);
} }
#endif #endif
This diff is collapsed.
...@@ -60,29 +60,29 @@ struct cluster { ...@@ -60,29 +60,29 @@ struct cluster {
}; };
extern struct node **local_nodes; extern struct node **tipc_local_nodes;
extern u32 highest_allowed_slave; extern u32 tipc_highest_allowed_slave;
extern struct node_map cluster_bcast_nodes; extern struct node_map tipc_cltr_bcast_nodes;
void cluster_remove_as_router(struct cluster *c_ptr, u32 router); void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router);
void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest); void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest);
struct node *cluster_select_node(struct cluster *c_ptr, u32 selector); struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector);
u32 cluster_select_router(struct cluster *c_ptr, u32 ref); u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref);
void cluster_recv_routing_table(struct sk_buff *buf); void tipc_cltr_recv_routing_table(struct sk_buff *buf);
struct cluster *cluster_create(u32 addr); struct cluster *tipc_cltr_create(u32 addr);
void cluster_delete(struct cluster *c_ptr); void tipc_cltr_delete(struct cluster *c_ptr);
void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr); void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr);
void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest); void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
void cluster_broadcast(struct sk_buff *buf); void tipc_cltr_broadcast(struct sk_buff *buf);
int cluster_init(void); int tipc_cltr_init(void);
u32 cluster_next_node(struct cluster *c_ptr, u32 addr); u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
void cluster_send_local_routes(struct cluster *c_ptr, u32 dest); void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
static inline struct cluster *cluster_find(u32 addr) static inline struct cluster *tipc_cltr_find(u32 addr)
{ {
struct _zone *z_ptr = zone_find(addr); struct _zone *z_ptr = tipc_zone_find(addr);
if (z_ptr) if (z_ptr)
return z_ptr->clusters[1]; return z_ptr->clusters[1];
......
This diff is collapsed.
...@@ -39,42 +39,41 @@ ...@@ -39,42 +39,41 @@
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
#include <linux/tipc.h> #include "core.h"
#include <linux/tipc_config.h>
#include "link.h" #include "link.h"
struct sk_buff *cfg_reply_alloc(int payload_size); struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
int cfg_append_tlv(struct sk_buff *buf, int tlv_type, int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
void *tlv_data, int tlv_data_size); void *tlv_data, int tlv_data_size);
struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value); struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string); struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
static inline struct sk_buff *cfg_reply_none(void) static inline struct sk_buff *tipc_cfg_reply_none(void)
{ {
return cfg_reply_alloc(0); return tipc_cfg_reply_alloc(0);
} }
static inline struct sk_buff *cfg_reply_unsigned(u32 value) static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
{ {
return cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value); return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
} }
static inline struct sk_buff *cfg_reply_error_string(char *string) static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
{ {
return cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string); return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
} }
static inline struct sk_buff *cfg_reply_ultra_string(char *string) static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string)
{ {
return cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string);
} }
struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd,
const void *req_tlv_area, int req_tlv_space, const void *req_tlv_area, int req_tlv_space,
int headroom); int headroom);
void cfg_link_event(u32 addr, char *name, int up); void tipc_cfg_link_event(u32 addr, char *name, int up);
int cfg_init(void); int tipc_cfg_init(void);
void cfg_stop(void); void tipc_cfg_stop(void);
#endif #endif
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/version.h>
#include <linux/random.h> #include <linux/random.h>
#include "core.h" #include "core.h"
...@@ -49,14 +48,14 @@ ...@@ -49,14 +48,14 @@
#include "subscr.h" #include "subscr.h"
#include "config.h" #include "config.h"
int eth_media_start(void); int tipc_eth_media_start(void);
void eth_media_stop(void); void tipc_eth_media_stop(void);
int handler_start(void); int tipc_handler_start(void);
void handler_stop(void); void tipc_handler_stop(void);
int socket_init(void); int tipc_socket_init(void);
void socket_stop(void); void tipc_socket_stop(void);
int netlink_start(void); int tipc_netlink_start(void);
void netlink_stop(void); void tipc_netlink_stop(void);
#define MOD_NAME "tipc_start: " #define MOD_NAME "tipc_start: "
...@@ -113,56 +112,56 @@ int tipc_get_mode(void) ...@@ -113,56 +112,56 @@ int tipc_get_mode(void)
} }
/** /**
* stop_net - shut down TIPC networking sub-systems * tipc_core_stop_net - shut down TIPC networking sub-systems
*/ */
void stop_net(void) void tipc_core_stop_net(void)
{ {
eth_media_stop(); tipc_eth_media_stop();
tipc_stop_net(); tipc_net_stop();
} }
/** /**
* start_net - start TIPC networking sub-systems * start_net - start TIPC networking sub-systems
*/ */
int start_net(void) int tipc_core_start_net(void)
{ {
int res; int res;
if ((res = tipc_start_net()) || if ((res = tipc_net_start()) ||
(res = eth_media_start())) { (res = tipc_eth_media_start())) {
stop_net(); tipc_core_stop_net();
} }
return res; return res;
} }
/** /**
* stop_core - switch TIPC from SINGLE NODE to NOT RUNNING mode * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
*/ */
void stop_core(void) void tipc_core_stop(void)
{ {
if (tipc_mode != TIPC_NODE_MODE) if (tipc_mode != TIPC_NODE_MODE)
return; return;
tipc_mode = TIPC_NOT_RUNNING; tipc_mode = TIPC_NOT_RUNNING;
netlink_stop(); tipc_netlink_stop();
handler_stop(); tipc_handler_stop();
cfg_stop(); tipc_cfg_stop();
subscr_stop(); tipc_subscr_stop();
reg_stop(); tipc_reg_stop();
nametbl_stop(); tipc_nametbl_stop();
ref_table_stop(); tipc_ref_table_stop();
socket_stop(); tipc_socket_stop();
} }
/** /**
* start_core - switch TIPC from NOT RUNNING to SINGLE NODE mode * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
*/ */
int start_core(void) int tipc_core_start(void)
{ {
int res; int res;
...@@ -172,16 +171,16 @@ int start_core(void) ...@@ -172,16 +171,16 @@ int start_core(void)
get_random_bytes(&tipc_random, sizeof(tipc_random)); get_random_bytes(&tipc_random, sizeof(tipc_random));
tipc_mode = TIPC_NODE_MODE; tipc_mode = TIPC_NODE_MODE;
if ((res = handler_start()) || if ((res = tipc_handler_start()) ||
(res = ref_table_init(tipc_max_ports + tipc_max_subscriptions, (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions,
tipc_random)) || tipc_random)) ||
(res = reg_start()) || (res = tipc_reg_start()) ||
(res = nametbl_init()) || (res = tipc_nametbl_init()) ||
(res = k_signal((Handler)subscr_start, 0)) || (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
(res = k_signal((Handler)cfg_init, 0)) || (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) ||
(res = netlink_start()) || (res = tipc_netlink_start()) ||
(res = socket_init())) { (res = tipc_socket_init())) {
stop_core(); tipc_core_stop();
} }
return res; return res;
} }
...@@ -191,7 +190,7 @@ static int __init tipc_init(void) ...@@ -191,7 +190,7 @@ static int __init tipc_init(void)
{ {
int res; int res;
log_reinit(CONFIG_TIPC_LOG); tipc_log_reinit(CONFIG_TIPC_LOG);
info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); info("Activated (compiled " __DATE__ " " __TIME__ ")\n");
tipc_own_addr = 0; tipc_own_addr = 0;
...@@ -205,7 +204,7 @@ static int __init tipc_init(void) ...@@ -205,7 +204,7 @@ static int __init tipc_init(void)
tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047); tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047);
tipc_net_id = 4711; tipc_net_id = 4711;
if ((res = start_core())) if ((res = tipc_core_start()))
err("Unable to start in single node mode\n"); err("Unable to start in single node mode\n");
else else
info("Started in single node mode\n"); info("Started in single node mode\n");
...@@ -214,10 +213,10 @@ static int __init tipc_init(void) ...@@ -214,10 +213,10 @@ static int __init tipc_init(void)
static void __exit tipc_exit(void) static void __exit tipc_exit(void)
{ {
stop_net(); tipc_core_stop_net();
stop_core(); tipc_core_stop();
info("Deactivated\n"); info("Deactivated\n");
log_stop(); tipc_log_stop();
} }
module_init(tipc_init); module_init(tipc_init);
......
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
#ifndef _TIPC_CORE_H #ifndef _TIPC_CORE_H
#define _TIPC_CORE_H #define _TIPC_CORE_H
#include <linux/tipc.h>
#include <linux/tipc_config.h>
#include <net/tipc/tipc_msg.h>
#include <net/tipc/tipc_port.h>
#include <net/tipc/tipc_bearer.h>
#include <net/tipc/tipc.h> #include <net/tipc/tipc.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -60,9 +65,9 @@ ...@@ -60,9 +65,9 @@
#define assert(i) BUG_ON(!(i)) #define assert(i) BUG_ON(!(i))
struct tipc_msg; struct tipc_msg;
extern struct print_buf *CONS, *LOG; extern struct print_buf *TIPC_CONS, *TIPC_LOG;
extern struct print_buf *TEE(struct print_buf *, struct print_buf *); extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *);
void msg_print(struct print_buf*,struct tipc_msg *,const char*); void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*);
void tipc_printf(struct print_buf *, const char *fmt, ...); void tipc_printf(struct print_buf *, const char *fmt, ...);
void tipc_dump(struct print_buf*,const char *fmt, ...); void tipc_dump(struct print_buf*,const char *fmt, ...);
...@@ -79,7 +84,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); ...@@ -79,7 +84,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) #define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg)
#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) #define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0)
#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) msg_print(DBG_OUTPUT, msg, txt);} while(0) #define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0)
#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) #define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
...@@ -89,15 +94,15 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); ...@@ -89,15 +94,15 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
* here, or on a per .c file basis, by redefining these symbols. The following * here, or on a per .c file basis, by redefining these symbols. The following
* print buffer options are available: * print buffer options are available:
* *
* NULL : Output to null print buffer (i.e. print nowhere) * NULL : Output to null print buffer (i.e. print nowhere)
* CONS : Output to system console * TIPC_CONS : Output to system console
* LOG : Output to TIPC log buffer * TIPC_LOG : Output to TIPC log buffer
* &buf : Output to user-defined buffer (struct print_buf *) * &buf : Output to user-defined buffer (struct print_buf *)
* TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TEE(CONS,LOG) ) * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) )
*/ */
#ifndef TIPC_OUTPUT #ifndef TIPC_OUTPUT
#define TIPC_OUTPUT TEE(CONS,LOG) #define TIPC_OUTPUT TIPC_TEE(TIPC_CONS,TIPC_LOG)
#endif #endif
#ifndef DBG_OUTPUT #ifndef DBG_OUTPUT
...@@ -162,10 +167,10 @@ extern atomic_t tipc_user_count; ...@@ -162,10 +167,10 @@ extern atomic_t tipc_user_count;
* Routines available to privileged subsystems * Routines available to privileged subsystems
*/ */
extern int start_core(void); extern int tipc_core_start(void);
extern void stop_core(void); extern void tipc_core_stop(void);
extern int start_net(void); extern int tipc_core_start_net(void);
extern void stop_net(void); extern void tipc_core_stop_net(void);
static inline int delimit(int val, int min, int max) static inline int delimit(int val, int min, int max)
{ {
...@@ -183,7 +188,7 @@ static inline int delimit(int val, int min, int max) ...@@ -183,7 +188,7 @@ static inline int delimit(int val, int min, int max)
typedef void (*Handler) (unsigned long); typedef void (*Handler) (unsigned long);
u32 k_signal(Handler routine, unsigned long argument); u32 tipc_k_signal(Handler routine, unsigned long argument);
/** /**
* k_init_timer - initialize a timer * k_init_timer - initialize a timer
......
...@@ -44,10 +44,10 @@ static char print_string[MAX_STRING]; ...@@ -44,10 +44,10 @@ static char print_string[MAX_STRING];
static spinlock_t print_lock = SPIN_LOCK_UNLOCKED; static spinlock_t print_lock = SPIN_LOCK_UNLOCKED;
static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; static struct print_buf cons_buf = { NULL, 0, NULL, NULL };
struct print_buf *CONS = &cons_buf; struct print_buf *TIPC_CONS = &cons_buf;
static struct print_buf log_buf = { NULL, 0, NULL, NULL }; static struct print_buf log_buf = { NULL, 0, NULL, NULL };
struct print_buf *LOG = &log_buf; struct print_buf *TIPC_LOG = &log_buf;
#define FORMAT(PTR,LEN,FMT) \ #define FORMAT(PTR,LEN,FMT) \
...@@ -66,15 +66,15 @@ struct print_buf *LOG = &log_buf; ...@@ -66,15 +66,15 @@ struct print_buf *LOG = &log_buf;
* simultaneous use of the print buffer(s) being manipulated. * simultaneous use of the print buffer(s) being manipulated.
* 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of
* 'print_string' and to protect its print buffer(s). * 'print_string' and to protect its print buffer(s).
* 3) TEE() uses 'print_lock' to protect its print buffer(s). * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s).
* 4) Routines of the form log_XXX() uses 'print_lock' to protect LOG. * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG.
*/ */
/** /**
* printbuf_init - initialize print buffer to empty * tipc_printbuf_init - initialize print buffer to empty
*/ */
void printbuf_init(struct print_buf *pb, char *raw, u32 sz) void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz)
{ {
if (!pb || !raw || (sz < (MAX_STRING + 1))) if (!pb || !raw || (sz < (MAX_STRING + 1)))
return; return;
...@@ -87,26 +87,26 @@ void printbuf_init(struct print_buf *pb, char *raw, u32 sz) ...@@ -87,26 +87,26 @@ void printbuf_init(struct print_buf *pb, char *raw, u32 sz)
} }
/** /**
* printbuf_reset - reinitialize print buffer to empty state * tipc_printbuf_reset - reinitialize print buffer to empty state
*/ */
void printbuf_reset(struct print_buf *pb) void tipc_printbuf_reset(struct print_buf *pb)
{ {
if (pb && pb->buf) if (pb && pb->buf)
printbuf_init(pb, pb->buf, pb->size); tipc_printbuf_init(pb, pb->buf, pb->size);
} }
/** /**
* printbuf_empty - test if print buffer is in empty state * tipc_printbuf_empty - test if print buffer is in empty state
*/ */
int printbuf_empty(struct print_buf *pb) int tipc_printbuf_empty(struct print_buf *pb)
{ {
return (!pb || !pb->buf || (pb->crs == pb->buf)); return (!pb || !pb->buf || (pb->crs == pb->buf));
} }
/** /**
* printbuf_validate - check for print buffer overflow * tipc_printbuf_validate - check for print buffer overflow
* *
* Verifies that a print buffer has captured all data written to it. * Verifies that a print buffer has captured all data written to it.
* If data has been lost, linearize buffer and prepend an error message * If data has been lost, linearize buffer and prepend an error message
...@@ -114,7 +114,7 @@ int printbuf_empty(struct print_buf *pb) ...@@ -114,7 +114,7 @@ int printbuf_empty(struct print_buf *pb)
* Returns length of print buffer data string (including trailing NULL) * Returns length of print buffer data string (including trailing NULL)
*/ */
int printbuf_validate(struct print_buf *pb) int tipc_printbuf_validate(struct print_buf *pb)
{ {
char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n"; char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n";
char *cp_buf; char *cp_buf;
...@@ -126,13 +126,13 @@ int printbuf_validate(struct print_buf *pb) ...@@ -126,13 +126,13 @@ int printbuf_validate(struct print_buf *pb)
if (pb->buf[pb->size - 1] == '\0') { if (pb->buf[pb->size - 1] == '\0') {
cp_buf = kmalloc(pb->size, GFP_ATOMIC); cp_buf = kmalloc(pb->size, GFP_ATOMIC);
if (cp_buf != NULL){ if (cp_buf != NULL){
printbuf_init(&cb, cp_buf, pb->size); tipc_printbuf_init(&cb, cp_buf, pb->size);
printbuf_move(&cb, pb); tipc_printbuf_move(&cb, pb);
printbuf_move(pb, &cb); tipc_printbuf_move(pb, &cb);
kfree(cp_buf); kfree(cp_buf);
memcpy(pb->buf, err, strlen(err)); memcpy(pb->buf, err, strlen(err));
} else { } else {
printbuf_reset(pb); tipc_printbuf_reset(pb);
tipc_printf(pb, err); tipc_printf(pb, err);
} }
} }
...@@ -140,13 +140,13 @@ int printbuf_validate(struct print_buf *pb) ...@@ -140,13 +140,13 @@ int printbuf_validate(struct print_buf *pb)
} }
/** /**
* printbuf_move - move print buffer contents to another print buffer * tipc_printbuf_move - move print buffer contents to another print buffer
* *
* Current contents of destination print buffer (if any) are discarded. * Current contents of destination print buffer (if any) are discarded.
* Source print buffer becomes empty if a successful move occurs. * Source print buffer becomes empty if a successful move occurs.
*/ */
void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
{ {
int len; int len;
...@@ -156,12 +156,12 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) ...@@ -156,12 +156,12 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
return; return;
if (!pb_from || !pb_from->buf) { if (!pb_from || !pb_from->buf) {
printbuf_reset(pb_to); tipc_printbuf_reset(pb_to);
return; return;
} }
if (pb_to->size < pb_from->size) { if (pb_to->size < pb_from->size) {
printbuf_reset(pb_to); tipc_printbuf_reset(pb_to);
tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***"); tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***");
return; return;
} }
...@@ -179,7 +179,7 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) ...@@ -179,7 +179,7 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
strcpy(pb_to->crs, pb_from->buf); strcpy(pb_to->crs, pb_from->buf);
pb_to->crs += len; pb_to->crs += len;
printbuf_reset(pb_from); tipc_printbuf_reset(pb_from);
} }
/** /**
...@@ -199,7 +199,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) ...@@ -199,7 +199,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
strcpy(print_string, "*** STRING TOO LONG ***"); strcpy(print_string, "*** STRING TOO LONG ***");
while (pb) { while (pb) {
if (pb == CONS) if (pb == TIPC_CONS)
printk(print_string); printk(print_string);
else if (pb->buf) { else if (pb->buf) {
chars_left = pb->buf + pb->size - pb->crs - 1; chars_left = pb->buf + pb->size - pb->crs - 1;
...@@ -223,10 +223,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) ...@@ -223,10 +223,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
} }
/** /**
* TEE - perform next output operation on both print buffers * TIPC_TEE - perform next output operation on both print buffers
*/ */
struct print_buf *TEE(struct print_buf *b0, struct print_buf *b1) struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
{ {
struct print_buf *pb = b0; struct print_buf *pb = b0;
...@@ -294,96 +294,96 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) ...@@ -294,96 +294,96 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...)
int len; int len;
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
FORMAT(CONS->buf, len, fmt); FORMAT(TIPC_CONS->buf, len, fmt);
printk(CONS->buf); printk(TIPC_CONS->buf);
for (; pb; pb = pb->next) { for (; pb; pb = pb->next) {
if (pb == CONS) if (pb == TIPC_CONS)
continue; continue;
printk("\n---- Start of dump,%s log ----\n\n", printk("\n---- Start of dump,%s log ----\n\n",
(pb == LOG) ? "global" : "local"); (pb == TIPC_LOG) ? "global" : "local");
printbuf_dump(pb); printbuf_dump(pb);
printbuf_reset(pb); tipc_printbuf_reset(pb);
printk("\n-------- End of dump --------\n"); printk("\n-------- End of dump --------\n");
} }
spin_unlock_bh(&print_lock); spin_unlock_bh(&print_lock);
} }
/** /**
* log_stop - free up TIPC log print buffer * tipc_log_stop - free up TIPC log print buffer
*/ */
void log_stop(void) void tipc_log_stop(void)
{ {
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
if (LOG->buf) { if (TIPC_LOG->buf) {
kfree(LOG->buf); kfree(TIPC_LOG->buf);
LOG->buf = NULL; TIPC_LOG->buf = NULL;
} }
spin_unlock_bh(&print_lock); spin_unlock_bh(&print_lock);
} }
/** /**
* log_reinit - set TIPC log print buffer to specified size * tipc_log_reinit - set TIPC log print buffer to specified size
*/ */
void log_reinit(int log_size) void tipc_log_reinit(int log_size)
{ {
log_stop(); tipc_log_stop();
if (log_size) { if (log_size) {
if (log_size <= MAX_STRING) if (log_size <= MAX_STRING)
log_size = MAX_STRING + 1; log_size = MAX_STRING + 1;
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
printbuf_init(LOG, kmalloc(log_size, GFP_ATOMIC), log_size); tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), log_size);
spin_unlock_bh(&print_lock); spin_unlock_bh(&print_lock);
} }
} }
/** /**
* log_resize - reconfigure size of TIPC log buffer * tipc_log_resize - reconfigure size of TIPC log buffer
*/ */
struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
{ {
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 0, 32768)) if (value != delimit(value, 0, 32768))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (log size must be 0-32768)"); " (log size must be 0-32768)");
log_reinit(value); tipc_log_reinit(value);
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
/** /**
* log_dump - capture TIPC log buffer contents in configuration message * tipc_log_dump - capture TIPC log buffer contents in configuration message
*/ */
struct sk_buff *log_dump(void) struct sk_buff *tipc_log_dump(void)
{ {
struct sk_buff *reply; struct sk_buff *reply;
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
if (!LOG->buf) if (!TIPC_LOG->buf)
reply = cfg_reply_ultra_string("log not activated\n"); reply = tipc_cfg_reply_ultra_string("log not activated\n");
else if (printbuf_empty(LOG)) else if (tipc_printbuf_empty(TIPC_LOG))
reply = cfg_reply_ultra_string("log is empty\n"); reply = tipc_cfg_reply_ultra_string("log is empty\n");
else { else {
struct tlv_desc *rep_tlv; struct tlv_desc *rep_tlv;
struct print_buf pb; struct print_buf pb;
int str_len; int str_len;
str_len = min(LOG->size, 32768u); str_len = min(TIPC_LOG->size, 32768u);
reply = cfg_reply_alloc(TLV_SPACE(str_len)); reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len));
if (reply) { if (reply) {
rep_tlv = (struct tlv_desc *)reply->data; rep_tlv = (struct tlv_desc *)reply->data;
printbuf_init(&pb, TLV_DATA(rep_tlv), str_len); tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len);
printbuf_move(&pb, LOG); tipc_printbuf_move(&pb, TIPC_LOG);
str_len = strlen(TLV_DATA(rep_tlv)) + 1; str_len = strlen(TLV_DATA(rep_tlv)) + 1;
skb_put(reply, TLV_SPACE(str_len)); skb_put(reply, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
......
...@@ -44,16 +44,16 @@ struct print_buf { ...@@ -44,16 +44,16 @@ struct print_buf {
struct print_buf *next; struct print_buf *next;
}; };
void printbuf_init(struct print_buf *pb, char *buf, u32 sz); void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 sz);
void printbuf_reset(struct print_buf *pb); void tipc_printbuf_reset(struct print_buf *pb);
int printbuf_empty(struct print_buf *pb); int tipc_printbuf_empty(struct print_buf *pb);
int printbuf_validate(struct print_buf *pb); int tipc_printbuf_validate(struct print_buf *pb);
void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from); void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
void log_reinit(int log_size); void tipc_log_reinit(int log_size);
void log_stop(void); void tipc_log_stop(void);
struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space);
struct sk_buff *log_dump(void); struct sk_buff *tipc_log_dump(void);
#endif #endif
...@@ -93,7 +93,7 @@ int disc_create_link(const struct tipc_link_create *argv) ...@@ -93,7 +93,7 @@ int disc_create_link(const struct tipc_link_create *argv)
* disc_lost_link(): A link has lost contact * disc_lost_link(): A link has lost contact
*/ */
void disc_link_event(u32 addr, char *name, int up) void tipc_disc_link_event(u32 addr, char *name, int up)
{ {
if (in_own_cluster(addr)) if (in_own_cluster(addr))
return; return;
...@@ -103,17 +103,17 @@ void disc_link_event(u32 addr, char *name, int up) ...@@ -103,17 +103,17 @@ void disc_link_event(u32 addr, char *name, int up)
} }
/** /**
* disc_init_msg - initialize a link setup message * tipc_disc_init_msg - initialize a link setup message
* @type: message type (request or response) * @type: message type (request or response)
* @req_links: number of links associated with message * @req_links: number of links associated with message
* @dest_domain: network domain of node(s) which should respond to message * @dest_domain: network domain of node(s) which should respond to message
* @b_ptr: ptr to bearer issuing message * @b_ptr: ptr to bearer issuing message
*/ */
struct sk_buff *disc_init_msg(u32 type, struct sk_buff *tipc_disc_init_msg(u32 type,
u32 req_links, u32 req_links,
u32 dest_domain, u32 dest_domain,
struct bearer *b_ptr) struct bearer *b_ptr)
{ {
struct sk_buff *buf = buf_acquire(DSC_H_SIZE); struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -132,11 +132,11 @@ struct sk_buff *disc_init_msg(u32 type, ...@@ -132,11 +132,11 @@ struct sk_buff *disc_init_msg(u32 type,
} }
/** /**
* disc_recv_msg - handle incoming link setup message (request or response) * tipc_disc_recv_msg - handle incoming link setup message (request or response)
* @buf: buffer containing message * @buf: buffer containing message
*/ */
void disc_recv_msg(struct sk_buff *buf) void tipc_disc_recv_msg(struct sk_buff *buf)
{ {
struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle; struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle;
struct link *link; struct link *link;
...@@ -153,9 +153,9 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -153,9 +153,9 @@ void disc_recv_msg(struct sk_buff *buf)
if (net_id != tipc_net_id) if (net_id != tipc_net_id)
return; return;
if (!addr_domain_valid(dest)) if (!tipc_addr_domain_valid(dest))
return; return;
if (!addr_node_valid(orig)) if (!tipc_addr_node_valid(orig))
return; return;
if (orig == tipc_own_addr) if (orig == tipc_own_addr)
return; return;
...@@ -169,11 +169,11 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -169,11 +169,11 @@ void disc_recv_msg(struct sk_buff *buf)
/* Always accept link here */ /* Always accept link here */
struct sk_buff *rbuf; struct sk_buff *rbuf;
struct tipc_media_addr *addr; struct tipc_media_addr *addr;
struct node *n_ptr = node_find(orig); struct node *n_ptr = tipc_node_find(orig);
int link_up; int link_up;
dbg(" in own cluster\n"); dbg(" in own cluster\n");
if (n_ptr == NULL) { if (n_ptr == NULL) {
n_ptr = node_create(orig); n_ptr = tipc_node_create(orig);
} }
if (n_ptr == NULL) { if (n_ptr == NULL) {
warn("Memory squeeze; Failed to create node\n"); warn("Memory squeeze; Failed to create node\n");
...@@ -183,7 +183,7 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -183,7 +183,7 @@ void disc_recv_msg(struct sk_buff *buf)
link = n_ptr->links[b_ptr->identity]; link = n_ptr->links[b_ptr->identity];
if (!link) { if (!link) {
dbg("creating link\n"); dbg("creating link\n");
link = link_create(b_ptr, orig, &media_addr); link = tipc_link_create(b_ptr, orig, &media_addr);
if (!link) { if (!link) {
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
return; return;
...@@ -196,13 +196,13 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -196,13 +196,13 @@ void disc_recv_msg(struct sk_buff *buf)
warn("New bearer address for %s\n", warn("New bearer address for %s\n",
addr_string_fill(addr_string, orig)); addr_string_fill(addr_string, orig));
memcpy(addr, &media_addr, sizeof(*addr)); memcpy(addr, &media_addr, sizeof(*addr));
link_reset(link); tipc_link_reset(link);
} }
link_up = link_is_up(link); link_up = tipc_link_is_up(link);
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
if ((type == DSC_RESP_MSG) || link_up) if ((type == DSC_RESP_MSG) || link_up)
return; return;
rbuf = disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr);
if (rbuf != NULL) { if (rbuf != NULL) {
msg_dbg(buf_msg(rbuf),"SEND:"); msg_dbg(buf_msg(rbuf),"SEND:");
b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr); b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr);
...@@ -212,11 +212,11 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -212,11 +212,11 @@ void disc_recv_msg(struct sk_buff *buf)
} }
/** /**
* disc_stop_link_req - stop sending periodic link setup requests * tipc_disc_stop_link_req - stop sending periodic link setup requests
* @req: ptr to link request structure * @req: ptr to link request structure
*/ */
void disc_stop_link_req(struct link_req *req) void tipc_disc_stop_link_req(struct link_req *req)
{ {
if (!req) if (!req)
return; return;
...@@ -228,11 +228,11 @@ void disc_stop_link_req(struct link_req *req) ...@@ -228,11 +228,11 @@ void disc_stop_link_req(struct link_req *req)
} }
/** /**
* disc_update_link_req - update frequency of periodic link setup requests * tipc_disc_update_link_req - update frequency of periodic link setup requests
* @req: ptr to link request structure * @req: ptr to link request structure
*/ */
void disc_update_link_req(struct link_req *req) void tipc_disc_update_link_req(struct link_req *req)
{ {
if (!req) if (!req)
return; return;
...@@ -282,7 +282,7 @@ static void disc_timeout(struct link_req *req) ...@@ -282,7 +282,7 @@ static void disc_timeout(struct link_req *req)
} }
/** /**
* disc_init_link_req - start sending periodic link setup requests * tipc_disc_init_link_req - start sending periodic link setup requests
* @b_ptr: ptr to bearer issuing requests * @b_ptr: ptr to bearer issuing requests
* @dest: destination address for request messages * @dest: destination address for request messages
* @dest_domain: network domain of node(s) which should respond to message * @dest_domain: network domain of node(s) which should respond to message
...@@ -291,10 +291,10 @@ static void disc_timeout(struct link_req *req) ...@@ -291,10 +291,10 @@ static void disc_timeout(struct link_req *req)
* Returns pointer to link request structure, or NULL if unable to create. * Returns pointer to link request structure, or NULL if unable to create.
*/ */
struct link_req *disc_init_link_req(struct bearer *b_ptr, struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
const struct tipc_media_addr *dest, const struct tipc_media_addr *dest,
u32 dest_domain, u32 dest_domain,
u32 req_links) u32 req_links)
{ {
struct link_req *req; struct link_req *req;
...@@ -302,7 +302,7 @@ struct link_req *disc_init_link_req(struct bearer *b_ptr, ...@@ -302,7 +302,7 @@ struct link_req *disc_init_link_req(struct bearer *b_ptr,
if (!req) if (!req)
return NULL; return NULL;
req->buf = disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr); req->buf = tipc_disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr);
if (!req->buf) { if (!req->buf) {
kfree(req); kfree(req);
return NULL; return NULL;
......
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
#ifndef _TIPC_DISCOVER_H #ifndef _TIPC_DISCOVER_H
#define _TIPC_DISCOVER_H #define _TIPC_DISCOVER_H
#include <linux/tipc.h> #include "core.h"
struct link_req; struct link_req;
struct link_req *disc_init_link_req(struct bearer *b_ptr, struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
const struct tipc_media_addr *dest, const struct tipc_media_addr *dest,
u32 dest_domain, u32 dest_domain,
u32 req_links); u32 req_links);
void disc_update_link_req(struct link_req *req); void tipc_disc_update_link_req(struct link_req *req);
void disc_stop_link_req(struct link_req *req); void tipc_disc_stop_link_req(struct link_req *req);
void disc_recv_msg(struct sk_buff *buf); void tipc_disc_recv_msg(struct sk_buff *buf);
void disc_link_event(u32 addr, char *name, int up); void tipc_disc_link_event(u32 addr, char *name, int up);
#if 0 #if 0
int disc_create_link(const struct tipc_link_create *argv); int disc_create_link(const struct tipc_link_create *argv);
#endif #endif
......
...@@ -38,13 +38,11 @@ ...@@ -38,13 +38,11 @@
#include <net/tipc/tipc_bearer.h> #include <net/tipc/tipc_bearer.h>
#include <net/tipc/tipc_msg.h> #include <net/tipc/tipc_msg.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/version.h>
#define MAX_ETH_BEARERS 2 #define MAX_ETH_BEARERS 2
#define TIPC_PROTOCOL 0x88ca #define ETH_LINK_PRIORITY TIPC_DEF_LINK_PRI
#define ETH_LINK_PRIORITY 10
#define ETH_LINK_TOLERANCE TIPC_DEF_LINK_TOL #define ETH_LINK_TOLERANCE TIPC_DEF_LINK_TOL
#define ETH_LINK_WINDOW TIPC_DEF_LINK_WIN
/** /**
* struct eth_bearer - Ethernet bearer data structure * struct eth_bearer - Ethernet bearer data structure
...@@ -78,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, ...@@ -78,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
clone->nh.raw = clone->data; clone->nh.raw = clone->data;
dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
clone->dev = dev; clone->dev = dev;
dev->hard_header(clone, dev, TIPC_PROTOCOL, dev->hard_header(clone, dev, ETH_P_TIPC,
&dest->dev_addr.eth_addr, &dest->dev_addr.eth_addr,
dev->dev_addr, clone->len); dev->dev_addr, clone->len);
dev_queue_xmit(clone); dev_queue_xmit(clone);
...@@ -141,7 +139,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) ...@@ -141,7 +139,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
return -EDQUOT; return -EDQUOT;
if (!eb_ptr->dev) { if (!eb_ptr->dev) {
eb_ptr->dev = dev; eb_ptr->dev = dev;
eb_ptr->tipc_packet_type.type = __constant_htons(TIPC_PROTOCOL); eb_ptr->tipc_packet_type.type = __constant_htons(ETH_P_TIPC);
eb_ptr->tipc_packet_type.dev = dev; eb_ptr->tipc_packet_type.dev = dev;
eb_ptr->tipc_packet_type.func = recv_msg; eb_ptr->tipc_packet_type.func = recv_msg;
eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr; eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr;
...@@ -240,13 +238,13 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size ...@@ -240,13 +238,13 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size
} }
/** /**
* eth_media_start - activate Ethernet bearer support * tipc_eth_media_start - activate Ethernet bearer support
* *
* Register Ethernet media type with TIPC bearer code. Also register * Register Ethernet media type with TIPC bearer code. Also register
* with OS for notifications about device state changes. * with OS for notifications about device state changes.
*/ */
int eth_media_start(void) int tipc_eth_media_start(void)
{ {
struct tipc_media_addr bcast_addr; struct tipc_media_addr bcast_addr;
int res; int res;
...@@ -260,7 +258,7 @@ int eth_media_start(void) ...@@ -260,7 +258,7 @@ int eth_media_start(void)
res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth",
enable_bearer, disable_bearer, send_msg, enable_bearer, disable_bearer, send_msg,
eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY,
ETH_LINK_TOLERANCE, TIPC_DEF_LINK_WIN); ETH_LINK_TOLERANCE, ETH_LINK_WINDOW);
if (res) if (res)
return res; return res;
...@@ -273,10 +271,10 @@ int eth_media_start(void) ...@@ -273,10 +271,10 @@ int eth_media_start(void)
} }
/** /**
* eth_media_stop - deactivate Ethernet bearer support * tipc_eth_media_stop - deactivate Ethernet bearer support
*/ */
void eth_media_stop(void) void tipc_eth_media_stop(void)
{ {
int i; int i;
......
...@@ -52,7 +52,7 @@ static void process_signal_queue(unsigned long dummy); ...@@ -52,7 +52,7 @@ static void process_signal_queue(unsigned long dummy);
static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0); static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0);
unsigned int k_signal(Handler routine, unsigned long argument) unsigned int tipc_k_signal(Handler routine, unsigned long argument)
{ {
struct queue_item *item; struct queue_item *item;
...@@ -93,7 +93,7 @@ static void process_signal_queue(unsigned long dummy) ...@@ -93,7 +93,7 @@ static void process_signal_queue(unsigned long dummy)
spin_unlock_bh(&qitem_lock); spin_unlock_bh(&qitem_lock);
} }
int handler_start(void) int tipc_handler_start(void)
{ {
tipc_queue_item_cache = tipc_queue_item_cache =
kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), kmem_cache_create("tipc_queue_items", sizeof(struct queue_item),
...@@ -107,7 +107,7 @@ int handler_start(void) ...@@ -107,7 +107,7 @@ int handler_start(void)
return 0; return 0;
} }
void handler_stop(void) void tipc_handler_stop(void)
{ {
struct list_head *l, *n; struct list_head *l, *n;
struct queue_item *item; struct queue_item *item;
......
This diff is collapsed.
...@@ -221,44 +221,43 @@ struct link { ...@@ -221,44 +221,43 @@ struct link {
struct port; struct port;
struct link *link_create(struct bearer *b_ptr, const u32 peer, struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
const struct tipc_media_addr *media_addr); const struct tipc_media_addr *media_addr);
void link_delete(struct link *l_ptr); void tipc_link_delete(struct link *l_ptr);
void link_changeover(struct link *l_ptr); void tipc_link_changeover(struct link *l_ptr);
void link_send_duplicate(struct link *l_ptr, struct link *dest); void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest);
void link_reset_fragments(struct link *l_ptr); void tipc_link_reset_fragments(struct link *l_ptr);
int link_is_up(struct link *l_ptr); int tipc_link_is_up(struct link *l_ptr);
int link_is_active(struct link *l_ptr); int tipc_link_is_active(struct link *l_ptr);
void link_start(struct link *l_ptr); void tipc_link_start(struct link *l_ptr);
u32 link_push_packet(struct link *l_ptr); u32 tipc_link_push_packet(struct link *l_ptr);
void link_stop(struct link *l_ptr); void tipc_link_stop(struct link *l_ptr);
struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space);
struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space);
void link_reset(struct link *l_ptr); void tipc_link_reset(struct link *l_ptr);
int link_send(struct sk_buff *buf, u32 dest, u32 selector); int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector);
int link_send_buf(struct link *l_ptr, struct sk_buff *buf); int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf);
u32 link_get_max_pkt(u32 dest,u32 selector); u32 tipc_link_get_max_pkt(u32 dest,u32 selector);
int link_send_sections_fast(struct port* sender, int tipc_link_send_sections_fast(struct port* sender,
struct iovec const *msg_sect, struct iovec const *msg_sect,
const u32 num_sect, const u32 num_sect,
u32 destnode); u32 destnode);
int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
void link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, struct tipc_msg *msg, u32 selector);
struct tipc_msg *msg, u32 selector); void tipc_link_recv_bundle(struct sk_buff *buf);
void link_recv_bundle(struct sk_buff *buf); int tipc_link_recv_fragment(struct sk_buff **pending,
int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
struct sk_buff **fb, struct tipc_msg **msg);
struct tipc_msg **msg); void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap,
void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, u32 tolerance, u32 priority, u32 acked_mtu);
u32 tolerance, u32 priority, u32 acked_mtu); void tipc_link_push_queue(struct link *l_ptr);
void link_push_queue(struct link *l_ptr); u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
u32 link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
struct sk_buff *buf); struct sk_buff *buf);
void link_wakeup_ports(struct link *l_ptr, int all); void tipc_link_wakeup_ports(struct link *l_ptr, int all);
void link_set_queue_limits(struct link *l_ptr, u32 window); void tipc_link_set_queue_limits(struct link *l_ptr, u32 window);
void link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits); void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits);
/* /*
* Link sequence number manipulation routines (uses modulo 2**16 arithmetic) * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
......
...@@ -41,18 +41,7 @@ ...@@ -41,18 +41,7 @@
#include "bearer.h" #include "bearer.h"
void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
{
memcpy(&((int *)m)[5], a, sizeof(*a));
}
void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
memcpy(a, &((int*)m)[5], sizeof(*a));
}
void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
{ {
u32 usr = msg_user(msg); u32 usr = msg_user(msg);
tipc_printf(buf, str); tipc_printf(buf, str);
...@@ -318,7 +307,7 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) ...@@ -318,7 +307,7 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
tipc_printf(buf, ":REQL(%u):", msg_req_links(msg)); tipc_printf(buf, ":REQL(%u):", msg_req_links(msg));
tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg)); tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg));
tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg)); tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg));
media_addr_printf(buf, orig); tipc_media_addr_printf(buf, orig);
} }
if (msg_user(msg) == BCAST_PROTOCOL) { if (msg_user(msg) == BCAST_PROTOCOL) {
tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg)); tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg));
...@@ -326,9 +315,9 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) ...@@ -326,9 +315,9 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
} }
tipc_printf(buf, "\n"); tipc_printf(buf, "\n");
if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) { if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) {
msg_print(buf,msg_get_wrapped(msg)," /"); tipc_msg_print(buf,msg_get_wrapped(msg)," /");
} }
if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) { if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) {
msg_print(buf,msg_get_wrapped(msg)," /"); tipc_msg_print(buf,msg_get_wrapped(msg)," /");
} }
} }
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef _TIPC_MSG_H #ifndef _TIPC_MSG_H
#define _TIPC_MSG_H #define _TIPC_MSG_H
#include <net/tipc/tipc_msg.h> #include "core.h"
#define TIPC_VERSION 2 #define TIPC_VERSION 2
#define DATA_LOW TIPC_LOW_IMPORTANCE #define DATA_LOW TIPC_LOW_IMPORTANCE
...@@ -805,14 +805,14 @@ static inline int msg_build(struct tipc_msg *hdr, ...@@ -805,14 +805,14 @@ static inline int msg_build(struct tipc_msg *hdr,
return -EFAULT; return -EFAULT;
} }
static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
memcpy(&((int *)m)[5], a, sizeof(*a));
}
struct tipc_media_addr; static inline void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
extern void msg_set_media_addr(struct tipc_msg *m, memcpy(a, &((int*)m)[5], sizeof(*a));
struct tipc_media_addr *a); }
extern void msg_get_media_addr(struct tipc_msg *m,
struct tipc_media_addr *a);
#endif #endif
...@@ -114,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) ...@@ -114,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
} }
/** /**
* named_publish - tell other nodes about a new publication by this node * tipc_named_publish - tell other nodes about a new publication by this node
*/ */
void named_publish(struct publication *publ) void tipc_named_publish(struct publication *publ)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct distr_item *item; struct distr_item *item;
...@@ -133,15 +133,15 @@ void named_publish(struct publication *publ) ...@@ -133,15 +133,15 @@ void named_publish(struct publication *publ)
item = (struct distr_item *)msg_data(buf_msg(buf)); item = (struct distr_item *)msg_data(buf_msg(buf));
publ_to_item(item, publ); publ_to_item(item, publ);
dbg("named_withdraw: broadcasting publish msg\n"); dbg("tipc_named_withdraw: broadcasting publish msg\n");
cluster_broadcast(buf); tipc_cltr_broadcast(buf);
} }
/** /**
* named_withdraw - tell other nodes about a withdrawn publication by this node * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
*/ */
void named_withdraw(struct publication *publ) void tipc_named_withdraw(struct publication *publ)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct distr_item *item; struct distr_item *item;
...@@ -157,15 +157,15 @@ void named_withdraw(struct publication *publ) ...@@ -157,15 +157,15 @@ void named_withdraw(struct publication *publ)
item = (struct distr_item *)msg_data(buf_msg(buf)); item = (struct distr_item *)msg_data(buf_msg(buf));
publ_to_item(item, publ); publ_to_item(item, publ);
dbg("named_withdraw: broadcasting withdraw msg\n"); dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
cluster_broadcast(buf); tipc_cltr_broadcast(buf);
} }
/** /**
* named_node_up - tell specified node about all publications by this node * tipc_named_node_up - tell specified node about all publications by this node
*/ */
void named_node_up(unsigned long node) void tipc_named_node_up(unsigned long node)
{ {
struct publication *publ; struct publication *publ;
struct distr_item *item = 0; struct distr_item *item = 0;
...@@ -175,7 +175,7 @@ void named_node_up(unsigned long node) ...@@ -175,7 +175,7 @@ void named_node_up(unsigned long node)
u32 max_item_buf; u32 max_item_buf;
assert(in_own_cluster(node)); assert(in_own_cluster(node));
read_lock_bh(&nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
max_item_buf *= ITEM_SIZE; max_item_buf *= ITEM_SIZE;
rest = publ_cnt * ITEM_SIZE; rest = publ_cnt * ITEM_SIZE;
...@@ -196,15 +196,15 @@ void named_node_up(unsigned long node) ...@@ -196,15 +196,15 @@ void named_node_up(unsigned long node)
left -= ITEM_SIZE; left -= ITEM_SIZE;
if (!left) { if (!left) {
msg_set_link_selector(buf_msg(buf), node); msg_set_link_selector(buf_msg(buf), node);
dbg("named_node_up: sending publish msg to " dbg("tipc_named_node_up: sending publish msg to "
"<%u.%u.%u>\n", tipc_zone(node), "<%u.%u.%u>\n", tipc_zone(node),
tipc_cluster(node), tipc_node(node)); tipc_cluster(node), tipc_node(node));
link_send(buf, node, node); tipc_link_send(buf, node, node);
buf = 0; buf = 0;
} }
} }
exit: exit:
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
} }
/** /**
...@@ -221,73 +221,73 @@ void named_node_up(unsigned long node) ...@@ -221,73 +221,73 @@ void named_node_up(unsigned long node)
static void node_is_down(struct publication *publ) static void node_is_down(struct publication *publ)
{ {
struct publication *p; struct publication *p;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
dbg("node_is_down: withdrawing %u, %u, %u\n", dbg("node_is_down: withdrawing %u, %u, %u\n",
publ->type, publ->lower, publ->upper); publ->type, publ->lower, publ->upper);
publ->key += 1222345; publ->key += 1222345;
p = nametbl_remove_publ(publ->type, publ->lower, p = tipc_nametbl_remove_publ(publ->type, publ->lower,
publ->node, publ->ref, publ->key); publ->node, publ->ref, publ->key);
assert(p == publ); assert(p == publ);
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
if (publ) if (publ)
kfree(publ); kfree(publ);
} }
/** /**
* named_recv - process name table update message sent by another node * tipc_named_recv - process name table update message sent by another node
*/ */
void named_recv(struct sk_buff *buf) void tipc_named_recv(struct sk_buff *buf)
{ {
struct publication *publ; struct publication *publ;
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
struct distr_item *item = (struct distr_item *)msg_data(msg); struct distr_item *item = (struct distr_item *)msg_data(msg);
u32 count = msg_data_sz(msg) / ITEM_SIZE; u32 count = msg_data_sz(msg) / ITEM_SIZE;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
while (count--) { while (count--) {
if (msg_type(msg) == PUBLICATION) { if (msg_type(msg) == PUBLICATION) {
dbg("named_recv: got publication for %u, %u, %u\n", dbg("tipc_named_recv: got publication for %u, %u, %u\n",
ntohl(item->type), ntohl(item->lower), ntohl(item->type), ntohl(item->lower),
ntohl(item->upper)); ntohl(item->upper));
publ = nametbl_insert_publ(ntohl(item->type), publ = tipc_nametbl_insert_publ(ntohl(item->type),
ntohl(item->lower), ntohl(item->lower),
ntohl(item->upper), ntohl(item->upper),
TIPC_CLUSTER_SCOPE, TIPC_CLUSTER_SCOPE,
msg_orignode(msg), msg_orignode(msg),
ntohl(item->ref), ntohl(item->ref),
ntohl(item->key)); ntohl(item->key));
if (publ) { if (publ) {
nodesub_subscribe(&publ->subscr, tipc_nodesub_subscribe(&publ->subscr,
msg_orignode(msg), msg_orignode(msg),
publ, publ,
(net_ev_handler)node_is_down); (net_ev_handler)node_is_down);
} }
} else if (msg_type(msg) == WITHDRAWAL) { } else if (msg_type(msg) == WITHDRAWAL) {
dbg("named_recv: got withdrawl for %u, %u, %u\n", dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n",
ntohl(item->type), ntohl(item->lower), ntohl(item->type), ntohl(item->lower),
ntohl(item->upper)); ntohl(item->upper));
publ = nametbl_remove_publ(ntohl(item->type), publ = tipc_nametbl_remove_publ(ntohl(item->type),
ntohl(item->lower), ntohl(item->lower),
msg_orignode(msg), msg_orignode(msg),
ntohl(item->ref), ntohl(item->ref),
ntohl(item->key)); ntohl(item->key));
if (publ) { if (publ) {
nodesub_unsubscribe(&publ->subscr); tipc_nodesub_unsubscribe(&publ->subscr);
kfree(publ); kfree(publ);
} }
} else { } else {
warn("named_recv: unknown msg\n"); warn("tipc_named_recv: unknown msg\n");
} }
item++; item++;
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
buf_discard(buf); buf_discard(buf);
} }
/** /**
* named_reinit - re-initialize local publication list * tipc_named_reinit - re-initialize local publication list
* *
* This routine is called whenever TIPC networking is (re)enabled. * This routine is called whenever TIPC networking is (re)enabled.
* All existing publications by this node that have "cluster" or "zone" scope * All existing publications by this node that have "cluster" or "zone" scope
...@@ -295,15 +295,15 @@ void named_recv(struct sk_buff *buf) ...@@ -295,15 +295,15 @@ void named_recv(struct sk_buff *buf)
* (If the node's address is unchanged, the update loop terminates immediately.) * (If the node's address is unchanged, the update loop terminates immediately.)
*/ */
void named_reinit(void) void tipc_named_reinit(void)
{ {
struct publication *publ; struct publication *publ;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
list_for_each_entry(publ, &publ_root, local_list) { list_for_each_entry(publ, &publ_root, local_list) {
if (publ->node == tipc_own_addr) if (publ->node == tipc_own_addr)
break; break;
publ->node = tipc_own_addr; publ->node = tipc_own_addr;
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
} }
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
#include "name_table.h" #include "name_table.h"
void named_publish(struct publication *publ); void tipc_named_publish(struct publication *publ);
void named_withdraw(struct publication *publ); void tipc_named_withdraw(struct publication *publ);
void named_node_up(unsigned long node); void tipc_named_node_up(unsigned long node);
void named_recv(struct sk_buff *buf); void tipc_named_recv(struct sk_buff *buf);
void named_reinit(void); void tipc_named_reinit(void);
#endif #endif
This diff is collapsed.
...@@ -85,24 +85,24 @@ struct publication { ...@@ -85,24 +85,24 @@ struct publication {
}; };
extern rwlock_t nametbl_lock; extern rwlock_t tipc_nametbl_lock;
struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space);
u32 nametbl_translate(u32 type, u32 instance, u32 *node); u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node);
int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
struct port_list *dports); struct port_list *dports);
int nametbl_publish_rsv(u32 ref, unsigned int scope, int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
struct tipc_name_seq const *seq); struct tipc_name_seq const *seq);
struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
u32 scope, u32 port_ref, u32 key); u32 scope, u32 port_ref, u32 key);
int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key);
struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
u32 scope, u32 node, u32 ref, u32 key); u32 scope, u32 node, u32 ref, u32 key);
struct publication *nametbl_remove_publ(u32 type, u32 lower, struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
u32 node, u32 ref, u32 key); u32 node, u32 ref, u32 key);
void nametbl_subscribe(struct subscription *s); void tipc_nametbl_subscribe(struct subscription *s);
void nametbl_unsubscribe(struct subscription *s); void tipc_nametbl_unsubscribe(struct subscription *s);
int nametbl_init(void); int tipc_nametbl_init(void);
void nametbl_stop(void); void tipc_nametbl_stop(void);
#endif #endif
...@@ -58,25 +58,25 @@ ...@@ -58,25 +58,25 @@
* 1: The routing hierarchy. * 1: The routing hierarchy.
* Comprises the structures 'zone', 'cluster', 'node', 'link' * Comprises the structures 'zone', 'cluster', 'node', 'link'
* and 'bearer'. The whole hierarchy is protected by a big * and 'bearer'. The whole hierarchy is protected by a big
* read/write lock, net_lock, to enssure that nothing is added * read/write lock, tipc_net_lock, to enssure that nothing is added
* or removed while code is accessing any of these structures. * or removed while code is accessing any of these structures.
* This layer must not be called from the two others while they * This layer must not be called from the two others while they
* hold any of their own locks. * hold any of their own locks.
* Neither must it itself do any upcalls to the other two before * Neither must it itself do any upcalls to the other two before
* it has released net_lock and other protective locks. * it has released tipc_net_lock and other protective locks.
* *
* Within the net_lock domain there are two sub-domains;'node' and * Within the tipc_net_lock domain there are two sub-domains;'node' and
* 'bearer', where local write operations are permitted, * 'bearer', where local write operations are permitted,
* provided that those are protected by individual spin_locks * provided that those are protected by individual spin_locks
* per instance. Code holding net_lock(read) and a node spin_lock * per instance. Code holding tipc_net_lock(read) and a node spin_lock
* is permitted to poke around in both the node itself and its * is permitted to poke around in both the node itself and its
* subordinate links. I.e, it can update link counters and queues, * subordinate links. I.e, it can update link counters and queues,
* change link state, send protocol messages, and alter the * change link state, send protocol messages, and alter the
* "active_links" array in the node; but it can _not_ remove a link * "active_links" array in the node; but it can _not_ remove a link
* or a node from the overall structure. * or a node from the overall structure.
* Correspondingly, individual bearers may change status within a * Correspondingly, individual bearers may change status within a
* net_lock(read), protected by an individual spin_lock ber bearer * tipc_net_lock(read), protected by an individual spin_lock ber bearer
* instance, but it needs net_lock(write) to remove/add any bearers. * instance, but it needs tipc_net_lock(write) to remove/add any bearers.
* *
* *
* 2: The transport level of the protocol. * 2: The transport level of the protocol.
...@@ -97,91 +97,91 @@ ...@@ -97,91 +97,91 @@
* (Nobody is using read-only access to this, so it can just as * (Nobody is using read-only access to this, so it can just as
* well be changed to a spin_lock) * well be changed to a spin_lock)
* - A spin lock to protect the registry of kernel/driver users (reg.c) * - A spin lock to protect the registry of kernel/driver users (reg.c)
* - A global spin_lock (port_lock), which only task is to ensure * - A global spin_lock (tipc_port_lock), which only task is to ensure
* consistency where more than one port is involved in an operation, * consistency where more than one port is involved in an operation,
* i.e., whe a port is part of a linked list of ports. * i.e., whe a port is part of a linked list of ports.
* There are two such lists; 'port_list', which is used for management, * There are two such lists; 'port_list', which is used for management,
* and 'wait_list', which is used to queue ports during congestion. * and 'wait_list', which is used to queue ports during congestion.
* *
* 3: The name table (name_table.c, name_distr.c, subscription.c) * 3: The name table (name_table.c, name_distr.c, subscription.c)
* - There is one big read/write-lock (nametbl_lock) protecting the * - There is one big read/write-lock (tipc_nametbl_lock) protecting the
* overall name table structure. Nothing must be added/removed to * overall name table structure. Nothing must be added/removed to
* this structure without holding write access to it. * this structure without holding write access to it.
* - There is one local spin_lock per sub_sequence, which can be seen * - There is one local spin_lock per sub_sequence, which can be seen
* as a sub-domain to the nametbl_lock domain. It is used only * as a sub-domain to the tipc_nametbl_lock domain. It is used only
* for translation operations, and is needed because a translation * for translation operations, and is needed because a translation
* steps the root of the 'publication' linked list between each lookup. * steps the root of the 'publication' linked list between each lookup.
* This is always used within the scope of a nametbl_lock(read). * This is always used within the scope of a tipc_nametbl_lock(read).
* - A local spin_lock protecting the queue of subscriber events. * - A local spin_lock protecting the queue of subscriber events.
*/ */
rwlock_t net_lock = RW_LOCK_UNLOCKED; rwlock_t tipc_net_lock = RW_LOCK_UNLOCKED;
struct network net = { 0 }; struct network tipc_net = { 0 };
struct node *net_select_remote_node(u32 addr, u32 ref) struct node *tipc_net_select_remote_node(u32 addr, u32 ref)
{ {
return zone_select_remote_node(net.zones[tipc_zone(addr)], addr, ref); return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref);
} }
u32 net_select_router(u32 addr, u32 ref) u32 tipc_net_select_router(u32 addr, u32 ref)
{ {
return zone_select_router(net.zones[tipc_zone(addr)], addr, ref); return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref);
} }
u32 net_next_node(u32 a) u32 tipc_net_next_node(u32 a)
{ {
if (net.zones[tipc_zone(a)]) if (tipc_net.zones[tipc_zone(a)])
return zone_next_node(a); return tipc_zone_next_node(a);
return 0; return 0;
} }
void net_remove_as_router(u32 router) void tipc_net_remove_as_router(u32 router)
{ {
u32 z_num; u32 z_num;
for (z_num = 1; z_num <= tipc_max_zones; z_num++) { for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
if (!net.zones[z_num]) if (!tipc_net.zones[z_num])
continue; continue;
zone_remove_as_router(net.zones[z_num], router); tipc_zone_remove_as_router(tipc_net.zones[z_num], router);
} }
} }
void net_send_external_routes(u32 dest) void tipc_net_send_external_routes(u32 dest)
{ {
u32 z_num; u32 z_num;
for (z_num = 1; z_num <= tipc_max_zones; z_num++) { for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
if (net.zones[z_num]) if (tipc_net.zones[z_num])
zone_send_external_routes(net.zones[z_num], dest); tipc_zone_send_external_routes(tipc_net.zones[z_num], dest);
} }
} }
int net_init(void) static int net_init(void)
{ {
u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1); u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1);
memset(&net, 0, sizeof(net)); memset(&tipc_net, 0, sizeof(tipc_net));
net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC); tipc_net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC);
if (!net.zones) { if (!tipc_net.zones) {
return -ENOMEM; return -ENOMEM;
} }
memset(net.zones, 0, sz); memset(tipc_net.zones, 0, sz);
return TIPC_OK; return TIPC_OK;
} }
void net_stop(void) static void net_stop(void)
{ {
u32 z_num; u32 z_num;
if (!net.zones) if (!tipc_net.zones)
return; return;
for (z_num = 1; z_num <= tipc_max_zones; z_num++) { for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
zone_delete(net.zones[z_num]); tipc_zone_delete(tipc_net.zones[z_num]);
} }
kfree(net.zones); kfree(tipc_net.zones);
net.zones = 0; tipc_net.zones = 0;
} }
static void net_route_named_msg(struct sk_buff *buf) static void net_route_named_msg(struct sk_buff *buf)
...@@ -191,26 +191,26 @@ static void net_route_named_msg(struct sk_buff *buf) ...@@ -191,26 +191,26 @@ static void net_route_named_msg(struct sk_buff *buf)
u32 dport; u32 dport;
if (!msg_named(msg)) { if (!msg_named(msg)) {
msg_dbg(msg, "net->drop_nam:"); msg_dbg(msg, "tipc_net->drop_nam:");
buf_discard(buf); buf_discard(buf);
return; return;
} }
dnode = addr_domain(msg_lookup_scope(msg)); dnode = addr_domain(msg_lookup_scope(msg));
dport = nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode); dport = tipc_nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode);
dbg("net->lookup<%u,%u>-><%u,%x>\n", dbg("tipc_net->lookup<%u,%u>-><%u,%x>\n",
msg_nametype(msg), msg_nameinst(msg), dport, dnode); msg_nametype(msg), msg_nameinst(msg), dport, dnode);
if (dport) { if (dport) {
msg_set_destnode(msg, dnode); msg_set_destnode(msg, dnode);
msg_set_destport(msg, dport); msg_set_destport(msg, dport);
net_route_msg(buf); tipc_net_route_msg(buf);
return; return;
} }
msg_dbg(msg, "net->rej:NO NAME: "); msg_dbg(msg, "tipc_net->rej:NO NAME: ");
tipc_reject_msg(buf, TIPC_ERR_NO_NAME); tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
} }
void net_route_msg(struct sk_buff *buf) void tipc_net_route_msg(struct sk_buff *buf)
{ {
struct tipc_msg *msg; struct tipc_msg *msg;
u32 dnode; u32 dnode;
...@@ -232,29 +232,29 @@ void net_route_msg(struct sk_buff *buf) ...@@ -232,29 +232,29 @@ void net_route_msg(struct sk_buff *buf)
return; return;
} }
msg_dbg(msg, "net->rout: "); msg_dbg(msg, "tipc_net->rout: ");
/* Handle message for this node */ /* Handle message for this node */
dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg);
if (in_scope(dnode, tipc_own_addr)) { if (in_scope(dnode, tipc_own_addr)) {
if (msg_isdata(msg)) { if (msg_isdata(msg)) {
if (msg_mcast(msg)) if (msg_mcast(msg))
port_recv_mcast(buf, NULL); tipc_port_recv_mcast(buf, NULL);
else if (msg_destport(msg)) else if (msg_destport(msg))
port_recv_msg(buf); tipc_port_recv_msg(buf);
else else
net_route_named_msg(buf); net_route_named_msg(buf);
return; return;
} }
switch (msg_user(msg)) { switch (msg_user(msg)) {
case ROUTE_DISTRIBUTOR: case ROUTE_DISTRIBUTOR:
cluster_recv_routing_table(buf); tipc_cltr_recv_routing_table(buf);
break; break;
case NAME_DISTRIBUTOR: case NAME_DISTRIBUTOR:
named_recv(buf); tipc_named_recv(buf);
break; break;
case CONN_MANAGER: case CONN_MANAGER:
port_recv_proto_msg(buf); tipc_port_recv_proto_msg(buf);
break; break;
default: default:
msg_dbg(msg,"DROP/NET/<REC<"); msg_dbg(msg,"DROP/NET/<REC<");
...@@ -265,10 +265,10 @@ void net_route_msg(struct sk_buff *buf) ...@@ -265,10 +265,10 @@ void net_route_msg(struct sk_buff *buf)
/* Handle message for another node */ /* Handle message for another node */
msg_dbg(msg, "NET>SEND>: "); msg_dbg(msg, "NET>SEND>: ");
link_send(buf, dnode, msg_link_selector(msg)); tipc_link_send(buf, dnode, msg_link_selector(msg));
} }
int tipc_start_net(void) int tipc_net_start(void)
{ {
char addr_string[16]; char addr_string[16];
int res; int res;
...@@ -277,35 +277,35 @@ int tipc_start_net(void) ...@@ -277,35 +277,35 @@ int tipc_start_net(void)
return -ENOPROTOOPT; return -ENOPROTOOPT;
tipc_mode = TIPC_NET_MODE; tipc_mode = TIPC_NET_MODE;
named_reinit(); tipc_named_reinit();
port_reinit(); tipc_port_reinit();
if ((res = bearer_init()) || if ((res = tipc_bearer_init()) ||
(res = net_init()) || (res = net_init()) ||
(res = cluster_init()) || (res = tipc_cltr_init()) ||
(res = bclink_init())) { (res = tipc_bclink_init())) {
return res; return res;
} }
subscr_stop(); tipc_subscr_stop();
cfg_stop(); tipc_cfg_stop();
k_signal((Handler)subscr_start, 0); tipc_k_signal((Handler)tipc_subscr_start, 0);
k_signal((Handler)cfg_init, 0); tipc_k_signal((Handler)tipc_cfg_init, 0);
info("Started in network mode\n"); info("Started in network mode\n");
info("Own node address %s, network identity %u\n", info("Own node address %s, network identity %u\n",
addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
return TIPC_OK; return TIPC_OK;
} }
void tipc_stop_net(void) void tipc_net_stop(void)
{ {
if (tipc_mode != TIPC_NET_MODE) if (tipc_mode != TIPC_NET_MODE)
return; return;
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
bearer_stop(); tipc_bearer_stop();
tipc_mode = TIPC_NODE_MODE; tipc_mode = TIPC_NODE_MODE;
bclink_stop(); tipc_bclink_stop();
net_stop(); net_stop();
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
info("Left network mode \n"); info("Left network mode \n");
} }
...@@ -49,18 +49,16 @@ struct network { ...@@ -49,18 +49,16 @@ struct network {
}; };
extern struct network net; extern struct network tipc_net;
extern rwlock_t net_lock; extern rwlock_t tipc_net_lock;
int net_init(void); void tipc_net_remove_as_router(u32 router);
void net_stop(void); void tipc_net_send_external_routes(u32 dest);
void net_remove_as_router(u32 router); void tipc_net_route_msg(struct sk_buff *buf);
void net_send_external_routes(u32 dest); struct node *tipc_net_select_remote_node(u32 addr, u32 ref);
void net_route_msg(struct sk_buff *buf); u32 tipc_net_select_router(u32 addr, u32 ref);
struct node *net_select_remote_node(u32 addr, u32 ref);
u32 net_select_router(u32 addr, u32 ref);
int tipc_start_net(void); int tipc_net_start(void);
void tipc_stop_net(void); void tipc_net_stop(void);
#endif #endif
...@@ -47,13 +47,13 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) ...@@ -47,13 +47,13 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN); int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN);
if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN))) if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN)))
rep_buf = cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); rep_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN);
else else
rep_buf = cfg_do_cmd(req_userhdr->dest, rep_buf = tipc_cfg_do_cmd(req_userhdr->dest,
req_userhdr->cmd, req_userhdr->cmd,
NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN,
NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN),
hdr_space); hdr_space);
if (rep_buf) { if (rep_buf) {
skb_push(rep_buf, hdr_space); skb_push(rep_buf, hdr_space);
...@@ -81,7 +81,7 @@ static struct genl_ops ops = { ...@@ -81,7 +81,7 @@ static struct genl_ops ops = {
static int family_registered = 0; static int family_registered = 0;
int netlink_start(void) int tipc_netlink_start(void)
{ {
...@@ -103,7 +103,7 @@ int netlink_start(void) ...@@ -103,7 +103,7 @@ int netlink_start(void)
return -EFAULT; return -EFAULT;
} }
void netlink_stop(void) void tipc_netlink_stop(void)
{ {
if (family_registered) { if (family_registered) {
genl_unregister_family(&family); genl_unregister_family(&family);
......
This diff is collapsed.
...@@ -92,31 +92,31 @@ struct node { ...@@ -92,31 +92,31 @@ struct node {
} bclink; } bclink;
}; };
extern struct node *nodes; extern struct node *tipc_nodes;
extern u32 tipc_own_tag; extern u32 tipc_own_tag;
struct node *node_create(u32 addr); struct node *tipc_node_create(u32 addr);
void node_delete(struct node *n_ptr); void tipc_node_delete(struct node *n_ptr);
struct node *node_attach_link(struct link *l_ptr); struct node *tipc_node_attach_link(struct link *l_ptr);
void node_detach_link(struct node *n_ptr, struct link *l_ptr); void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr);
void node_link_down(struct node *n_ptr, struct link *l_ptr); void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr);
void node_link_up(struct node *n_ptr, struct link *l_ptr); void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr);
int node_has_active_links(struct node *n_ptr); int tipc_node_has_active_links(struct node *n_ptr);
int node_has_redundant_links(struct node *n_ptr); int tipc_node_has_redundant_links(struct node *n_ptr);
u32 node_select_router(struct node *n_ptr, u32 ref); u32 tipc_node_select_router(struct node *n_ptr, u32 ref);
struct node *node_select_next_hop(u32 addr, u32 selector); struct node *tipc_node_select_next_hop(u32 addr, u32 selector);
int node_is_up(struct node *n_ptr); int tipc_node_is_up(struct node *n_ptr);
void node_add_router(struct node *n_ptr, u32 router); void tipc_node_add_router(struct node *n_ptr, u32 router);
void node_remove_router(struct node *n_ptr, u32 router); void tipc_node_remove_router(struct node *n_ptr, u32 router);
struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space);
struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space);
static inline struct node *node_find(u32 addr) static inline struct node *tipc_node_find(u32 addr)
{ {
if (likely(in_own_cluster(addr))) if (likely(in_own_cluster(addr)))
return local_nodes[tipc_node(addr)]; return tipc_local_nodes[tipc_node(addr)];
else if (addr_domain_valid(addr)) { else if (tipc_addr_domain_valid(addr)) {
struct cluster *c_ptr = cluster_find(addr); struct cluster *c_ptr = tipc_cltr_find(addr);
if (c_ptr) if (c_ptr)
return c_ptr->nodes[tipc_node(addr)]; return c_ptr->nodes[tipc_node(addr)];
...@@ -124,19 +124,19 @@ static inline struct node *node_find(u32 addr) ...@@ -124,19 +124,19 @@ static inline struct node *node_find(u32 addr)
return 0; return 0;
} }
static inline struct node *node_select(u32 addr, u32 selector) static inline struct node *tipc_node_select(u32 addr, u32 selector)
{ {
if (likely(in_own_cluster(addr))) if (likely(in_own_cluster(addr)))
return local_nodes[tipc_node(addr)]; return tipc_local_nodes[tipc_node(addr)];
return node_select_next_hop(addr, selector); return tipc_node_select_next_hop(addr, selector);
} }
static inline void node_lock(struct node *n_ptr) static inline void tipc_node_lock(struct node *n_ptr)
{ {
spin_lock_bh(&n_ptr->lock); spin_lock_bh(&n_ptr->lock);
} }
static inline void node_unlock(struct node *n_ptr) static inline void tipc_node_unlock(struct node *n_ptr)
{ {
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
} }
......
...@@ -41,39 +41,39 @@ ...@@ -41,39 +41,39 @@
#include "addr.h" #include "addr.h"
/** /**
* nodesub_subscribe - create "node down" subscription for specified node * tipc_nodesub_subscribe - create "node down" subscription for specified node
*/ */
void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
void *usr_handle, net_ev_handler handle_down) void *usr_handle, net_ev_handler handle_down)
{ {
node_sub->node = 0; node_sub->node = 0;
if (addr == tipc_own_addr) if (addr == tipc_own_addr)
return; return;
if (!addr_node_valid(addr)) { if (!tipc_addr_node_valid(addr)) {
warn("node_subscr with illegal %x\n", addr); warn("node_subscr with illegal %x\n", addr);
return; return;
} }
node_sub->handle_node_down = handle_down; node_sub->handle_node_down = handle_down;
node_sub->usr_handle = usr_handle; node_sub->usr_handle = usr_handle;
node_sub->node = node_find(addr); node_sub->node = tipc_node_find(addr);
assert(node_sub->node); assert(node_sub->node);
node_lock(node_sub->node); tipc_node_lock(node_sub->node);
list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub); list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub);
node_unlock(node_sub->node); tipc_node_unlock(node_sub->node);
} }
/** /**
* nodesub_unsubscribe - cancel "node down" subscription (if any) * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any)
*/ */
void nodesub_unsubscribe(struct node_subscr *node_sub) void tipc_nodesub_unsubscribe(struct node_subscr *node_sub)
{ {
if (!node_sub->node) if (!node_sub->node)
return; return;
node_lock(node_sub->node); tipc_node_lock(node_sub->node);
list_del_init(&node_sub->nodesub_list); list_del_init(&node_sub->nodesub_list);
node_unlock(node_sub->node); tipc_node_unlock(node_sub->node);
} }
...@@ -56,8 +56,8 @@ struct node_subscr { ...@@ -56,8 +56,8 @@ struct node_subscr {
struct list_head nodesub_list; struct list_head nodesub_list;
}; };
void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
void *usr_handle, net_ev_handler handle_down); void *usr_handle, net_ev_handler handle_down);
void nodesub_unsubscribe(struct node_subscr *node_sub); void tipc_nodesub_unsubscribe(struct node_subscr *node_sub);
#endif #endif
This diff is collapsed.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef _TIPC_PORT_H #ifndef _TIPC_PORT_H
#define _TIPC_PORT_H #define _TIPC_PORT_H
#include <net/tipc/tipc_port.h> #include "core.h"
#include "ref.h" #include "ref.h"
#include "net.h" #include "net.h"
#include "msg.h" #include "msg.h"
...@@ -110,65 +110,65 @@ struct port { ...@@ -110,65 +110,65 @@ struct port {
struct node_subscr subscription; struct node_subscr subscription;
}; };
extern spinlock_t port_list_lock; extern spinlock_t tipc_port_list_lock;
struct port_list; struct port_list;
int port_recv_sections(struct port *p_ptr, u32 num_sect, int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
struct iovec const *msg_sect); struct iovec const *msg_sect);
int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect, struct iovec const *msg_sect, u32 num_sect,
int err); int err);
struct sk_buff *port_get_ports(void); struct sk_buff *tipc_port_get_ports(void);
struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space); struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space);
void port_recv_proto_msg(struct sk_buff *buf); void tipc_port_recv_proto_msg(struct sk_buff *buf);
void port_recv_mcast(struct sk_buff *buf, struct port_list *dp); void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp);
void port_reinit(void); void tipc_port_reinit(void);
/** /**
* port_lock - lock port instance referred to and return its pointer * tipc_port_lock - lock port instance referred to and return its pointer
*/ */
static inline struct port *port_lock(u32 ref) static inline struct port *tipc_port_lock(u32 ref)
{ {
return (struct port *)ref_lock(ref); return (struct port *)tipc_ref_lock(ref);
} }
/** /**
* port_unlock - unlock a port instance * tipc_port_unlock - unlock a port instance
* *
* Can use pointer instead of ref_unlock() since port is already locked. * Can use pointer instead of tipc_ref_unlock() since port is already locked.
*/ */
static inline void port_unlock(struct port *p_ptr) static inline void tipc_port_unlock(struct port *p_ptr)
{ {
spin_unlock_bh(p_ptr->publ.lock); spin_unlock_bh(p_ptr->publ.lock);
} }
static inline struct port* port_deref(u32 ref) static inline struct port* tipc_port_deref(u32 ref)
{ {
return (struct port *)ref_deref(ref); return (struct port *)tipc_ref_deref(ref);
} }
static inline u32 peer_port(struct port *p_ptr) static inline u32 tipc_peer_port(struct port *p_ptr)
{ {
return msg_destport(&p_ptr->publ.phdr); return msg_destport(&p_ptr->publ.phdr);
} }
static inline u32 peer_node(struct port *p_ptr) static inline u32 tipc_peer_node(struct port *p_ptr)
{ {
return msg_destnode(&p_ptr->publ.phdr); return msg_destnode(&p_ptr->publ.phdr);
} }
static inline int port_congested(struct port *p_ptr) static inline int tipc_port_congested(struct port *p_ptr)
{ {
return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2));
} }
/** /**
* port_recv_msg - receive message from lower layer and deliver to port user * tipc_port_recv_msg - receive message from lower layer and deliver to port user
*/ */
static inline int port_recv_msg(struct sk_buff *buf) static inline int tipc_port_recv_msg(struct sk_buff *buf)
{ {
struct port *p_ptr; struct port *p_ptr;
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
...@@ -178,24 +178,24 @@ static inline int port_recv_msg(struct sk_buff *buf) ...@@ -178,24 +178,24 @@ static inline int port_recv_msg(struct sk_buff *buf)
/* forward unresolved named message */ /* forward unresolved named message */
if (unlikely(!destport)) { if (unlikely(!destport)) {
net_route_msg(buf); tipc_net_route_msg(buf);
return dsz; return dsz;
} }
/* validate destination & pass to port, otherwise reject message */ /* validate destination & pass to port, otherwise reject message */
p_ptr = port_lock(destport); p_ptr = tipc_port_lock(destport);
if (likely(p_ptr)) { if (likely(p_ptr)) {
if (likely(p_ptr->publ.connected)) { if (likely(p_ptr->publ.connected)) {
if ((unlikely(msg_origport(msg) != peer_port(p_ptr))) || if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) ||
(unlikely(msg_orignode(msg) != peer_node(p_ptr))) || (unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) ||
(unlikely(!msg_connected(msg)))) { (unlikely(!msg_connected(msg)))) {
err = TIPC_ERR_NO_PORT; err = TIPC_ERR_NO_PORT;
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
goto reject; goto reject;
} }
} }
err = p_ptr->dispatcher(&p_ptr->publ, buf); err = p_ptr->dispatcher(&p_ptr->publ, buf);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
if (likely(!err)) if (likely(!err))
return dsz; return dsz;
} else { } else {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment