diff options
author | Tariq Toukan <tariqt@mellanox.com> | 2020-08-26 15:54:16 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-08-27 01:55:53 +0300 |
commit | f468f21b7af0fa472ff8ff70f10b9b4995ef7eb3 (patch) | |
tree | 28a881ee0878c42efa3e4eb0aa55b75000c2f6d2 /include/linux/netdevice.h | |
parent | 04e006b483c8bcab9033c9610cff9cef5e730758 (diff) | |
download | linux-f468f21b7af0fa472ff8ff70f10b9b4995ef7eb3.tar.xz |
net: Take common prefetch code structure into a function
Many device drivers use the same prefetch code structure to
deal with small L1 cacheline size.
Take this code into a function and call it from the drivers.
Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b0e303f6603f..b8abe1d7aa0b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2193,6 +2193,22 @@ int netdev_get_num_tc(struct net_device *dev) return dev->num_tc; } +static inline void net_prefetch(void *p) +{ + prefetch(p); +#if L1_CACHE_BYTES < 128 + prefetch((u8 *)p + L1_CACHE_BYTES); +#endif +} + +static inline void net_prefetchw(void *p) +{ + prefetchw(p); +#if L1_CACHE_BYTES < 128 + prefetchw((u8 *)p + L1_CACHE_BYTES); +#endif +} + void netdev_unbind_sb_channel(struct net_device *dev, struct net_device *sb_dev); int netdev_bind_sb_channel_queue(struct net_device *dev, |