From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) by dpdk.org (Postfix) with ESMTP id 1F11A1BABC for ; Thu, 5 Apr 2018 01:56:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=7788; q=dns/txt; s=iport; t=1522886217; x=1524095817; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=WY+4prHNal5rx+M9uW0sJhEvtH0WfY0Gz8N0NZE5NVo=; b=MvMGZJxXRWNM6Fy1esHyxJTFH0dDRwL1ak0XQcjdVUBdDPFfXGIjkS7s WCYN+JCMAIanJKdfZqyPLZbrhYhEMD9t2yaTV7xHcKKTLW8xMsKd7pWQG OBTKzAQr81309a9PKk3VCPGmntNL2v5HVZTCuNZTxnGcMXcKdxacqlFRI Y=; X-IronPort-AV: E=Sophos;i="5.48,409,1517875200"; d="scan'208";a="376614551" Received: from rcdn-core-8.cisco.com ([173.37.93.144]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 23:56:56 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-8.cisco.com (8.14.5/8.14.5) with ESMTP id w34NuuOg013045; Wed, 4 Apr 2018 23:56:56 GMT Received: by cisco.com (Postfix, from userid 392789) id 183DA20F2001; Wed, 4 Apr 2018 16:56:56 -0700 (PDT) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Wed, 4 Apr 2018 16:54:54 -0700 Message-Id: <20180404235455.17241-5-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180404235455.17241-1-johndale@cisco.com> References: <20180404235455.17241-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH] net/enic: support the drop flow action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 23:56:57 -0000 From: Hyong Youb Kim 1330 and 1400 series adapters support the drop action. Check for its availability and set the necessary flag when creating NIC filters. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- doc/guides/nics/enic.rst | 2 +- drivers/net/enic/base/vnic_dev.c | 14 +++++--------- drivers/net/enic/base/vnic_dev.h | 2 +- drivers/net/enic/base/vnic_devcmd.h | 2 ++ drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_flow.c | 34 +++++++++++++++++++++++++++------- drivers/net/enic/enic_res.c | 11 ++++++++--- 7 files changed, 45 insertions(+), 22 deletions(-) diff --git a/doc/guides/nics/enic.rst b/doc/guides/nics/enic.rst index d02a69829..df3718ecd 100644 --- a/doc/guides/nics/enic.rst +++ b/doc/guides/nics/enic.rst @@ -251,7 +251,7 @@ Generic Flow API is supported. The baseline support is: - Attributes: ingress - Items: eth, ipv4, ipv6, udp, tcp, vxlan, inner eth, ipv4, ipv6, udp, tcp - - Actions: queue, mark, flag and void + - Actions: queue, mark, drop, flag and void - Selectors: 'is', 'spec' and 'mask'. 'last' is not supported - In total, up to 64 bytes of mask is allowed across all headers diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c index 1d6734dc1..8880ab981 100644 --- a/drivers/net/enic/base/vnic_dev.c +++ b/drivers/net/enic/base/vnic_dev.c @@ -485,7 +485,7 @@ int vnic_dev_capable_adv_filters(struct vnic_dev *vdev) * Retrun true in filter_tags if supported */ int vnic_dev_capable_filter_mode(struct vnic_dev *vdev, u32 *mode, - u8 *filter_tags) + u8 *filter_actions) { u64 args[4]; int err; @@ -493,14 +493,10 @@ int vnic_dev_capable_filter_mode(struct vnic_dev *vdev, u32 *mode, err = vnic_dev_advanced_filters_cap(vdev, args, 4); - /* determine if filter tags are available */ - if (err) - *filter_tags = 0; - if ((args[2] == FILTER_CAP_MODE_V1) && - (args[3] & FILTER_ACTION_FILTER_ID_FLAG)) - *filter_tags = 1; - else - *filter_tags = 0; + /* determine supported filter actions */ + *filter_actions = FILTER_ACTION_RQ_STEERING_FLAG; /* always available */ + if (args[2] == FILTER_CAP_MODE_V1) + *filter_actions = args[3]; if (err || ((args[0] == 1) && (args[1] == 0))) { /* Adv filter Command not supported or adv filters available but diff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h index 62c09fa86..e7a1f8bd8 100644 --- a/drivers/net/enic/base/vnic_dev.h +++ b/drivers/net/enic/base/vnic_dev.h @@ -108,7 +108,7 @@ int vnic_dev_fw_info(struct vnic_dev *vdev, int vnic_dev_capable_adv_filters(struct vnic_dev *vdev); int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd); int vnic_dev_capable_filter_mode(struct vnic_dev *vdev, u32 *mode, - u8 *filter_tags); + u8 *filter_actions); int vnic_dev_capable_udp_rss(struct vnic_dev *vdev); int vnic_dev_asic_info(struct vnic_dev *vdev, u16 *asic_type, u16 *asic_rev); int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, size_t size, diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h index d09113dac..2865eb4d4 100644 --- a/drivers/net/enic/base/vnic_devcmd.h +++ b/drivers/net/enic/base/vnic_devcmd.h @@ -841,7 +841,9 @@ struct filter_action { #define FILTER_ACTION_RQ_STEERING_FLAG (1 << 0) #define FILTER_ACTION_FILTER_ID_FLAG (1 << 1) +#define FILTER_ACTION_DROP_FLAG (1 << 2) #define FILTER_ACTION_V2_ALL (FILTER_ACTION_RQ_STEERING_FLAG \ + | FILTER_ACTION_DROP_FLAG \ | FILTER_ACTION_FILTER_ID_FLAG) /* Version 2 of filter action must be a strict extension of struct filter_action diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 9d69d1e9e..e4936ec13 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -119,7 +119,7 @@ struct enic { u16 max_mtu; u8 adv_filters; u32 flow_filter_mode; - u8 filter_tags; + u8 filter_actions; /* HW supported actions */ u8 vxlan; unsigned int flags; diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 28923b0e2..b9f36587c 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -273,21 +273,33 @@ static const enum rte_flow_action_type enic_supported_actions_v1[] = { }; /** Supported actions for newer NICs */ -static const enum rte_flow_action_type enic_supported_actions_v2[] = { +static const enum rte_flow_action_type enic_supported_actions_v2_id[] = { RTE_FLOW_ACTION_TYPE_QUEUE, RTE_FLOW_ACTION_TYPE_MARK, RTE_FLOW_ACTION_TYPE_FLAG, RTE_FLOW_ACTION_TYPE_END, }; +static const enum rte_flow_action_type enic_supported_actions_v2_drop[] = { + RTE_FLOW_ACTION_TYPE_QUEUE, + RTE_FLOW_ACTION_TYPE_MARK, + RTE_FLOW_ACTION_TYPE_FLAG, + RTE_FLOW_ACTION_TYPE_DROP, + RTE_FLOW_ACTION_TYPE_END, +}; + /** Action capabilities indexed by NIC version information */ static const struct enic_action_cap enic_action_cap[] = { [FILTER_ACTION_RQ_STEERING_FLAG] = { .actions = enic_supported_actions_v1, .copy_fn = enic_copy_action_v1, }, - [FILTER_ACTION_V2_ALL] = { - .actions = enic_supported_actions_v2, + [FILTER_ACTION_FILTER_ID_FLAG] = { + .actions = enic_supported_actions_v2_id, + .copy_fn = enic_copy_action_v2, + }, + [FILTER_ACTION_DROP_FLAG] = { + .actions = enic_supported_actions_v2_drop, .copy_fn = enic_copy_action_v2, }, }; @@ -1021,6 +1033,10 @@ enic_copy_action_v2(const struct rte_flow_action actions[], enic_action->flags |= FILTER_ACTION_FILTER_ID_FLAG; break; } + case RTE_FLOW_ACTION_TYPE_DROP: { + enic_action->flags |= FILTER_ACTION_DROP_FLAG; + break; + } case RTE_FLOW_ACTION_TYPE_VOID: continue; default: @@ -1059,10 +1075,14 @@ enic_get_filter_cap(struct enic *enic) static const struct enic_action_cap * enic_get_action_cap(struct enic *enic) { - static const struct enic_action_cap *ea; - - if (enic->filter_tags) - ea = &enic_action_cap[FILTER_ACTION_V2_ALL]; + const struct enic_action_cap *ea; + uint8_t actions; + + actions = enic->filter_actions; + if (actions & FILTER_ACTION_DROP_FLAG) + ea = &enic_action_cap[FILTER_ACTION_DROP_FLAG]; + else if (actions & FILTER_ACTION_FILTER_ID_FLAG) + ea = &enic_action_cap[FILTER_ACTION_FILTER_ID_FLAG]; else ea = &enic_action_cap[FILTER_ACTION_RQ_STEERING_FLAG]; return ea; diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c index 34532720c..de17a31d0 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -76,19 +76,24 @@ int enic_get_vnic_config(struct enic *enic) ? "" : "not ")); err = vnic_dev_capable_filter_mode(enic->vdev, &enic->flow_filter_mode, - &enic->filter_tags); + &enic->filter_actions); if (err) { dev_err(enic_get_dev(enic), "Error getting filter modes, %d\n", err); return err; } - dev_info(enic, "Flow api filter mode: %s, Filter tagging %savailable\n", + dev_info(enic, "Flow api filter mode: %s Actions: %s%s%s\n", ((enic->flow_filter_mode == FILTER_DPDK_1) ? "DPDK" : ((enic->flow_filter_mode == FILTER_USNIC_IP) ? "USNIC" : ((enic->flow_filter_mode == FILTER_IPV4_5TUPLE) ? "5TUPLE" : "NONE"))), - ((enic->filter_tags) ? "" : "not ")); + ((enic->filter_actions & FILTER_ACTION_RQ_STEERING_FLAG) ? + "steer " : ""), + ((enic->filter_actions & FILTER_ACTION_FILTER_ID_FLAG) ? + "tag " : ""), + ((enic->filter_actions & FILTER_ACTION_DROP_FLAG) ? + "drop " : "")); c->wq_desc_count = min_t(u32, ENIC_MAX_WQ_DESCS, -- 2.16.2