Show a patch.

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

{
    "id": 250,
    "url": "https://patches.dpdk.org/api/patches/250/",
    "web_url": "https://patches.dpdk.org/patch/250/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1409105634-29980-5-git-send-email-jingjing.wu@intel.com>",
    "date": "2014-08-27T02:13:51",
    "name": "[dpdk-dev,v2,4/7] i40e: function implement in i40e for flow director flush and info get",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0b9dacce5d2acf874364939586899d498947af41",
    "submitter": {
        "id": 47,
        "url": "https://patches.dpdk.org/api/people/47/",
        "name": "Wu, Jingjing",
        "email": "jingjing.wu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/250/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/250/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/250/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Date": "Wed, 27 Aug 2014 10:13:51 +0800",
        "In-Reply-To": "<1409105634-29980-1-git-send-email-jingjing.wu@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1409105634-29980-1-git-send-email-jingjing.wu@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Received": [
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id BFA34B376\n\tfor <dev@dpdk.org>; Wed, 27 Aug 2014 04:10:56 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga102.fm.intel.com with ESMTP; 26 Aug 2014 19:14:58 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 26 Aug 2014 19:14:34 -0700",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s7R2EXPO006231;\n\tWed, 27 Aug 2014 10:14:33 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s7R2EUEZ030117; Wed, 27 Aug 2014 10:14:32 +0800",
            "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7R2EUlW030113; \n\tWed, 27 Aug 2014 10:14:30 +0800"
        ],
        "From": "Jingjing Wu <jingjing.wu@intel.com>",
        "Precedence": "list",
        "X-ExtLoop1": "1",
        "Message-Id": "<1409105634-29980-5-git-send-email-jingjing.wu@intel.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v2 4/7] i40e: function implement in i40e for flow\n\tdirector flush and info get",
        "X-List-Received-Date": "Wed, 27 Aug 2014 02:10:57 -0000",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<wujingji@shecgisg004.sh.intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,408,1406617200\"; d=\"scan'208\";a=\"590362836\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "support the API ops defined in ethdev, the behavior according to each command:\n  RTE_CMD_FDIR_FLUSH   : clear all FDIR filter rules.\n  RTE_CMD_FDIR_INFO_GET: get FDIR information.\n \nSigned-off-by: jingjing.wu <jingjing.wu@intel.com>\nReviewed-by: Helin Zhang <helin.zhang@intel.com>\nReviewed-by: Jing Chen <jing.d.chen@intel.com>\nReviewed-by: Jijiang Liu <jijiang.liu@intel.com>\n \n---\n lib/librte_pmd_i40e/i40e_ethdev.c |  8 +++++\n lib/librte_pmd_i40e/i40e_ethdev.h |  3 ++\n lib/librte_pmd_i40e/i40e_fdir.c   | 67 +++++++++++++++++++++++++++++++++++++++\n lib/librte_pmd_i40e/rte_i40e.h    | 14 ++++++++\n 4 files changed, 92 insertions(+)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex 7dcf964..10797ba 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -4221,6 +4221,14 @@ i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,\n \t\t\t&fdir_entry->action,\n \t\t\tFALSE);\n \t\tbreak;\n+\tcase RTE_CMD_FDIR_INFO_GET:\n+\t\tif (args == NULL)\n+\t\t\treturn I40E_ERR_PARAM;\n+\t\ti40e_fdir_info_get(dev, (struct rte_i40e_fdir_info *)args);\n+\t\tbreak;\n+\tcase RTE_CMD_FDIR_FLUSH:\n+\t\tret = i40e_fdir_flush(pf);\n+\t\tbreak;\n \tdefault:\n \t\tPMD_DRV_LOG(ERR, \"unknown command type %u\\n\", cmd);\n \t\tret = I40E_ERR_PARAM;\ndiff --git a/lib/librte_pmd_i40e/i40e_ethdev.h b/lib/librte_pmd_i40e/i40e_ethdev.h\nindex 5edb99e..7755f5a 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.h\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.h\n@@ -334,11 +334,14 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf,\n \t\t\t\t    unsigned int socket_id);\n int i40e_fdir_setup(struct i40e_pf *pf);\n void i40e_fdir_teardown(struct i40e_pf *pf);\n+int i40e_fdir_flush(struct i40e_pf *pf);\n int i40e_fdir_filter_programming(struct i40e_pf *pf,\n \t\t\tuint16_t soft_id,\n \t\t\tstruct rte_i40e_fdir_input *fdir_filter,\n \t\t\tstruct rte_i40e_fdir_action *fdir_action,\n \t\t\tbool add);\n+void i40e_fdir_info_get(struct rte_eth_dev *dev,\n+\t\t\t   struct rte_i40e_fdir_info *fdir);\n \n /* I40E_DEV_PRIVATE_TO */\n #define I40E_DEV_PRIVATE_TO_PF(adapter) \\\ndiff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c\nindex df9a889..39e9e88 100644\n--- a/lib/librte_pmd_i40e/i40e_fdir.c\n+++ b/lib/librte_pmd_i40e/i40e_fdir.c\n@@ -51,6 +51,9 @@\n /* Wait count and inteval for fdir filter programming */\n #define I40E_FDIR_WAIT_COUNT       10\n #define I40E_FDIR_WAIT_INTERVAL_US 1000\n+/* Wait count and inteval for fdir filter flush */\n+#define I40E_FDIR_FLUSH_RETRY       50\n+#define I40E_FDIR_FLUSH_INTERVAL_MS 5\n \n #define I40E_COUNTER_PF           2\n /* Statistic counter index for one pf */\n@@ -217,6 +220,45 @@ i40e_fdir_teardown(struct i40e_pf *pf)\n \treturn;\n }\n \n+/*\n+ * i40e_fdir_flush - clear all filters of Flow Director\n+ * @pf: board private structure\n+ */\n+int\n+i40e_fdir_flush(struct i40e_pf *pf)\n+{\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n+\tuint32_t reg;\n+\tuint16_t guarant_cnt, best_cnt;\n+\tint i;\n+\n+\tI40E_WRITE_REG(hw, I40E_PFQF_CTL_1, I40E_PFQF_CTL_1_CLEARFDTABLE_MASK);\n+\tI40E_WRITE_FLUSH(hw);\n+\n+\tfor (i = 0; i < I40E_FDIR_FLUSH_RETRY; i++) {\n+\t\trte_delay_ms(I40E_FDIR_FLUSH_INTERVAL_MS);\n+\t\treg = I40E_READ_REG(hw, I40E_PFQF_CTL_1);\n+\t\tif (!(reg & I40E_PFQF_CTL_1_CLEARFDTABLE_MASK))\n+\t\t\tbreak;\n+\t}\n+\tif (i >= I40E_FDIR_FLUSH_RETRY) {\n+\t\tPMD_DRV_LOG(ERR, \"FD table did not flush, may need more time\\n\");\n+\t\treturn I40E_ERR_TIMEOUT;\n+\t}\n+\tguarant_cnt = (uint16_t)((I40E_READ_REG(hw, I40E_PFQF_FDSTAT) &\n+\t\t\t\tI40E_PFQF_FDSTAT_GUARANT_CNT_MASK) >>\n+\t\t\t\tI40E_PFQF_FDSTAT_GUARANT_CNT_SHIFT);\n+\tbest_cnt = (uint16_t)((I40E_READ_REG(hw, I40E_PFQF_FDSTAT) &\n+\t\t\t\tI40E_PFQF_FDSTAT_BEST_CNT_MASK) >>\n+\t\t\t\tI40E_PFQF_FDSTAT_BEST_CNT_SHIFT);\n+\tif (guarant_cnt != 0 || best_cnt != 0) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to flush FD table\\n\");\n+\t\treturn I40E_ERR_CONFIG;\n+\t} else\n+\t\tPMD_DRV_LOG(INFO, \"FD table Flush success\\n\");\n+\treturn I40E_SUCCESS;\n+}\n+\n /* Construct the tx flags */\n static inline uint64_t\n i40e_build_ctob(uint32_t td_cmd,\n@@ -431,3 +473,28 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,\n \t}\n \treturn I40E_SUCCESS;\n }\n+\n+/*\n+ * i40e_fdir_info_get - get information of Flow Director\n+ * @dev: ethernet device to add filter to\n+ * @fdir: a pointer to a structure of type *rte_eth_dev_fdir* to be filled with\n+ *    the flow director information.\n+ **/\n+void\n+i40e_fdir_info_get(struct rte_eth_dev *dev, struct rte_i40e_fdir_info *fdir)\n+{\n+\tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tuint32_t pfqf_ctl;\n+\n+\tpfqf_ctl = I40E_READ_REG(hw, I40E_PFQF_CTL_0);\n+\tfdir->mode = pfqf_ctl & I40E_PFQF_CTL_0_FD_ENA_MASK ? 1 : 0;\n+\tfdir->guarant_spc = (uint16_t)hw->func_caps.fd_filters_guaranteed;\n+\tfdir->guarant_cnt = (uint16_t)((I40E_READ_REG(hw, I40E_PFQF_FDSTAT) &\n+\t\t\t\tI40E_PFQF_FDSTAT_GUARANT_CNT_MASK) >>\n+\t\t\t\tI40E_PFQF_FDSTAT_GUARANT_CNT_SHIFT);\n+\tfdir->best_spc = (uint16_t)hw->func_caps.fd_filters_best_effort;\n+\tfdir->best_cnt = (uint16_t)((I40E_READ_REG(hw, I40E_PFQF_FDSTAT) &\n+\t\t\t\tI40E_PFQF_FDSTAT_BEST_CNT_MASK) >>\n+\t\t\t\tI40E_PFQF_FDSTAT_BEST_CNT_SHIFT);\n+\treturn;\n+}\ndiff --git a/lib/librte_pmd_i40e/rte_i40e.h b/lib/librte_pmd_i40e/rte_i40e.h\nindex 3d9cc3d..1176a37 100644\n--- a/lib/librte_pmd_i40e/rte_i40e.h\n+++ b/lib/librte_pmd_i40e/rte_i40e.h\n@@ -104,6 +104,20 @@ struct rte_i40e_fdir_entry {\n \tstruct rte_i40e_fdir_action action; /**< action taken when match */\n };\n \n+/**\n+ * For commands:\n+ * 'RTE_CMD_FDIR_INFO_GET'\n+ *\n+ * A structure used for user to get the information of fdir feature.\n+ */\n+struct rte_i40e_fdir_info {\n+\tuint8_t  mode;         /**< 0 is disable, 1 is enable. */\n+\tuint16_t guarant_spc;  /**< guaranteed spaces.*/\n+\tuint16_t guarant_cnt;  /**< Number of filters in guaranteed spaces. */\n+\tuint16_t best_spc;     /**< best effort spaces.*/\n+\tuint16_t best_cnt;     /**< Number of filters in best effort spaces. */\n+};\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "4/7"
    ]
}