All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	John Hurley <john.hurley@netronome.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Jay Vosburgh <j.vosburgh@gmail.com>,
	Veaceslav Falico <vfalico@gmail.com>,
	Andy Gospodarek <andy@greyhouse.net>
Subject: [PATCH net-next 5/8] net: include hash policy in LAG changeupper info
Date: Wed, 23 May 2018 19:22:52 -0700	[thread overview]
Message-ID: <20180524022255.18548-6-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180524022255.18548-1-jakub.kicinski@netronome.com>

From: John Hurley <john.hurley@netronome.com>

LAG upper event notifiers contain the tx type used by the LAG device.
Extend this to also include the hash policy used for tx types that
utilize hashing.

Signed-off-by: John Hurley <john.hurley@netronome.com>
---
CC: Jiri Pirko <jiri@resnulli.us>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>

 drivers/net/bonding/bond_main.c | 27 ++++++++++++++++++++++++++-
 drivers/net/team/team.c         |  1 +
 include/linux/netdevice.h       | 11 +++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index fea17b92b1ae..bd53a71f6b00 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1218,12 +1218,37 @@ static enum netdev_lag_tx_type bond_lag_tx_type(struct bonding *bond)
 	}
 }
 
+static enum netdev_lag_hash bond_lag_hash_type(struct bonding *bond,
+					       enum netdev_lag_tx_type type)
+{
+	if (type != NETDEV_LAG_TX_TYPE_HASH)
+		return NETDEV_LAG_HASH_NONE;
+
+	switch (bond->params.xmit_policy) {
+	case BOND_XMIT_POLICY_LAYER2:
+		return NETDEV_LAG_HASH_L2;
+	case BOND_XMIT_POLICY_LAYER34:
+		return NETDEV_LAG_HASH_L34;
+	case BOND_XMIT_POLICY_LAYER23:
+		return NETDEV_LAG_HASH_L23;
+	case BOND_XMIT_POLICY_ENCAP23:
+		return NETDEV_LAG_HASH_E23;
+	case BOND_XMIT_POLICY_ENCAP34:
+		return NETDEV_LAG_HASH_E34;
+	default:
+		return NETDEV_LAG_HASH_UNKNOWN;
+	}
+}
+
 static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave,
 				      struct netlink_ext_ack *extack)
 {
 	struct netdev_lag_upper_info lag_upper_info;
+	enum netdev_lag_tx_type type;
 
-	lag_upper_info.tx_type = bond_lag_tx_type(bond);
+	type = bond_lag_tx_type(bond);
+	lag_upper_info.tx_type = type;
+	lag_upper_info.hash_type = bond_lag_hash_type(bond, type);
 
 	return netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
 					    &lag_upper_info, extack);
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index d6ff881165d0..e6730a01d130 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1129,6 +1129,7 @@ static int team_upper_dev_link(struct team *team, struct team_port *port,
 	int err;
 
 	lag_upper_info.tx_type = team->mode->lag_tx_type;
+	lag_upper_info.hash_type = NETDEV_LAG_HASH_UNKNOWN;
 	err = netdev_master_upper_dev_link(port->dev, team->dev, NULL,
 					   &lag_upper_info, extack);
 	if (err)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 03ed492c4e14..e97ba5e885a0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2328,8 +2328,19 @@ enum netdev_lag_tx_type {
 	NETDEV_LAG_TX_TYPE_HASH,
 };
 
+enum netdev_lag_hash {
+	NETDEV_LAG_HASH_NONE,
+	NETDEV_LAG_HASH_L2,
+	NETDEV_LAG_HASH_L34,
+	NETDEV_LAG_HASH_L23,
+	NETDEV_LAG_HASH_E23,
+	NETDEV_LAG_HASH_E34,
+	NETDEV_LAG_HASH_UNKNOWN,
+};
+
 struct netdev_lag_upper_info {
 	enum netdev_lag_tx_type tx_type;
+	enum netdev_lag_hash hash_type;
 };
 
 struct netdev_lag_lower_state_info {
-- 
2.17.0

  parent reply	other threads:[~2018-05-24  2:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  2:22 [PATCH net-next 0/8] nfp: offload LAG for tc flower egress Jakub Kicinski
2018-05-24  2:22 ` [PATCH net-next 1/8] nfp: add ndo_set_mac_address for representors Jakub Kicinski
2018-05-24  2:22 ` [PATCH net-next 2/8] nfp: nfpcore: add rtsym writing function Jakub Kicinski
2018-05-24  2:22 ` [PATCH net-next 3/8] nfp: flower: check for/turn on LAG support in firmware Jakub Kicinski
2018-05-24  2:22 ` [PATCH net-next 4/8] nfp: flower: add per repr private data for LAG offload Jakub Kicinski
2018-05-24  2:22 ` Jakub Kicinski [this message]
2018-05-24  2:22 ` [PATCH net-next 6/8] nfp: flower: monitor and offload LAG groups Jakub Kicinski
2018-05-24  2:22 ` [PATCH net-next 7/8] nfp: flower: implement host cmsg handler for LAG Jakub Kicinski
2018-05-24  2:22 ` [PATCH net-next 8/8] nfp: flower: compute link aggregation action Jakub Kicinski
2018-05-24 17:09   ` Or Gerlitz
2018-05-24 17:36     ` John Hurley
2018-05-24 17:04 ` [PATCH net-next 0/8] nfp: offload LAG for tc flower egress Or Gerlitz
2018-05-24 18:23   ` Samudrala, Sridhar
2018-05-24 18:53     ` Jakub Kicinski
2018-05-24 18:49   ` Jakub Kicinski
2018-05-24 19:26     ` Or Gerlitz
2018-05-24 22:01       ` Jakub Kicinski
2018-05-25  3:11 ` David Miller
2018-05-25  6:48 ` Jiri Pirko
2018-05-26  2:47   ` Jakub Kicinski
2018-05-29 14:08     ` John Hurley
2018-05-29 22:09       ` Jiri Pirko
2018-05-30  9:26         ` John Hurley
2018-05-30 20:29           ` Jiri Pirko
2018-05-31 10:20             ` John Hurley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180524022255.18548-6-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=j.vosburgh@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=john.hurley@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=vfalico@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.