From: Amir Vadai <amir@vadai.me>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
John Fastabend <john.r.fastabend@intel.com>,
Jiri Pirko <jiri@mellanox.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>,
Hadar Har-Zion <hadarh@mellanox.com>,
Rony Efraim <ronye@mellanox.com>, Amir Vadai <amir@vadai.me>
Subject: [PATCH net-next V1 10/10] net/mlx5e: Support offload cls_flower with skbedit mark action
Date: Thu, 3 Mar 2016 11:23:26 +0200 [thread overview]
Message-ID: <1456997006-18538-11-git-send-email-amir@vadai.me> (raw)
In-Reply-To: <1456997006-18538-1-git-send-email-amir@vadai.me>
Introduce offloading of skbedit mark action.
For example, to mark with 0x1234, all TCP (ip_proto 6) packets arriving
to interface ens9:
# tc qdisc add dev ens9 ingress
# tc filter add dev ens9 protocol ip parent ffff: \
flower ip_proto 6 \
indev ens9 \
action skbedit mark 0x1234
Signed-off-by: Amir Vadai <amir@vadai.me>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 3 +++
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 2 ++
3 files changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 519a07f..f293afe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -35,6 +35,7 @@
#include <linux/tcp.h>
#include <net/busy_poll.h>
#include "en.h"
+#include "en_tc.h"
static inline bool mlx5e_rx_hw_stamp(struct mlx5e_tstamp *tstamp)
{
@@ -224,6 +225,8 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
if (cqe_has_vlan(cqe))
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
be16_to_cpu(cqe->vlan_info));
+
+ skb->mark = be32_to_cpu(cqe->sop_drop_qpn) & MLX5E_TC_FLOW_ID_MASK;
}
int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 3aea5da..544c739 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -33,6 +33,7 @@
#include <net/flow_dissector.h>
#include <net/pkt_cls.h>
#include <net/tc_act/tc_gact.h>
+#include <net/tc_act/tc_skbedit.h>
#include <linux/mlx5/fs.h>
#include <linux/mlx5/device.h>
#include <linux/rhashtable.h>
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
index 70642f4..d677428 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
@@ -33,6 +33,8 @@
#ifndef __MLX5_EN_TC_H__
#define __MLX5_EN_TC_H__
+#define MLX5E_TC_FLOW_ID_MASK 0x0000ffff
+
int mlx5e_tc_init(struct mlx5e_priv *priv);
void mlx5e_tc_cleanup(struct mlx5e_priv *priv);
--
2.7.0
prev parent reply other threads:[~2016-03-03 9:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 9:23 [PATCH net-next V1 00/10] cls_flower hardware offload support Amir Vadai
2016-03-03 9:23 ` [PATCH net-next V1 01/10] net/flower: Introduce " Amir Vadai
2016-03-03 9:40 ` Jiri Pirko
2016-03-03 9:23 ` [PATCH net-next V1 02/10] net/flow_dissector: Make dissector_uses_key() and skb_flow_dissector_target() public Amir Vadai
2016-03-03 9:40 ` Jiri Pirko
2016-03-03 9:23 ` [PATCH net-next V1 03/10] net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef Amir Vadai
2016-03-03 9:38 ` Jiri Pirko
2016-03-03 9:23 ` [PATCH net-next V1 04/10] net/act_skbedit: Utility functions for mark action Amir Vadai
2016-03-03 9:40 ` Jiri Pirko
2016-03-03 9:23 ` [PATCH net-next V1 05/10] net/mlx5_core: Set flow steering dest only for forward rules Amir Vadai
2016-03-03 9:23 ` [PATCH net-next V1 06/10] net/mlx5e: Relax ndo_setup_tc handle restriction Amir Vadai
2016-03-03 9:23 ` [PATCH net-next V1 07/10] net/mlx5e: Add a new priority for kernel flow tables Amir Vadai
2016-03-03 9:23 ` [PATCH net-next V1 08/10] net/mlx5e: Introduce tc offload support Amir Vadai
2016-03-03 9:23 ` [PATCH net-next V1 09/10] net/mlx5e: Support offload cls_flower with drop action Amir Vadai
2016-03-03 9:23 ` Amir Vadai [this message]
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=1456997006-18538-11-git-send-email-amir@vadai.me \
--to=amir@vadai.me \
--cc=davem@davemloft.net \
--cc=hadarh@mellanox.com \
--cc=jiri@mellanox.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=ronye@mellanox.com \
--cc=saeedm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).