get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/813282/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 813282,
    "url": "http://patchwork.ozlabs.org/api/patches/813282/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/150529676456.57063.7605464456122745976.stgit@anamdev.jf.intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<150529676456.57063.7605464456122745976.stgit@anamdev.jf.intel.com>",
    "list_archive_url": null,
    "date": "2017-09-13T09:59:24",
    "name": "[RFC,v3,2/7] sched: act_mirred: Traffic class option for mirror/redirect action",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "adf6df85f453b3bd5b937cca0633c090579df103",
    "submitter": {
        "id": 68504,
        "url": "http://patchwork.ozlabs.org/api/people/68504/?format=api",
        "name": "Nambiar, Amritha",
        "email": "amritha.nambiar@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/150529676456.57063.7605464456122745976.stgit@anamdev.jf.intel.com/mbox/",
    "series": [
        {
            "id": 2860,
            "url": "http://patchwork.ozlabs.org/api/series/2860/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=2860",
            "date": "2017-09-13T09:59:13",
            "name": "tc-flower based cloud filters in i40e",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/2860/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813282/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813282/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.136; helo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xscc80NNVz9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 20:00:39 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 7147630B6F;\n\tWed, 13 Sep 2017 10:00:38 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id nXyUwGIVNe4j; Wed, 13 Sep 2017 10:00:36 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 0F5512DA33;\n\tWed, 13 Sep 2017 10:00:36 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5DC5D1C0BE0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Sep 2017 10:00:35 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 56B9A25C3C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Sep 2017 10:00:35 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id gWgUChf2+Ea6 for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Sep 2017 10:00:32 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 33A9E30B7D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Sep 2017 10:00:32 +0000 (UTC)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga105.jf.intel.com with ESMTP; 13 Sep 2017 03:00:32 -0700",
            "from anamdev.jf.intel.com ([10.166.29.110])\n\tby orsmga002.jf.intel.com with ESMTP; 13 Sep 2017 03:00:31 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.42,387,1500966000\"; d=\"scan'208\";a=\"134844417\"",
        "From": "Amritha Nambiar <amritha.nambiar@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com",
        "Date": "Wed, 13 Sep 2017 02:59:24 -0700",
        "Message-ID": "<150529676456.57063.7605464456122745976.stgit@anamdev.jf.intel.com>",
        "In-Reply-To": "<150529632024.57063.15338545678487601430.stgit@anamdev.jf.intel.com>",
        "References": "<150529632024.57063.15338545678487601430.stgit@anamdev.jf.intel.com>",
        "User-Agent": "StGit/0.17.1-dirty",
        "MIME-Version": "1.0",
        "Cc": "netdev@vger.kernel.org",
        "Subject": "[Intel-wired-lan] [RFC PATCH v3 2/7] sched: act_mirred: Traffic\n\tclass option for mirror/redirect action",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "Adds optional traffic class parameter to the mirror/redirect action.\nThe mirror/redirect action is extended to forward to a traffic\nclass on the device if the traffic class index is provided in\naddition to the device's ifindex.\n\nExample:\n# tc filter add dev eth0 protocol ip parent ffff: prio 1 flower\\\n  dst_ip 192.168.1.1/32 ip_proto udp dst_port 22\\\n  skip_sw action mirred ingress redirect dev eth0 tclass 1\n\nv2: Introduced is_tcf_mirred_tc() helper function to check if\nthe rule is supported in current offloaders. Removed the\nadditional definitions for max number of TCs and its bitmask\nand replaced their usages with existing defines in linux/netdevice.h.\n\nSigned-off-by: Amritha Nambiar <amritha.nambiar@intel.com>\n---\n drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c  |    2 +-\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c      |    2 +-\n drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |    2 +-\n drivers/net/ethernet/mellanox/mlxsw/spectrum.c     |    3 ++-\n .../net/ethernet/mellanox/mlxsw/spectrum_flower.c  |    3 ++-\n drivers/net/ethernet/netronome/nfp/bpf/offload.c   |    1 +\n drivers/net/ethernet/netronome/nfp/flower/action.c |    4 ++--\n include/net/tc_act/tc_mirred.h                     |   16 ++++++++++++++++\n include/uapi/linux/tc_act/tc_mirred.h              |    3 +++\n net/dsa/slave.c                                    |    3 ++-\n net/sched/act_mirred.c                             |   15 +++++++++++++++\n 11 files changed, 46 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c\nindex 48970ba..54a7004 100644\n--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c\n+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c\n@@ -113,7 +113,7 @@ static int fill_action_fields(struct adapter *adap,\n \t\t}\n \n \t\t/* Re-direct to specified port in hardware. */\n-\t\tif (is_tcf_mirred_egress_redirect(a)) {\n+\t\tif (is_tcf_mirred_egress_redirect(a) && !is_tcf_mirred_tc(a)) {\n \t\t\tstruct net_device *n_dev;\n \t\t\tunsigned int i, index;\n \t\t\tbool found = false;\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 3d3739f..b46d45d 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -8999,7 +8999,7 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter,\n \t\t}\n \n \t\t/* Redirect to a VF or a offloaded macvlan */\n-\t\tif (is_tcf_mirred_egress_redirect(a)) {\n+\t\tif (is_tcf_mirred_egress_redirect(a) && !is_tcf_mirred_tc(a)) {\n \t\t\tint ifindex = tcf_mirred_ifindex(a);\n \n \t\t\terr = handle_redirect_action(adapter, ifindex, queue,\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c\nindex da503e6..f2352a0 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c\n@@ -1869,7 +1869,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,\n \t\t\treturn -EOPNOTSUPP;\n \t\t}\n \n-\t\tif (is_tcf_mirred_egress_redirect(a)) {\n+\t\tif (is_tcf_mirred_egress_redirect(a) && !is_tcf_mirred_tc(a)) {\n \t\t\tint ifindex = tcf_mirred_ifindex(a);\n \t\t\tstruct net_device *out_dev, *encap_dev = NULL;\n \t\t\tstruct mlx5e_priv *out_priv;\ndiff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c\nindex ed7cd6c..5ec56f4 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c\n@@ -1641,7 +1641,8 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,\n \ttcf_exts_to_list(f->exts, &actions);\n \ta = list_first_entry(&actions, struct tc_action, list);\n \n-\tif (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) {\n+\tif (is_tcf_mirred_egress_mirror(a) && !is_tcf_mirred_tc(a) &&\n+\t    protocol == htons(ETH_P_ALL)) {\n \t\tstruct mlxsw_sp_port_mall_mirror_tc_entry *mirror;\n \n \t\tmall_tc_entry->type = MLXSW_SP_PORT_MALL_MIRROR;\ndiff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c\nindex 8aace9a..88403a1 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c\n@@ -85,7 +85,8 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,\n \n \t\t\tgroup_id = mlxsw_sp_acl_ruleset_group_id(ruleset);\n \t\t\tmlxsw_sp_acl_rulei_act_jump(rulei, group_id);\n-\t\t} else if (is_tcf_mirred_egress_redirect(a)) {\n+\t\t} else if (is_tcf_mirred_egress_redirect(a) &&\n+\t\t\t   !is_tcf_mirred_tc(a)) {\n \t\t\tint ifindex = tcf_mirred_ifindex(a);\n \t\t\tstruct net_device *out_dev;\n \t\t\tstruct mlxsw_sp_fid *fid;\ndiff --git a/drivers/net/ethernet/netronome/nfp/bpf/offload.c b/drivers/net/ethernet/netronome/nfp/bpf/offload.c\nindex a88bb5b..3b00d4b 100644\n--- a/drivers/net/ethernet/netronome/nfp/bpf/offload.c\n+++ b/drivers/net/ethernet/netronome/nfp/bpf/offload.c\n@@ -131,6 +131,7 @@ nfp_net_bpf_get_act(struct nfp_net *nn, struct tc_cls_bpf_offload *cls_bpf)\n \t\t\treturn NN_ACT_TC_DROP;\n \n \t\tif (is_tcf_mirred_egress_redirect(a) &&\n+\t\t    !is_tcf_mirred_tc(a) &&\n \t\t    tcf_mirred_ifindex(a) == nn->dp.netdev->ifindex)\n \t\t\treturn NN_ACT_TC_REDIR;\n \t}\ndiff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c\nindex db97506..7ceeaa9 100644\n--- a/drivers/net/ethernet/netronome/nfp/flower/action.c\n+++ b/drivers/net/ethernet/netronome/nfp/flower/action.c\n@@ -132,7 +132,7 @@ nfp_flower_loop_action(const struct tc_action *a,\n \n \tif (is_tcf_gact_shot(a)) {\n \t\tnfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_DROP);\n-\t} else if (is_tcf_mirred_egress_redirect(a)) {\n+\t} else if (is_tcf_mirred_egress_redirect(a) && !is_tcf_mirred_tc(a)) {\n \t\tif (*a_len + sizeof(struct nfp_fl_output) > NFP_FL_MAX_A_SIZ)\n \t\t\treturn -EOPNOTSUPP;\n \n@@ -142,7 +142,7 @@ nfp_flower_loop_action(const struct tc_action *a,\n \t\t\treturn err;\n \n \t\t*a_len += sizeof(struct nfp_fl_output);\n-\t} else if (is_tcf_mirred_egress_mirror(a)) {\n+\t} else if (is_tcf_mirred_egress_mirror(a) && !is_tcf_mirred_tc(a)) {\n \t\tif (*a_len + sizeof(struct nfp_fl_output) > NFP_FL_MAX_A_SIZ)\n \t\t\treturn -EOPNOTSUPP;\n \ndiff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h\nindex 604bc31..59cb935 100644\n--- a/include/net/tc_act/tc_mirred.h\n+++ b/include/net/tc_act/tc_mirred.h\n@@ -9,6 +9,8 @@ struct tcf_mirred {\n \tint\t\t\ttcfm_eaction;\n \tint\t\t\ttcfm_ifindex;\n \tbool\t\t\ttcfm_mac_header_xmit;\n+\tu8\t\t\ttcfm_tc;\n+\tu32\t\t\tflags;\n \tstruct net_device __rcu\t*tcfm_dev;\n \tstruct list_head\ttcfm_list;\n };\n@@ -37,4 +39,18 @@ static inline int tcf_mirred_ifindex(const struct tc_action *a)\n \treturn to_mirred(a)->tcfm_ifindex;\n }\n \n+static inline bool is_tcf_mirred_tc(const struct tc_action *a)\n+{\n+#ifdef CONFIG_NET_CLS_ACT\n+\tif (a->ops && a->ops->type == TCA_ACT_MIRRED)\n+\t\treturn to_mirred(a)->flags == MIRRED_F_TCLASS;\n+#endif\n+\treturn false;\n+}\n+\n+static inline u8 tcf_mirred_tc(const struct tc_action *a)\n+{\n+\treturn to_mirred(a)->tcfm_tc;\n+}\n+\n #endif /* __NET_TC_MIR_H */\ndiff --git a/include/uapi/linux/tc_act/tc_mirred.h b/include/uapi/linux/tc_act/tc_mirred.h\nindex 69038c2..12f1767 100644\n--- a/include/uapi/linux/tc_act/tc_mirred.h\n+++ b/include/uapi/linux/tc_act/tc_mirred.h\n@@ -10,6 +10,8 @@\n #define TCA_INGRESS_REDIR 3  /* packet redirect to INGRESS*/\n #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */\n \n+#define MIRRED_F_TCLASS\t0x1\n+\n struct tc_mirred {\n \ttc_gen;\n \tint                     eaction;   /* one of IN/EGRESS_MIRROR/REDIR */\n@@ -21,6 +23,7 @@ enum {\n \tTCA_MIRRED_TM,\n \tTCA_MIRRED_PARMS,\n \tTCA_MIRRED_PAD,\n+\tTCA_MIRRED_TCLASS,\n \t__TCA_MIRRED_MAX\n };\n #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1)\ndiff --git a/net/dsa/slave.c b/net/dsa/slave.c\nindex 2afa995..c0c2b1c 100644\n--- a/net/dsa/slave.c\n+++ b/net/dsa/slave.c\n@@ -846,7 +846,8 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev,\n \ttcf_exts_to_list(cls->exts, &actions);\n \ta = list_first_entry(&actions, struct tc_action, list);\n \n-\tif (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) {\n+\tif (is_tcf_mirred_egress_mirror(a) && !is_tcf_mirred_tc(a) &&\n+\t    protocol == htons(ETH_P_ALL)) {\n \t\tstruct dsa_mall_mirror_tc_entry *mirror;\n \n \t\tifindex = tcf_mirred_ifindex(a);\ndiff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c\nindex 416627c..6938804 100644\n--- a/net/sched/act_mirred.c\n+++ b/net/sched/act_mirred.c\n@@ -66,6 +66,7 @@ static void tcf_mirred_release(struct tc_action *a, int bind)\n \n static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = {\n \t[TCA_MIRRED_PARMS]\t= { .len = sizeof(struct tc_mirred) },\n+\t[TCA_MIRRED_TCLASS]\t= { .type = NLA_U8 },\n };\n \n static unsigned int mirred_net_id;\n@@ -82,6 +83,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,\n \tstruct tcf_mirred *m;\n \tstruct net_device *dev;\n \tbool exists = false;\n+\tu8 *tclass = NULL;\n+\tu32 flags = 0;\n \tint ret;\n \n \tif (nla == NULL)\n@@ -91,6 +94,12 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,\n \t\treturn ret;\n \tif (tb[TCA_MIRRED_PARMS] == NULL)\n \t\treturn -EINVAL;\n+\tif (tb[TCA_MIRRED_TCLASS]) {\n+\t\ttclass = nla_data(tb[TCA_MIRRED_TCLASS]);\n+\t\tif (*tclass >= TC_MAX_QUEUE)\n+\t\t\treturn -EINVAL;\n+\t\tflags |= MIRRED_F_TCLASS;\n+\t}\n \tparm = nla_data(tb[TCA_MIRRED_PARMS]);\n \n \texists = tcf_idr_check(tn, parm->index, a, bind);\n@@ -138,6 +147,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,\n \tASSERT_RTNL();\n \tm->tcf_action = parm->action;\n \tm->tcfm_eaction = parm->eaction;\n+\tm->flags = flags;\n \tif (dev != NULL) {\n \t\tm->tcfm_ifindex = parm->ifindex;\n \t\tif (ret != ACT_P_CREATED)\n@@ -145,6 +155,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,\n \t\tdev_hold(dev);\n \t\trcu_assign_pointer(m->tcfm_dev, dev);\n \t\tm->tcfm_mac_header_xmit = mac_header_xmit;\n+\t\tif (flags & MIRRED_F_TCLASS)\n+\t\t\tm->tcfm_tc = *tclass & TC_BITMASK;\n \t}\n \n \tif (ret == ACT_P_CREATED) {\n@@ -258,6 +270,9 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,\n \n \tif (nla_put(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt))\n \t\tgoto nla_put_failure;\n+\tif ((m->flags & MIRRED_F_TCLASS) &&\n+\t    nla_put_u8(skb, TCA_MIRRED_TCLASS, m->tcfm_tc))\n+\t\tgoto nla_put_failure;\n \n \ttcf_tm_dump(&t, &m->tcf_tm);\n \tif (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD))\n",
    "prefixes": [
        "RFC",
        "v3",
        "2/7"
    ]
}