Message ID | 49C36570.4010903@cosmosbay.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
Eric Dumazet <dada1@cosmosbay.com> writes: > [NET] net: reorder struct net_device_ops > > Moving ndo_start_xmit() field at first position in > struct net_device_ops reduce the assembly needed to compute > the prefetch() address. You can't do this while the compatibility code is still there. from net/core/dev.c:register_netdevice() : /* This works only because net_device_ops and the compatiablity structure are the same. */ dev->netdev_ops = (void *) &(dev->init); Bjørn -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Bjørn Mork a écrit : > Eric Dumazet <dada1@cosmosbay.com> writes: > >> [NET] net: reorder struct net_device_ops >> >> Moving ndo_start_xmit() field at first position in >> struct net_device_ops reduce the assembly needed to compute >> the prefetch() address. > > You can't do this while the compatibility code is still there. > > from net/core/dev.c:register_netdevice() : > > /* This works only because net_device_ops and the > compatiablity structure are the same. */ > dev->netdev_ops = (void *) &(dev->init); > > > Bjørn Nice catch ! Yes, very true, but I discarded this patch anyway, I wont correct this. Thank you -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index be3ebd7..e507c6e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -547,14 +547,14 @@ struct netdev_queue { */ #define HAVE_NET_DEVICE_OPS struct net_device_ops { - int (*ndo_init)(struct net_device *dev); - void (*ndo_uninit)(struct net_device *dev); - int (*ndo_open)(struct net_device *dev); - int (*ndo_stop)(struct net_device *dev); int (*ndo_start_xmit) (struct sk_buff *skb, struct net_device *dev); u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); + int (*ndo_init)(struct net_device *dev); + void (*ndo_uninit)(struct net_device *dev); + int (*ndo_open)(struct net_device *dev); + int (*ndo_stop)(struct net_device *dev); #define HAVE_CHANGE_RX_FLAGS void (*ndo_change_rx_flags)(struct net_device *dev, int flags); diff --git a/net/core/dev.c b/net/core/dev.c index c013031..2e5ebd0 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1670,7 +1670,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, const struct net_device_ops *ops = dev->netdev_ops; int rc; - prefetch(&dev->netdev_ops->ndo_start_xmit); + prefetch(&ops->ndo_start_xmit); if (likely(!skb->next)) { if (!list_empty(&ptype_all)) dev_queue_xmit_nit(skb, dev);