summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-11-16 15:59:19 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-16 15:59:19 -0500
commit65622ed40eef5ce2732365077b22416593fec4c8 (patch)
tree3feae5512b57c55e708107e6c191fd5d611d17f9 /include
parentca245024349c0d44434a6381583b99f0eb559c7c (diff)
parent6bf79cdddd50e90cbba7471623c129dadf9c873b (diff)
downloadcachepc-linux-65622ed40eef5ce2732365077b22416593fec4c8.tar.gz
cachepc-linux-65622ed40eef5ce2732365077b22416593fec4c8.zip
Merge branch 'rss_key_fill'
Eric Dumazet says: ==================== net: provide common RSS key infrastructure RSS (Receive Side Scaling) uses a 40 bytes key to provide hash for incoming packets to select appropriate incoming queue on NIC. Hash algo (Toeplitz) is also well known and documented by Microsoft (search for "Verifying the RSS Hash Calculation") Problem is that some drivers use a well known key. It makes very easy for attackers to target one particular RX queue, knowing that number of RX queues is a power of two, or at least some small number. Other drivers use a random value per port, making difficult tuning on bonding setups. Lets add a common infrastructure, so that host gets an unique RSS key, and drivers do not have to worry about this. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mlx4/qp.h4
-rw-r--r--include/linux/netdevice.h6
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 5f4e36cf0091..467ccdf94c98 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -120,13 +120,15 @@ enum {
MLX4_RSS_QPC_FLAG_OFFSET = 13,
};
+#define MLX4_EN_RSS_KEY_SIZE 40
+
struct mlx4_rss_context {
__be32 base_qpn;
__be32 default_qpn;
u16 reserved;
u8 hash_fn;
u8 flags;
- __be32 rss_key[10];
+ __be32 rss_key[MLX4_EN_RSS_KEY_SIZE / sizeof(__be32)];
__be32 base_qpn_udp;
};
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a6f770377d3..db63cf459ba1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3422,6 +3422,12 @@ void netdev_upper_dev_unlink(struct net_device *dev,
void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
void *netdev_lower_dev_get_private(struct net_device *dev,
struct net_device *lower_dev);
+
+/* RSS keys are 40 or 52 bytes long */
+#define NETDEV_RSS_KEY_LEN 52
+extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
+void netdev_rss_key_fill(void *buffer, size_t len);
+
int dev_get_nest_level(struct net_device *dev,
bool (*type_check)(struct net_device *dev));
int skb_checksum_help(struct sk_buff *skb);