From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Suresh Bhaskaran <Suresh.Bhaskaran@magnumsemi.com>
Cc: bridge@lists.linux-foundation.org
Subject: Re: [Bridge] Socket Buffer bridging of Ethernet frames
Date: Wed, 27 Aug 2008 08:17:32 -0700 [thread overview]
Message-ID: <20080827081732.68fefb51@extreme> (raw)
In-Reply-To: <FB2A2D2F36FC264282887DD51732C0200160D2D8@magmsg03.ad.magnumsemi.com>
On Tue, 26 Aug 2008 19:29:12 -0700
"Suresh Bhaskaran" <Suresh.Bhaskaran@magnumsemi.com> wrote:
> Hello,
>
>
>
> I am requesting a sanity check on my "driver-level" bridging approach in
> this e-mail. Please let me know if you see any "gotcha's" in this
> approach.
>
>
>
> Problem:
>
> * I have a single physical ethernet device on my embedded linux
> target, and I want to bridge packets to/from a device across on the
> other side of a shared memory, that also processes ethernet data.
> * For a variety of reasons, I can't use the "brctl addbr" utility
> (I've tried!), so I'm implementing the bridging functionality for this
> specific case, at the driver level.
>
>
>
> My approach:
>
> * Modify the existing ethernet driver by adding some additional
> code:
> * Whenever I receive a packet on the physical ethernet:
>
> * Just before sending the skb to the network interface
> (netif_rx(skb)), also push the packet to shmem.
>
> * Whenever I send a packet to the physical ethernet:
>
> * Before pushing the packet to the physical ethernet
> device, also push the packet to shared memory.
>
> * When I receive a packet from the "shared memory" device:
>
> * Build up two copies of an skb
> * Get the handle to the network device by doing a
> dev_get_by_name("eth0")
> * Push one up to the netif (netif_rx(skb))
> * Push the other (identical) skb to the physical ethernet
> device.
> * dev_put("eth0") when I'm done.
>
> * I use netif_stop_queue() and netif_wake_queue() for flow control
> to the network interface, but for shmem congestion, I just drop packets
> (for now), since I don't have "easy" queue api's for flow control
> handy..
>
>
>
> Some questions/concerns I have:
>
>
>
> * is there something in the skb that has "directionality"?
>
> * That is, if I take and skb that is intended to go to the
> network interface (e.g. netif_rx(skb)), and "push" it down to physical
> device, will something get usynchronized?
> * Or, if I get an skb from the system (from the
> hard_start_xmit()), can I "push" it up again to the netif, or will some
> "directionality" thing in the skb make things go out of whack?
> * Also, if I push all these additional created skb's up to
> the interface, or down, is there some "count" between the system netif
> and the physical device that may get out of whack, and out of sync?
>
> * Also, is there something like a "man" pages for the above api's,
> and also skb questions? (other than the source code)? I wasn't to find
> a good man page on the above by few minutes "google"
>
>
>
> In any case, I'm already partially along this approach, but I sure could
> use any advance warning of potential issues and workarounds!
>
>
>
> Thanks again.
>
>
>
> Suresh Bhaskaran
>
>
>
You just reinvented AF_PACKET with mmap. I don't see why you want to.
prev parent reply other threads:[~2008-08-27 15:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 2:29 [Bridge] Socket Buffer bridging of Ethernet frames Suresh Bhaskaran
2008-08-27 15:17 ` Stephen Hemminger [this message]
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=20080827081732.68fefb51@extreme \
--to=shemminger@linux-foundation.org \
--cc=Suresh.Bhaskaran@magnumsemi.com \
--cc=bridge@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox