diff mbox

[RFC,4/4] bond: add new multiqueue hash policy

Message ID 20100204171241.463222870@vyatta.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger Feb. 4, 2010, 5:11 p.m. UTC
This hash policy just uses existing transmit hash used for
mulitiqueue.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
diff mbox

Patch

--- a/drivers/net/bonding/bond_main.c	2010-02-04 08:57:52.356755294 -0800
+++ b/drivers/net/bonding/bond_main.c	2010-02-04 08:57:53.036755256 -0800
@@ -190,6 +190,7 @@  const struct bond_parm_tbl xmit_hashtype
 {	"layer2",		BOND_XMIT_POLICY_LAYER2},
 {	"layer3+4",		BOND_XMIT_POLICY_LAYER34},
 {	"layer2+3",		BOND_XMIT_POLICY_LAYER23},
+{       "multiqueue",		BOND_XMIT_POLICY_MQ},
 {	NULL,			-1},
 };
 
@@ -3670,6 +3671,13 @@  static u16 bond_xmit_hash_policy_l34(con
 
 }
 
+/*
+ * Hash for the output device based on multiqueue transmit hash policy
+ */
+static u16 bond_xmit_hash_policy_mq(const struct sk_buff *skb)
+{
+	return skb_tx_hash(skb->dev, skb);
+}
 
 /*-------------------------- Device entry points ----------------------------*/
 
@@ -4350,6 +4358,9 @@  out:
 static void bond_set_xmit_hash_policy(struct bonding *bond)
 {
 	switch (bond->params.xmit_policy) {
+	case BOND_XMIT_POLICY_MQ:
+		bond->xmit_hash_policy = bond_xmit_hash_policy_mq;
+		break;
 	case BOND_XMIT_POLICY_LAYER23:
 		bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
 		break;
--- a/include/linux/if_bonding.h	2010-02-04 08:56:35.956131096 -0800
+++ b/include/linux/if_bonding.h	2010-02-04 08:57:53.036755256 -0800
@@ -87,6 +87,7 @@ 
 #define BOND_XMIT_POLICY_LAYER2		0 /* layer 2 (MAC only), default */
 #define BOND_XMIT_POLICY_LAYER34	1 /* layer 3+4 (IP ^ (TCP || UDP)) */
 #define BOND_XMIT_POLICY_LAYER23	2 /* layer 2+3 (IP ^ MAC) */
+#define BOND_XMIT_POLICY_MQ             3 /* transmit hash (multiqueue) */
 
 typedef struct ifbond {
 	__s32 bond_mode;