: Introduction of AF_IUCV sockets support
Subsystems (4)
cover : Introduction of AF_IUCV sockets support
Hello,
The Inter-User Communication Vehicle (IUCV) is a z/VM communication facility that enables a program running in one virtual machine to communicate with another virtual machine, or with a control program, or even with itself. The communication takes place over a predefined linkage called a path. AF_IUCV provides a complete socket interface for socket communication from Linux to Linux (running on z/VM) or Linux on VM to CMS.
The AF_IUCV Protocol Support will use IUCV to provide AF_IUCV protocol support for communication with z/VM back-end services. It also can connect socket applications operating in Linux kernels running on different VM user IDs, or to connect a Linux application to another socket application running in a VM guest. AF_IUCV is using a different addressing scheme and therefore there is no chance to use existing drivers like netiucv for such functionality.
The patch set consists of following patches:
[1/7] [S390]: Rewrite of the IUCV base code, part 1 [2/7] [S390]: Rewrite of the IUCV base code, part 2 [3/7] [S390]: Adapt monreader driver to new IUCV API [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API [5/7] [S390]: Adapt netiucv driver to new IUCV API [6/7] [S390]: Adapt special message interface to new IUCV API [7/7] [S390]: Add AF_IUCV socket support
Basically it will remove the old IUCV base code from drivers/s390/net, adds the new rewritten one to net/iucv.
Then all iucv based device drivers like monreader, vmlogrdr, netiucv and special message interface
will be adapted to the new IUCV API.
The last patch then adds the AF_IUCV socket support residing in net/iucv either.
I am asking for integration now and of course
code review comments and suggestions are very appreciated .
Thank you very much
Frank
David Miller
maintainerFrom: Frank Pavlic <[email protected]>
Date: Fri, 2 Feb 2007 13:05:28 +0100
Quoted 9 lines
The patch set consists of following patches:
[1/7] [S390]: Rewrite of the IUCV base code, part 1 [2/7] [S390]: Rewrite of the IUCV base code, part 2 [3/7] [S390]: Adapt monreader driver to new IUCV API [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API [5/7] [S390]: Adapt netiucv driver to new IUCV API [6/7] [S390]: Adapt special message interface to new IUCV API [7/7] [S390]: Add
AF_IUCVsocket support
I have no fundamental objections to this, although I think I'll end up needing something similar on Niagara at some point :-)
The list ate the first patch due to it's size. Could you email me a copy privately so can integrate all of your work into my net-2.6.21 tree?
Thanks.
PATCH 1/1 NET : cleanup sock_from_file()
I believe dead code from sock_from_file() can be cleaned up.
All sockets are now built using sock_attach_fd(), that puts the 'sock' pointer into file->private_data and &socket_file_ops into file->f_op
I could not find a place where file->private_data could be set to NULL, keeping opened the file.
So to get 'sock' from a 'file' pointer, either :
- This is a socket file (f_op == &socket_file_ops), and we can directly get 'sock' from private_data.
- This is not a socket, we return -ENOTSOCK and dont even try to find a socket via dentry/inode :)
net/socket.c +2 -15
@@ -407,24 +407,11 @@ int sock_map_fd(struct socket *sock)static struct socket *sock_from_file (struct file *file,int *err) { -struct inode *inode; -struct socket *sock; -if (file->f_op == &socket_file_ops)return file->private_data;/* set in sock_map_fd */ - inode = file->f_path.dentry->d_inode; -if (!S_ISSOCK (inode->i_mode)) { - *err = -ENOTSOCK ; -return NULL ; - } - - sock =SOCKET_I (inode); -if (sock->file != file) { -printk (KERN_ERR "socki_lookup: socket file changed!\n" ); - sock->file = file; - } -return sock; + *err = -ENOTSOCK ; +return NULL ; }/**
PATCH 2/5 NET : Convert ipv4 route to use the new dst_entry 'next' pointer
This patch removes the rt_next pointer from 'struct rtable.u' union, and renames u.rt_next to u.dst_rt_next.
It also moves 'struct flowi' right after 'struct dst_entry' to prepare the gain on lookups.
include/net/route.h +3 -4
@@ -53,9 +53,11 @@ struct rtableunion {struct dst_entry dst; -struct rtable *rt_next; } u; +/* Cache lookup keys */ +struct flowi fl; +struct in_device *idev;unsigned rt_flags;
@@ -69,9 +71,6 @@ struct rtable/* Info on neighbour */ __be32 rt_gateway; -/* Cache lookup keys */ -struct flowi fl; -/* Miscellaneous cached information */ __be32 rt_spec_dst;/* RFC1122 specific destination */ struct inet_peer *peer;/* long-living peer info */
net/ipv4/route.c +28 -28
194 lines not on this page · raw message
PATCH 3/5 NET : Convert ipv6 route to use the new dst_entry 'next' pointer
In reply to Eric DumazetThis patch removes the next pointer from 'struct rt6_info.u' union, and renames u.next to u.dst.rt6_next.
include/net/ip6_fib.h +0 -1
@@ -83,7 +83,6 @@ struct rt6_info {union {struct dst_entry dst; -struct rt6_info *next; } u;struct inet6_dev *rt6i_idev;
net/ipv6/route.c +10 -10
@@ -243,7 +243,7 @@ static __inline__ struct rt6_info *rt6_dstruct rt6_info *sprt;if (oif) { -for (sprt = rt; sprt; sprt = sprt->u.next) { +for (sprt = rt; sprt; sprt = sprt->u.dst.rt6_next) {struct net_device *dev = sprt->rt6i_dev;if (dev->ifindex == oif)return sprt;
@@ -367,7 +367,7 @@ static struct rt6_info *rt6_select(strucfor (rt = rt0, metric = rt0->rt6i_metric; rt && rt->rt6i_metric == metric && (!last || rt != rt0); - rt = rt->u.next) { + rt = rt->u.dst.rt6_next) {int m;if (rt6_check_expired (rt))
@@ -395,9 +395,9 @@ static struct rt6_info *rt6_select(struc/* no entries matched; do round-robin */ static DEFINE_SPINLOCK (lock);spin_lock (&lock); - *head = rt0->u.next; - rt0->u.next = last->u.next; - last->u.next = rt0; + *head = rt0->u.dst.rt6_next; + rt0->u.dst.rt6_next = last->u.dst.rt6_next; + last->u.dst.rt6_next = rt0;spin_unlock (&lock); }
@@ -1269,7 +1269,7 @@ static int ip6_route_del(struct fib6_con &cfg->fc_src, cfg->fc_src_len);if (fn) { -for (rt = fn->leaf; rt; rt = rt->u.next) { +for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {if (cfg->fc_ifindex && (rt->rt6i_dev ==NULL || rt->rt6i_dev->ifindex != cfg->fc_ifindex))
@@ -1320,7 +1320,7 @@ static struct rt6_info *__ip6_route_rediread_lock_bh (&table->tb6_lock); fn =fib6_lookup (&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); restart: -for (rt = fn->leaf; rt; rt = rt->u.next) { +for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {/* * Current route is on-link; redirect is always invalid. *
@@ -1581,7 +1581,7 @@ static struct rt6_info *rt6_get_route_inif (!fn) goto out; -for (rt = fn->leaf; rt; rt = rt->u.next) { +for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {if (rt->rt6i_dev->ifindex != ifindex)continue ;if ((rt->rt6i_flags & (RTF_ROUTEINFO |RTF_GATEWAY )) != (RTF_ROUTEINFO |RTF_GATEWAY ))
@@ -1632,7 +1632,7 @@ struct rt6_info *rt6_get_dflt_router(strreturn NULL ;write_lock_bh (&table->tb6_lock); -for (rt = table->tb6_root.leaf; rt; rt=rt->u.next) { +for (rt = table->tb6_root.leaf; rt; rt=rt->u.dst.rt6_next) {if (dev == rt->rt6i_dev && ((rt->rt6i_flags & (RTF_ADDRCONF |RTF_DEFAULT )) == (RTF_ADDRCONF |RTF_DEFAULT )) &&ipv6_addr_equal (&rt->rt6i_gateway, addr))
@@ -1675,7 +1675,7 @@ void rt6_purge_dflt_routers(void) restart:read_lock_bh (&table->tb6_lock); -for (rt = table->tb6_root.leaf; rt; rt = rt->u.next) { +for (rt = table->tb6_root.leaf; rt; rt = rt->u.dst.rt6_next) {if (rt->rt6i_flags & (RTF_DEFAULT |RTF_ADDRCONF )) {dst_hold (&rt->u.dst);read_unlock_bh (&table->tb6_lock);
net/ipv6/ip6_fib.c +10 -10
@@ -298,7 +298,7 @@ static int fib6_dump_node(struct fib6_waint res;struct rt6_info *rt; -for (rt = w->leaf; rt; rt = rt->u.next) { +for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) { res =rt6_dump_route (rt, w->args);if (res <0 ) {/* Frame is full, suspend walking */
@@ -624,11 +624,11 @@ static int fib6_add_rt2node(struct fib6_ fn->leaf == &ip6_null_entry && !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){ fn->leaf = rt; - rt->u.next =NULL ; + rt->u.dst.rt6_next =NULL ; goto out; } -for (iter = fn->leaf; iter; iter=iter->u.next) { +for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) {/* * Search for duplicates */
@@ -656,7 +656,7 @@ static int fib6_add_rt2node(struct fib6_if (iter->rt6i_metric > rt->rt6i_metric)break ; - ins = &iter->u.next; + ins = &iter->u.dst.rt6_next; }/*
@@ -664,7 +664,7 @@ static int fib6_add_rt2node(struct fib6_*/ out: - rt->u.next = iter; + rt->u.dst.rt6_next = iter; *ins = rt; rt->rt6i_node = fn;atomic_inc (&rt->rt6i_ref);
@@ -1105,7 +1105,7 @@ static void fib6_del_route(struct fib6_nRT6_TRACE ("fib6_del_route\n" );/* Unlink it */ - *rtp = rt->u.next; + *rtp = rt->u.dst.rt6_next; rt->rt6i_node =NULL ; rt6_stats.fib_rt_entries--; rt6_stats.fib_discarded_routes++;
@@ -1115,14 +1115,14 @@ static void fib6_del_route(struct fib6_nFOR_WALKERS (w) {if (w->state ==FWS_C && w->leaf == rt) {RT6_TRACE ("walker %p adjusted by delroute\n" , w); - w->leaf = rt->u.next; + w->leaf = rt->u.dst.rt6_next;if (w->leaf ==NULL ) w->state =FWS_U ; } }read_unlock (&fib6_walker_lock); - rt->u.next =NULL ; + rt->u.dst.rt6_next =NULL ;if (fn->leaf ==NULL && fn->fn_flags&RTN_TL_ROOT ) fn->leaf = &ip6_null_entry;
@@ -1190,7 +1190,7 @@ int fib6_del(struct rt6_info *rt, struct* Walk the leaf entries looking for ourself */ -for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { +for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.dst.rt6_next) {if (*rtp == rt) {fib6_del_route (fn, rtp, info);return 0 ;
@@ -1317,7 +1317,7 @@ static int fib6_clean_node(struct fib6_wstruct rt6_info *rt;struct fib6_cleaner_t *c = (struct fib6_cleaner_t *)w; -for (rt = w->leaf; rt; rt = rt->u.next) { +for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) { res = c->func (rt, c->arg);if (res <0 ) { w->leaf = rt;
PATCH 4/5 NET : Convert decnet route to use the new dst_entry 'next' pointer
In reply to Eric DumazetThis patch removes the next pointer from 'struct rt6_info.u' union, and renames u.next to u.dst.rt6_next.
It also moves 'struct flowi' right after 'struct dst_entry' to prepare speedup lookups.
PATCH RESEND 4/5 NET : Convert decnet route to use the new dst_entry 'next' pointer
This patch removes the next pointer from 'struct rt6_info.u' union, and renames u.next to u.dst.rt6_next.
It also moves 'struct flowi' right after 'struct dst_entry' to prepare speedup lookups.
include/net/dn_route.h renamed from include/net/dn_route.h.orig +2 -3
@@ -68,9 +68,10 @@ extern void dn_rt_cache_flush(int delay)struct dn_route {union {struct dst_entry dst; -struct dn_route *rt_next; } u; +struct flowi fl; +__le16 rt_saddr;__le16 rt_daddr;__le16 rt_gateway;
@@ -80,8 +81,6 @@ struct dn_route {unsigned rt_flags;unsigned rt_type; - -struct flowi fl; };extern void dn_route_init (void );
net/decnet/dn_route.c renamed from net/decnet/dn_route.c.orig +16 -16
@@ -167,11 +167,11 @@ static void dn_dst_check_expire(unsignedwhile ((rt=*rtp) !=NULL ) {if (atomic_read (&rt->u.dst.__refcnt) || (now - rt->u.dst.lastuse) < expire) { - rtp = &rt->u.rt_next; + rtp = &rt->u.dst.dn_next;continue ; } - *rtp = rt->u.rt_next; - rt->u.rt_next =NULL ; + *rtp = rt->u.dst.dn_next; + rt->u.dst.dn_next =NULL ;dnrt_free (rt); }spin_unlock (&dn_rt_hash_table[i].lock);
@@ -198,11 +198,11 @@ static int dn_dst_gc(void)while ((rt=*rtp) !=NULL ) {if (atomic_read (&rt->u.dst.__refcnt) || (now - rt->u.dst.lastuse) < expire) { - rtp = &rt->u.rt_next; + rtp = &rt->u.dst.dn_next;continue ; } - *rtp = rt->u.rt_next; - rt->u.rt_next =NULL ; + *rtp = rt->u.dst.dn_next; + rt->u.dst.dn_next =NULL ;dnrt_drop (rt);break ; }
@@ -286,8 +286,8 @@ static int dn_insert_route(struct dn_rouwhile ((rth = *rthp) !=NULL ) {if (compare_keys (&rth->fl, &rt->fl)) {/* Put it first */ - *rthp = rth->u.rt_next; -rcu_assign_pointer (rth->u.rt_next, + *rthp = rth->u.dst.dn_next; +rcu_assign_pointer (rth->u.dst.dn_next, dn_rt_hash_table[hash].chain);rcu_assign_pointer (dn_rt_hash_table[hash].chain, rth);
@@ -300,10 +300,10 @@ static int dn_insert_route(struct dn_rou *rp = rth;return 0 ; } - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.dn_next; } -rcu_assign_pointer (rt->u.rt_next, dn_rt_hash_table[hash].chain); +rcu_assign_pointer (rt->u.dst.dn_next, dn_rt_hash_table[hash].chain);rcu_assign_pointer (dn_rt_hash_table[hash].chain, rt);dst_hold (&rt->u.dst);
@@ -326,8 +326,8 @@ void dn_run_flush(unsigned long dummy) goto nothing_to_declare;for (; rt; rt=next) { - next = rt->u.rt_next; - rt->u.rt_next =NULL ; + next = rt->u.dst.dn_next; + rt->u.dst.dn_next =NULL ;dst_free ((struct dst_entry *)rt); }
@@ -1169,7 +1169,7 @@ static int __dn_route_output_key(structif (!(flags &MSG_TRYHARD )) {rcu_read_lock_bh ();for (rt =rcu_dereference (dn_rt_hash_table[hash].chain); rt; - rt =rcu_dereference (rt->u.rt_next)) { + rt =rcu_dereference (rt->u.dst.dn_next)) { if ((flp->fld_dst == rt->fl.fld_dst) && (flp->fld_src == rt->fl.fld_src) && (flp->mark == rt->fl.mark) &&
@@ -1443,7 +1443,7 @@ int dn_route_input(struct sk_buff *skb)rcu_read_lock ();for (rt =rcu_dereference (dn_rt_hash_table[hash].chain); rt !=NULL ; - rt =rcu_dereference (rt->u.rt_next)) { + rt =rcu_dereference (rt->u.dst.dn_next)) { if ((rt->fl.fld_src == cb->src) && (rt->fl.fld_dst == cb->dst) && (rt->fl.oif == 0) &&
@@ -1627,7 +1627,7 @@ int dn_cache_dump(struct sk_buff *skb, srcu_read_lock_bh ();for (rt =rcu_dereference (dn_rt_hash_table[h].chain), idx =0 ; rt; - rt =rcu_dereference (rt->u.rt_next), idx++) { + rt =rcu_dereference (rt->u.dst.dn_next), idx++) {if (idx < s_idx)continue ; skb->dst =dst_clone (&rt->u.dst);
@@ -1673,7 +1673,7 @@ static struct dn_route *dn_rt_cache_get_ {struct dn_rt_cache_iter_state *s =rcu_dereference (seq->private); - rt = rt->u.rt_next; + rt = rt->u.dst.dn_next;while (!rt) {rcu_read_unlock_bh ();if (--s->bucket <0 )
PATCH 5/5 NET : Reorder fields of struct dst_entry
In reply to Eric DumazetThis last patch (but not least :) ) finally moves the next pointer at the end of struct dst_entry. This permits to perform route cache lookups with a minimal cost of one cache line per entry, instead of two.
Both 32bits and 64bits platforms benefit from this new layout.
include/net/dst.h renamed from include/net/dst.h.inter +10 -10
@@ -37,14 +37,7 @@ struct sk_buff;struct dst_entry { -union { -struct dst_entry *next; -struct rtable *rt_next; -struct rt6_info *rt6_next; -struct dn_route *dn_next; - }; -atomic_t __refcnt;/* client references */ -int __use; +struct rcu_head rcu_head;struct dst_entry *child;struct net_device *dev;short error;
@@ -55,7 +48,6 @@ struct dst_entry#define DST_NOPOLICY 4#define DST_NOHASH 8#define DST_BALANCED 0x10 -unsigned long lastuse;unsigned long expires;unsigned short header_len;/* more space at head required */
@@ -80,8 +72,16 @@ struct dst_entry#endif struct dst_ops *ops; -struct rcu_head rcu_head; +unsigned long lastuse; +atomic_t __refcnt;/* client references */ +int __use; +union { +struct dst_entry *next; +struct rtable *rt_next; +struct rt6_info *rt6_next; +struct dn_route *dn_next; + };char info[0 ]; };
David Miller
maintainerRe: [PATCH] NET : cleanup sock_from_file()
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Wed, 07 Feb 2007 00:03:25 +0100
Quoted 8 lines
I believe dead code from
sock_from_file()can be cleaned up.All sockets are now built using
sock_attach_fd(), that puts the 'sock' pointer intofile->private_dataand&socket_file_opsintofile->f_opI could not find a place where
file->private_datacould be set to NULL, keeping opened the file.
Quoted 8 lines
So to get 'sock' from a 'file' pointer, either :
- This is a socket file (
f_op==&socket_file_ops), and we can directly get 'sock' fromprivate_data.
- This is not a socket, we return-ENOTSOCKand dont even try to find a socket via dentry/inode :)Signed-off-by Eric Dumazet <[email protected]>
Looks good to me, applied, thanks Eric.
Quoted 17 lines · David Miller
From: Frank Pavlic <[email protected]>
Date: Fri, 2 Feb 2007 13:05:28 +0100Quoted 9 lines
The patch set consists of following patches:
[1/7] [S390]: Rewrite of the IUCV base code, part 1 [2/7] [S390]: Rewrite of the IUCV base code, part 2 [3/7] [S390]: Adapt monreader driver to new IUCV API [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API [5/7] [S390]: Adapt netiucv driver to new IUCV API [6/7] [S390]: Adapt special message interface to new IUCV API [7/7] [S390]: Add
AF_IUCVsocket supportI have no fundamental objections to this, although I think I'll end up needing something similar on Niagara at some point :-)
Quoted 6 lines
The list ate the first patch due to it's size. Could you email me a copy privately so can integrate all of your work into my net-2.6.21 tree?
Thanks.
-
Dave,
Really good news for me, I just have started to split the first patch :-) Thank you
I send you a copy privately...
Frank
Quoted 13 lines · David Miller
From: Frank Pavlic <[email protected]>
Date: Fri, 2 Feb 2007 13:05:28 +0100Quoted 9 lines
The patch set consists of following patches:
[1/7] [S390]: Rewrite of the IUCV base code, part 1 [2/7] [S390]: Rewrite of the IUCV base code, part 2 [3/7] [S390]: Adapt monreader driver to new IUCV API [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API [5/7] [S390]: Adapt netiucv driver to new IUCV API [6/7] [S390]: Adapt special message interface to new IUCV API [7/7] [S390]: Add
AF_IUCVsocket support
Quoted 3 lines
I have no fundamental objections to this, although I think I'll end up needing something similar on Niagara at some point :-)
I guess there are and will be more than two guys needing such a vehicle. With all the virtualization support in Linux we have right now and the stuff which will come in the future IMO we will need some kind of a generic inter-communication infrastructure (what a wording :-) ) in Linux .
Quoted 10 lines
The list ate the first patch due to it's size. Could you email me a copy privately so can integrate all of your work into my net-2.6.21 tree?
Thanks.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Frank Pavlic <[email protected]>
Date: Fri, 2 Feb 2007 13:05:28 +0100
Quoted 9 lines
The patch set consists of following patches:
[1/7] [S390]: Rewrite of the IUCV base code, part 1 [2/7] [S390]: Rewrite of the IUCV base code, part 2 [3/7] [S390]: Adapt monreader driver to new IUCV API [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API [5/7] [S390]: Adapt netiucv driver to new IUCV API [6/7] [S390]: Adapt special message interface to new IUCV API [7/7] [S390]: Add
AF_IUCVsocket support
I've applied all of this, although some of the driver conversions (notable, patches #5 and #6) didn't apply cleanly so I applied them by hand.
Watch out for any fallout from this when Linus pulls these changes in.
Thanks.
Quoted 13 lines · David Miller
From: Frank Pavlic <[email protected]>
Date: Fri, 2 Feb 2007 13:05:28 +0100Quoted 9 lines
The patch set consists of following patches:
[1/7] [S390]: Rewrite of the IUCV base code, part 1 [2/7] [S390]: Rewrite of the IUCV base code, part 2 [3/7] [S390]: Adapt monreader driver to new IUCV API [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API [5/7] [S390]: Adapt netiucv driver to new IUCV API [6/7] [S390]: Adapt special message interface to new IUCV API [7/7] [S390]: Add
AF_IUCVsocket support
Quoted 3 lines
I've applied all of this, although some of the driver conversions (notable, patches #5 and #6) didn't apply cleanly so I applied them by hand.
Thanks for this , I figured that out today by myself and started to make a new set of patches. You saved me a lot of time and work once again ;-)
Quoted 5 lines
Watch out for any fallout from this when Linus pulls these changes in.
Thanks.
I'll do so ...