All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <aring@mojatatu.com>
To: jhs@mojatatu.com
Cc: yotamg@mellanox.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
	lucasb@mojatatu.com, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Alexander Aring <aring@mojatatu.com>
Subject: [PATCH net-next 2/3] act_ife: use registered ife_type as fallback
Date: Mon, 28 Aug 2017 15:03:14 -0400	[thread overview]
Message-ID: <20170828190315.26646-3-aring@mojatatu.com> (raw)
In-Reply-To: <20170828190315.26646-1-aring@mojatatu.com>

This patch handles a default IFE type if it's not given by user space
netlink api. The default IFE type will be the registered ethertype by
IEEE for IFE ForCES.

Signed-off-by: Alexander Aring <aring@mojatatu.com>
---
 net/sched/act_ife.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index c5dec308b8b1..7ed1be80ee86 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -435,8 +435,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 	struct nlattr *tb[TCA_IFE_MAX + 1];
 	struct nlattr *tb2[IFE_META_MAX + 1];
 	struct tcf_ife_info *ife;
+	u16 ife_type = ETH_P_IFE;
 	struct tc_ife *parm;
-	u16 ife_type = 0;
 	u8 *daddr = NULL;
 	u8 *saddr = NULL;
 	bool exists = false;
@@ -456,18 +456,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 	if (exists && bind)
 		return 0;
 
-	if (parm->flags & IFE_ENCODE) {
-		/* Until we get issued the ethertype, we cant have
-		 * a default..
-		**/
-		if (!tb[TCA_IFE_TYPE]) {
-			if (exists)
-				tcf_hash_release(*a, bind);
-			pr_info("You MUST pass etherype for encoding\n");
-			return -EINVAL;
-		}
-	}
-
 	if (!exists) {
 		ret = tcf_hash_create(tn, parm->index, est, a, &act_ife_ops,
 				      bind, false);
@@ -484,7 +472,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 	ife->flags = parm->flags;
 
 	if (parm->flags & IFE_ENCODE) {
-		ife_type = nla_get_u16(tb[TCA_IFE_TYPE]);
+		if (tb[TCA_IFE_TYPE])
+			ife_type = nla_get_u16(tb[TCA_IFE_TYPE]);
 		if (tb[TCA_IFE_DMAC])
 			daddr = nla_data(tb[TCA_IFE_DMAC]);
 		if (tb[TCA_IFE_SMAC])
-- 
2.11.0

  parent reply	other threads:[~2017-08-28 19:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 19:03 [PATCH net-next 0/3] tc: act_ife: handle IEEE IFE ethertype as default Alexander Aring
2017-08-28 19:03 ` [PATCH net-next 1/3] if_ether: add forces ife lfb type Alexander Aring
2017-08-28 22:03   ` Jamal Hadi Salim
2017-08-28 19:03 ` Alexander Aring [this message]
2017-08-28 22:14   ` [PATCH net-next 2/3] act_ife: use registered ife_type as fallback Jamal Hadi Salim
2017-08-28 19:03 ` [PATCH net-next 3/3] tc-testing: add test for testing ife type Alexander Aring
2017-08-28 22:16   ` Jamal Hadi Salim
2017-08-29 22:14 ` [PATCH net-next 0/3] tc: act_ife: handle IEEE IFE ethertype as default David Miller
2017-08-30 15:27 ` Stephen Hemminger

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=20170828190315.26646-3-aring@mojatatu.com \
    --to=aring@mojatatu.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lucasb@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yotamg@mellanox.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.