On Fri, May 04, 2007 at 02:33:45PM +0100, David Howells ([EMAIL PROTECTED]) 
wrote:
> Evgeniy Polyakov <[EMAIL PROTECTED]> wrote:
> 
> > That is the same, dst is dereferenced as rtable.
> > Cloned dst is returned, so it must be put back at the ned of the usage.
> 
> If that's the case, then why do you bother to clone it in route_get_raw()?
> Surely that'll give you *two* clones...
> 
> BTW, it seems to work.  The attached function gives me:
> 
>       [0mount ] <== rxrpc_assess_MTU_size() [if_mtu 1500]
> 
> Thanks!
> 
> David
> 
> ---
> static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer)
> {
>       struct rtable *rt;
>       struct flowi fl;
>       int ret;
> 
>       peer->if_mtu = 1500;
> 
>       memset(&fl, 0, sizeof(fl));
> 
>       switch (peer->srx.transport.family) {
>       case AF_INET:
>               fl.oif = 0;
>               fl.proto = IPPROTO_UDP,
>               fl.nl_u.ip4_u.saddr = 0;
>               fl.nl_u.ip4_u.daddr = peer->srx.transport.sin.sin_addr.s_addr;
>               fl.nl_u.ip4_u.tos = 0;
>               /* assume AFS.CM talking to AFS.FS */
>               fl.uli_u.ports.sport = htonl(7001);
>               fl.uli_u.ports.dport = htonl(7000);
>               break;
>       default:
>               BUG();
>       }
> 
>       ret = ip_route_output_key(&rt, &fl);

This one is quite slow compared to atomic reference increase, so yes,
there are two clones - one for main 'route', which then is being cloned
for each used in fast path. When it is not needed anymore (netchannel is
removed), the first one is dropped.

>       if (ret < 0) {
>               kleave(" [route err %d]", ret);
>               return;
>       }
> 
>       peer->if_mtu = dst_mtu(&rt->u.dst);
>       kleave(" [if_mtu %u]", peer->if_mtu);
> }

-- 
        Evgeniy Polyakov
-
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

Reply via email to