get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 83953,
    "url": "http://patches.dpdk.org/api/patches/83953/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201111064936.768604-14-jiawenwu@trustnetic.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20201111064936.768604-14-jiawenwu@trustnetic.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201111064936.768604-14-jiawenwu@trustnetic.com",
    "date": "2020-11-11T06:49:12",
    "name": "[v2,13/37] net/txgbe: add FDIR filter init and uninit",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e69fe98e9256e4c917a7ac486ae7f91e1fbaa618",
    "submitter": {
        "id": 1932,
        "url": "http://patches.dpdk.org/api/people/1932/?format=api",
        "name": "Jiawen Wu",
        "email": "jiawenwu@trustnetic.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201111064936.768604-14-jiawenwu@trustnetic.com/mbox/",
    "series": [
        {
            "id": 13798,
            "url": "http://patches.dpdk.org/api/series/13798/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13798",
            "date": "2020-11-11T06:49:00",
            "name": "net: add txgbe PMD part 2",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/13798/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/83953/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/83953/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2318AA09D2;\n\tWed, 11 Nov 2020 07:51:12 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CE3FC6A6F;\n\tWed, 11 Nov 2020 07:47:49 +0100 (CET)",
            "from smtpproxy21.qq.com (smtpbg702.qq.com [203.205.195.102])\n by dpdk.org (Postfix) with ESMTP id F11885AA7\n for <dev@dpdk.org>; Wed, 11 Nov 2020 07:47:40 +0100 (CET)",
            "from localhost.localdomain.com (unknown [183.129.236.74])\n by esmtp10.qq.com (ESMTP) with\n id ; Wed, 11 Nov 2020 14:47:36 +0800 (CST)"
        ],
        "X-QQ-mid": "bizesmtp27t1605077257tisqlk20",
        "X-QQ-SSF": "01400000000000C0C000B00A0000000",
        "X-QQ-FEAT": "O9RHVi+JMbLX2l1mo6gt0wvEzs4zefsoyCEOAVet9G9tEdfEO7OYDmkD24Y78\n 8oO48yF6FyQsQKSgh5HGmwl9j7bveGHkoBPdY/nLPe8I7rT45cBPjjsL167N+S/qOz+3MuJ\n seZxBZiJQRaIl+1RFzecOSGAtd8RHdqUAuOOkbelwlNA34ByARwzK1Cz398U8gW0hBenBVp\n jRKOlRFNCX6qhzvQo4/xgUEHeDXLNtcJB2yVz0DCr8H30EGJukA8AZblE4h8ooAk2CQCWmc\n ISh4GYh/cBvU03dim7oqnlCNO6qudb2R9LkTn9k2emhfG7tZuk47gM5nyVwlZVJoN3uUFFI\n yoCnLeA+mzIEC5yHjU=",
        "X-QQ-GoodBg": "2",
        "From": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "Date": "Wed, 11 Nov 2020 14:49:12 +0800",
        "Message-Id": "<20201111064936.768604-14-jiawenwu@trustnetic.com>",
        "X-Mailer": "git-send-email 2.18.4",
        "In-Reply-To": "<20201111064936.768604-1-jiawenwu@trustnetic.com>",
        "References": "<20201111064936.768604-1-jiawenwu@trustnetic.com>",
        "X-QQ-SENDSIZE": "520",
        "Feedback-ID": "bizesmtp:trustnetic.com:qybgforeign:qybgforeign7",
        "X-QQ-Bgrelay": "1",
        "Subject": "[dpdk-dev] [PATCH v2 13/37] net/txgbe: add FDIR filter init and\n\tuninit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add flow director filter init and uninit operations.\n\nSigned-off-by: Jiawen Wu <jiawenwu@trustnetic.com>\n---\n drivers/net/txgbe/base/txgbe_type.h | 29 +++++++++++++\n drivers/net/txgbe/txgbe_ethdev.c    | 63 +++++++++++++++++++++++++++++\n drivers/net/txgbe/txgbe_ethdev.h    | 51 +++++++++++++++++++++++\n 3 files changed, 143 insertions(+)",
    "diff": "diff --git a/drivers/net/txgbe/base/txgbe_type.h b/drivers/net/txgbe/base/txgbe_type.h\nindex 69aa8993a..b9d31ab83 100644\n--- a/drivers/net/txgbe/base/txgbe_type.h\n+++ b/drivers/net/txgbe/base/txgbe_type.h\n@@ -67,6 +67,35 @@ enum {\n \n #define TXGBE_ATR_HASH_MASK\t\t\t0x7fff\n \n+/* Flow Director ATR input struct. */\n+struct txgbe_atr_input {\n+\t/*\n+\t * Byte layout in order, all values with MSB first:\n+\t *\n+\t * vm_pool\t- 1 byte\n+\t * flow_type\t- 1 byte\n+\t * vlan_id\t- 2 bytes\n+\t * src_ip\t- 16 bytes\n+\t * inner_mac\t- 6 bytes\n+\t * cloud_mode\t- 2 bytes\n+\t * tni_vni\t- 4 bytes\n+\t * dst_ip\t- 16 bytes\n+\t * src_port\t- 2 bytes\n+\t * dst_port\t- 2 bytes\n+\t * flex_bytes\t- 2 bytes\n+\t * bkt_hash\t- 2 bytes\n+\t */\n+\tu8 vm_pool;\n+\tu8 flow_type;\n+\t__be16 pkt_type;\n+\t__be32 dst_ip[4];\n+\t__be32 src_ip[4];\n+\t__be16 src_port;\n+\t__be16 dst_port;\n+\t__be16 flex_bytes;\n+\t__be16 bkt_hash;\n+};\n+\n enum txgbe_eeprom_type {\n \ttxgbe_eeprom_unknown = 0,\n \ttxgbe_eeprom_spi,\ndiff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c\nindex e4154c4b9..589306f0a 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.c\n+++ b/drivers/net/txgbe/txgbe_ethdev.c\n@@ -88,6 +88,8 @@ static const struct reg_info *txgbe_regs_others[] = {\n \t\t\t\ttxgbe_regs_diagnostic,\n \t\t\t\tNULL};\n \n+static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev);\n+static int txgbe_fdir_filter_uninit(struct rte_eth_dev *eth_dev);\n static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev);\n static int txgbe_l2_tn_filter_uninit(struct rte_eth_dev *eth_dev);\n static int  txgbe_dev_set_link_up(struct rte_eth_dev *dev);\n@@ -690,6 +692,9 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)\n \t/* initialize 5tuple filter list */\n \tTAILQ_INIT(&filter_info->fivetuple_list);\n \n+\t/* initialize flow director filter list & hash */\n+\ttxgbe_fdir_filter_init(eth_dev);\n+\n \t/* initialize l2 tunnel filter list & hash */\n \ttxgbe_l2_tn_filter_init(eth_dev);\n \n@@ -729,6 +734,26 @@ static int txgbe_ntuple_filter_uninit(struct rte_eth_dev *eth_dev)\n \treturn 0;\n }\n \n+static int txgbe_fdir_filter_uninit(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct txgbe_hw_fdir_info *fdir_info = TXGBE_DEV_FDIR(eth_dev);\n+\tstruct txgbe_fdir_filter *fdir_filter;\n+\n+\tif (fdir_info->hash_map)\n+\t\trte_free(fdir_info->hash_map);\n+\tif (fdir_info->hash_handle)\n+\t\trte_hash_free(fdir_info->hash_handle);\n+\n+\twhile ((fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list))) {\n+\t\tTAILQ_REMOVE(&fdir_info->fdir_list,\n+\t\t\t     fdir_filter,\n+\t\t\t     entries);\n+\t\trte_free(fdir_filter);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int txgbe_l2_tn_filter_uninit(struct rte_eth_dev *eth_dev)\n {\n \tstruct txgbe_l2_tn_info *l2_tn_info = TXGBE_DEV_L2_TN(eth_dev);\n@@ -749,6 +774,41 @@ static int txgbe_l2_tn_filter_uninit(struct rte_eth_dev *eth_dev)\n \treturn 0;\n }\n \n+static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct txgbe_hw_fdir_info *fdir_info = TXGBE_DEV_FDIR(eth_dev);\n+\tchar fdir_hash_name[RTE_HASH_NAMESIZE];\n+\tstruct rte_hash_parameters fdir_hash_params = {\n+\t\t.name = fdir_hash_name,\n+\t\t.entries = TXGBE_MAX_FDIR_FILTER_NUM,\n+\t\t.key_len = sizeof(struct txgbe_atr_input),\n+\t\t.hash_func = rte_hash_crc,\n+\t\t.hash_func_init_val = 0,\n+\t\t.socket_id = rte_socket_id(),\n+\t};\n+\n+\tTAILQ_INIT(&fdir_info->fdir_list);\n+\tsnprintf(fdir_hash_name, RTE_HASH_NAMESIZE,\n+\t\t \"fdir_%s\", TDEV_NAME(eth_dev));\n+\tfdir_info->hash_handle = rte_hash_create(&fdir_hash_params);\n+\tif (!fdir_info->hash_handle) {\n+\t\tPMD_INIT_LOG(ERR, \"Failed to create fdir hash table!\");\n+\t\treturn -EINVAL;\n+\t}\n+\tfdir_info->hash_map = rte_zmalloc(\"txgbe\",\n+\t\t\t\t\t  sizeof(struct txgbe_fdir_filter *) *\n+\t\t\t\t\t  TXGBE_MAX_FDIR_FILTER_NUM,\n+\t\t\t\t\t  0);\n+\tif (!fdir_info->hash_map) {\n+\t\tPMD_INIT_LOG(ERR,\n+\t\t\t     \"Failed to allocate memory for fdir hash map!\");\n+\t\treturn -ENOMEM;\n+\t}\n+\tfdir_info->mask_added = FALSE;\n+\n+\treturn 0;\n+}\n+\n static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev)\n {\n \tstruct txgbe_l2_tn_info *l2_tn_info = TXGBE_DEV_L2_TN(eth_dev);\n@@ -1866,6 +1926,9 @@ txgbe_dev_close(struct rte_eth_dev *dev)\n \trte_free(dev->data->hash_mac_addrs);\n \tdev->data->hash_mac_addrs = NULL;\n \n+\t/* remove all the fdir filters & hash */\n+\ttxgbe_fdir_filter_uninit(dev);\n+\n \t/* remove all the L2 tunnel filters & hash */\n \ttxgbe_l2_tn_filter_uninit(dev);\n \ndiff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h\nindex 2fbfc7940..f33ca1d32 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.h\n+++ b/drivers/net/txgbe/txgbe_ethdev.h\n@@ -59,8 +59,55 @@\n #define TXGBE_MISC_VEC_ID               RTE_INTR_VEC_ZERO_OFFSET\n #define TXGBE_RX_VEC_START              RTE_INTR_VEC_RXTX_OFFSET\n \n+#define TXGBE_MAX_FDIR_FILTER_NUM       (1024 * 32)\n #define TXGBE_MAX_L2_TN_FILTER_NUM      128\n \n+/*\n+ * Information about the fdir mode.\n+ */\n+struct txgbe_hw_fdir_mask {\n+\tuint16_t vlan_tci_mask;\n+\tuint32_t src_ipv4_mask;\n+\tuint32_t dst_ipv4_mask;\n+\tuint16_t src_ipv6_mask;\n+\tuint16_t dst_ipv6_mask;\n+\tuint16_t src_port_mask;\n+\tuint16_t dst_port_mask;\n+\tuint16_t flex_bytes_mask;\n+\tuint8_t  mac_addr_byte_mask;\n+\tuint32_t tunnel_id_mask;\n+\tuint8_t  tunnel_type_mask;\n+};\n+\n+struct txgbe_fdir_filter {\n+\tTAILQ_ENTRY(txgbe_fdir_filter) entries;\n+\tstruct txgbe_atr_input input; /* key of fdir filter*/\n+\tuint32_t fdirflags; /* drop or forward */\n+\tuint32_t fdirhash; /* hash value for fdir */\n+\tuint8_t queue; /* assigned rx queue */\n+};\n+\n+/* list of fdir filters */\n+TAILQ_HEAD(txgbe_fdir_filter_list, txgbe_fdir_filter);\n+\n+struct txgbe_hw_fdir_info {\n+\tstruct txgbe_hw_fdir_mask mask;\n+\tuint8_t     flex_bytes_offset;\n+\tuint16_t    collision;\n+\tuint16_t    free;\n+\tuint16_t    maxhash;\n+\tuint8_t     maxlen;\n+\tuint64_t    add;\n+\tuint64_t    remove;\n+\tuint64_t    f_add;\n+\tuint64_t    f_remove;\n+\tstruct txgbe_fdir_filter_list fdir_list; /* filter list*/\n+\t/* store the pointers of the filters, index is the hash value. */\n+\tstruct txgbe_fdir_filter **hash_map;\n+\tstruct rte_hash *hash_handle; /* cuckoo hash handler */\n+\tbool mask_added; /* If already got mask from consistent filter */\n+};\n+\n /* structure for interrupt relative data */\n struct txgbe_interrupt {\n \tuint32_t flags;\n@@ -206,6 +253,7 @@ struct txgbe_bw_conf {\n struct txgbe_adapter {\n \tstruct txgbe_hw             hw;\n \tstruct txgbe_hw_stats       stats;\n+\tstruct txgbe_hw_fdir_info   fdir;\n \tstruct txgbe_interrupt      intr;\n \tstruct txgbe_stat_mappings  stat_mappings;\n \tstruct txgbe_vfta           shadow_vfta;\n@@ -238,6 +286,9 @@ struct txgbe_adapter {\n #define TXGBE_DEV_INTR(dev) \\\n \t(&((struct txgbe_adapter *)(dev)->data->dev_private)->intr)\n \n+#define TXGBE_DEV_FDIR(dev) \\\n+\t(&((struct txgbe_adapter *)(dev)->data->dev_private)->fdir)\n+\n #define TXGBE_DEV_STAT_MAPPINGS(dev) \\\n \t(&((struct txgbe_adapter *)(dev)->data->dev_private)->stat_mappings)\n \n",
    "prefixes": [
        "v2",
        "13/37"
    ]
}