From: Ben Greear <greearb@candelatech.com>
To: Pavel Emelianov <xemul@openvz.org>
Cc: David Miller <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Patrick McHardy <kaber@trash.net>,
Daniel Lezcano <dlezcano@fr.ibm.com>,
Stephen Hemminger <shemminger@linux-foundation.org>,
Kirill Korotaev <dev@openvz.org>,
Linux Containers <containers@lists.osdl.org>
Subject: Re: [PATCH] Virtual ethernet tunnel (v.2)
Date: Thu, 07 Jun 2007 08:23:09 -0700 [thread overview]
Message-ID: <466822DD.1000601@candelatech.com> (raw)
In-Reply-To: <4667E83E.2060405@openvz.org>
Pavel Emelianov wrote:
> Veth stands for Virtual ETHernet. It is a simple tunnel driver
> that works at the link layer and looks like a pair of ethernet
> devices interconnected with each other.
>
As Dave mentioned, there is already a driver known as 'veth'. Maybe borrow
the etun name as well?
I would also like some way to identify veth from other device types,
preferably
something like a value in sysfs. However, that should not hold up
consideration of
this patch, and I am willing to submit a patch after this goes in to add
the functionality
I want...
> +/*
> + * xmit
> + */
> +
> +static int veth_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> + struct net_device *rcv = NULL;
> + struct veth_device_stats *stats;
> + struct veth_priv *priv, *rcv_priv;
> + int length, cpu;
> +
> + skb_orphan(skb);
> +
> + priv = netdev_priv(dev);
> + cpu = smp_processor_id();
> + stats = per_cpu_ptr(priv->stats, cpu);
> + rcv = priv->peer;
> +
> + if (!(rcv->flags & IFF_UP))
> + goto outf;
>
I think you need at least the option to zero out the time-stamp,
otherwise it will
not be re-calculated when received on the peer, and it potentially spent
significant
time since it was last calculated (think netem delay or similar).
+ /* Zero out the time-stamp so that receiving code is forced
+ * to recalculate it.
+ */
+ skb->tstamp.off_sec = 0;
+ skb->tstamp.off_usec = 0;
> +
> + rcv_priv = netdev_priv(rcv);
> + skb->pkt_type = PACKET_HOST;
> + skb->protocol = eth_type_trans(skb, rcv);
> + if (dev->features & NETIF_F_NO_CSUM)
> + skb->ip_summed = rcv_priv->ip_summed;
> +
> + dst_release(skb->dst);
> + skb->dst = NULL;
> + secpath_reset(skb);
> + nf_reset(skb);
> + skb->mark = 0;
> +
> + length = skb->len;
>
This should be done before you do the eth_type_trans, as that pulls the
header and your
byte counters will be off.
> +
> + stats->tx_bytes += length;
> + stats->tx_packets++;
>
> +
> + stats = per_cpu_ptr(rcv_priv->stats, cpu);
> + stats->rx_bytes += length;
> + stats->rx_packets++;
> +
> + netif_rx(skb);
> + return 0;
> +
> +outf:
> + kfree_skb(skb);
> + stats->tx_dropped++;
> + return 0;
> +}
>
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
next prev parent reply other threads:[~2007-06-07 15:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-07 11:13 [PATCH] Virtual ethernet tunnel (v.2) Pavel Emelianov
2007-06-07 11:16 ` [PATCH] Module for ip utility to support veth device (v.2) Pavel Emelianov
2007-06-07 15:59 ` Stephen Hemminger
2007-06-07 15:23 ` Ben Greear [this message]
2007-06-07 15:39 ` [PATCH] Virtual ethernet tunnel (v.2) Pavel Emelianov
2007-06-07 15:51 ` Ben Greear
2007-06-07 16:04 ` Pavel Emelianov
2007-06-07 16:35 ` Ben Greear
2007-06-08 16:00 ` Pavel Emelianov
2007-06-08 17:00 ` Ben Greear
2007-06-08 19:49 ` Carl-Daniel Hailfinger
2007-06-08 23:46 ` Ben Greear
2007-06-11 11:42 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=466822DD.1000601@candelatech.com \
--to=greearb@candelatech.com \
--cc=containers@lists.osdl.org \
--cc=davem@davemloft.net \
--cc=dev@openvz.org \
--cc=dlezcano@fr.ibm.com \
--cc=ebiederm@xmission.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.