Hi Eddie, Perhaps I didn't understand what you're asking. The dev->netdev_ops is memory blob which was allocated by FromHost element. So I guess answer to your question would be.. yes, it's private to just this device.
Thanks, Joonwoo On Wed, Sep 29, 2010 at 04:12:47PM -0700, Eddie Kohler wrote: > Something like this will definitely be necessary, but is > dev->netdev_ops really private to JUST THIS DEVICE? It's not shared > or anything? > > E > > > On 09/25/2010 10:30 PM, Joonwoo Park wrote: > >Signed-off-by: Joonwoo Park<[email protected]> > >--- > > elements/linuxmodule/fromhost.cc | 17 +++++++++++++++++ > > 1 files changed, 17 insertions(+), 0 deletions(-) > > > >diff --git a/elements/linuxmodule/fromhost.cc > >b/elements/linuxmodule/fromhost.cc > >index 8c26fc5..9062098 100644 > >--- a/elements/linuxmodule/fromhost.cc > >+++ b/elements/linuxmodule/fromhost.cc > >@@ -134,12 +134,21 @@ FromHost::new_device(const char *name) > > #if LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 0) > > setup(dev); > > #endif > >+#if LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 32) > > dev->open = fl_open; > > dev->stop = fl_close; > > dev->hard_start_xmit = fl_tx; > > dev->get_stats = fl_stats; > > dev->mtu = _mtu; > > dev->tx_queue_len = 0; > >+#else > >+ ((struct net_device_ops*)(dev->netdev_ops))->ndo_open = fl_open; > >+ ((struct net_device_ops*)(dev->netdev_ops))->ndo_stop = fl_close; > >+ ((struct net_device_ops*)(dev->netdev_ops))->ndo_start_xmit = fl_tx; > >+ ((struct net_device_ops*)(dev->netdev_ops))->ndo_get_stats = fl_stats; > >+ dev->mtu = _mtu; > >+ dev->tx_queue_len = 0; > >+#endif > > return dev; > > } > > > >@@ -175,7 +184,11 @@ FromHost::configure(Vector<String> &conf, ErrorHandler > >*errh) > > // check for existing device > > _dev = AnyDevice::get_by_name(_devname.c_str()); > > if (_dev) { > >+#if LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 32) > > if (_dev->open != fl_open) { > >+#else > >+ if (_dev->netdev_ops->ndo_open != fl_open) { > >+#endif > > dev_put(_dev); > > _dev = 0; > > return errh->error("device '%s' already exists", _devname.c_str()); > >@@ -410,10 +423,14 @@ FromHost::fl_tx(struct sk_buff *skb, net_device *dev) > > #if HAVE_SKB_DST_DROP > > skb_dst_drop(skb); > > #else > >+#if LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 35) > > if (skb->dst) { > > dst_release(skb->dst); > > skb->dst = 0; > > } > >+#else > >+ dst_release(skb_dst(skb)); > >+#endif > > #endif > > > > Packet *p = Packet::make(skb); _______________________________________________ click mailing list [email protected] https://amsterdam.lcs.mit.edu/mailman/listinfo/click
