get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 687,
    "url": "https://patches.dpdk.org/api/patches/687/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com",
    "date": "2014-10-01T08:00:57",
    "name": "[dpdk-dev,v2,1/2] pmd: Modified dev_info structure to include default RX/TX configuration",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a1fab0505b1e5392b984ef05e6ca66923168466f",
    "submitter": {
        "id": 9,
        "url": "https://patches.dpdk.org/api/people/9/?format=api",
        "name": "De Lara Guarch, Pablo",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/687/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/687/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id C00C96A9B;\n\tWed,  1 Oct 2014 09:54:25 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 2116971\n\tfor <dev@dpdk.org>; Wed,  1 Oct 2014 09:54:20 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga103.jf.intel.com with ESMTP; 01 Oct 2014 00:58:46 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 01 Oct 2014 01:01:02 -0700",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\ts91811VH032330; Wed, 1 Oct 2014 09:01:01 +0100",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id s91810kv026265;\n\tWed, 1 Oct 2014 09:01:00 +0100",
            "(from pdelarax@localhost)\n\tby sivswdev02.ir.intel.com with  id s91810sX026261;\n\tWed, 1 Oct 2014 09:01:00 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,630,1406617200\"; d=\"scan'208\";a=\"611372429\"",
        "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed,  1 Oct 2014 09:00:57 +0100",
        "Message-Id": "<1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1412150458-26213-1-git-send-email-pablo.de.lara.guarch@intel.com>",
        "References": "<1411741159-6671-1-git-send-email-pablo.de.lara.guarch@intel.com>\n\t<1412150458-26213-1-git-send-email-pablo.de.lara.guarch@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to\n\tinclude default RX/TX configuration",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf\nstructures. This patch allows the user to get a default optimal RX/TX configuration\nthrough rte_eth_dev_info get, and still any parameters may be tweaked as wished,\nbefore setting up queues.\n\nBesides, if a NULL pointer is passed to rte_eth_rx_queue_setup or\nrte_eth_tx_queue_setup, these functions get internally the default RX/TX\nconfiguration for the user.\n\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\n---\n lib/librte_ether/rte_ethdev.c       |   28 +++++++++++++++++++++-----\n lib/librte_ether/rte_ethdev.h       |    2 +\n lib/librte_pmd_e1000/igb_ethdev.c   |   32 ++++++++++++++++++++++++++++++-\n lib/librte_pmd_i40e/i40e_ethdev.c   |   33 ++++++++++++++++++++++++++++++++\n lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   36 +++++++++++++++++++++++++++++++++++\n 5 files changed, 124 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex fd1010a..2f9eea2 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,\n \tstruct rte_eth_dev *dev;\n \tstruct rte_pktmbuf_pool_private *mbp_priv;\n \tstruct rte_eth_dev_info dev_info;\n+\tconst struct rte_eth_rxconf *conf;\n \n \t/* This function is only safe when called from the primary process\n \t * in a multi-process setup*/\n@@ -937,6 +938,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,\n \t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n \t\treturn (-EINVAL);\n \t}\n+\n \tdev = &rte_eth_devices[port_id];\n \tif (rx_queue_id >= dev->data->nb_rx_queues) {\n \t\tPMD_DEBUG_TRACE(\"Invalid RX queue_id=%d\\n\", rx_queue_id);\n@@ -980,8 +982,12 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,\n \t\treturn (-EINVAL);\n \t}\n \n+\tconf = rx_conf;\n+\tif (conf == NULL)\n+\t\tconf = &dev_info.default_rxconf;\n+\n \tret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc,\n-\t\t\t\t\t      socket_id, rx_conf, mp);\n+\t\t\t\t\t      socket_id, conf, mp);\n \tif (!ret) {\n \t\tif (!dev->data->min_rx_buf_size ||\n \t\t    dev->data->min_rx_buf_size > mbp_buf_size)\n@@ -997,6 +1003,8 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,\n \t\t       const struct rte_eth_txconf *tx_conf)\n {\n \tstruct rte_eth_dev *dev;\n+\tstruct rte_eth_dev_info dev_info;\n+\tconst struct rte_eth_txconf *conf;\n \n \t/* This function is only safe when called from the primary process\n \t * in a multi-process setup*/\n@@ -1006,6 +1014,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,\n \t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n \t\treturn (-EINVAL);\n \t}\n+\n \tdev = &rte_eth_devices[port_id];\n \tif (tx_queue_id >= dev->data->nb_tx_queues) {\n \t\tPMD_DEBUG_TRACE(\"Invalid TX queue_id=%d\\n\", tx_queue_id);\n@@ -1018,9 +1027,17 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,\n \t\treturn -EBUSY;\n \t}\n \n+\tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);\n \tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);\n+\n+\t(*dev->dev_ops->dev_infos_get)(dev, &dev_info);\n+\n+\tconf = tx_conf;\n+\tif (conf == NULL)\n+\t\tconf = &dev_info.default_txconf;\n+\n \treturn (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, nb_tx_desc,\n-\t\t\t\t\t       socket_id, tx_conf);\n+\t\t\t\t\t       socket_id, conf);\n }\n \n void\n@@ -1249,10 +1266,9 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)\n \t}\n \tdev = &rte_eth_devices[port_id];\n \n-\t/* Default device offload capabilities to zero */\n-\tdev_info->rx_offload_capa = 0;\n-\tdev_info->tx_offload_capa = 0;\n-\tdev_info->if_index = 0;\n+\t/* Reset dev info structure */\n+\tmemset(dev_info, 0, sizeof(struct rte_eth_dev_info));\n+\n \tFUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);\n \t(*dev->dev_ops->dev_infos_get)(dev, dev_info);\n \tdev_info->pci_dev = dev->pci_dev;\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 50df654..f63d38a 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -906,6 +906,8 @@ struct rte_eth_dev_info {\n \tuint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */\n \tuint32_t rx_offload_capa; /**< Device RX offload capabilities. */\n \tuint32_t tx_offload_capa; /**< Device TX offload capabilities. */\n+\tstruct rte_eth_rxconf default_rxconf; /**< Default RX configuration */\n+\tstruct rte_eth_txconf default_txconf; /**< Default TX configuration */\n };\n \n struct rte_eth_dev;\ndiff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c\nindex 3187d92..4bf75f5 100644\n--- a/lib/librte_pmd_e1000/igb_ethdev.c\n+++ b/lib/librte_pmd_e1000/igb_ethdev.c\n@@ -57,6 +57,18 @@\n #include \"e1000/e1000_api.h\"\n #include \"e1000_ethdev.h\"\n \n+/**\n+ *  Default values for port configuration\n+ */\n+#define IGB_DEFAULT_RX_FREE_THRESH  32\n+#define IGB_DEFAULT_RX_PTHRESH      8\n+#define IGB_DEFAULT_RX_HTHRESH      8\n+#define IGB_DEFAULT_RX_WTHRESH      0\n+\n+#define IGB_DEFAULT_TX_PTHRESH      32\n+#define IGB_DEFAULT_TX_HTHRESH      0\n+#define IGB_DEFAULT_TX_WTHRESH      0\n+\n static int  eth_igb_configure(struct rte_eth_dev *dev);\n static int  eth_igb_start(struct rte_eth_dev *dev);\n static void eth_igb_stop(struct rte_eth_dev *dev);\n@@ -165,7 +177,6 @@ static int eth_igb_remove_5tuple_filter(struct rte_eth_dev *dev,\n static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev,\n \t\t\tuint16_t index,\n \t\t\tstruct rte_5tuple_filter *filter, uint16_t *rx_queue);\n-\n /*\n  * Define VF Stats MACRO for Non \"cleared on read\" register\n  */\n@@ -1331,6 +1342,25 @@ eth_igb_infos_get(struct rte_eth_dev *dev,\n \t\tdev_info->max_tx_queues = 0;\n \t\tdev_info->max_vmdq_pools = 0;\n \t}\n+\n+\tdev_info->default_rxconf = (struct rte_eth_rxconf) {\n+\t\t.rx_thresh = {\n+\t\t\t.pthresh = IGB_DEFAULT_RX_PTHRESH,\n+\t\t\t.hthresh = IGB_DEFAULT_RX_HTHRESH,\n+\t\t\t.wthresh = IGB_DEFAULT_RX_WTHRESH,\n+\t\t},\n+\t\t.rx_free_thresh = IGB_DEFAULT_RX_FREE_THRESH,\n+\t\t.rx_drop_en = 0,\n+\t};\n+\n+\tdev_info->default_txconf = (struct rte_eth_txconf) {\n+\t\t.tx_thresh = {\n+\t\t\t.pthresh = IGB_DEFAULT_TX_PTHRESH,\n+\t\t\t.hthresh = IGB_DEFAULT_TX_HTHRESH,\n+\t\t\t.wthresh = IGB_DEFAULT_TX_WTHRESH,\n+\t\t},\n+\t\t.txq_flags = 0,\n+\t};\n }\n \n /* return 0 means link status changed, -1 means not changed */\ndiff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex 9ed31b5..72faf95 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -58,6 +58,17 @@\n #include \"i40e_rxtx.h\"\n #include \"i40e_pf.h\"\n \n+#define I40E_DEFAULT_RX_FREE_THRESH  32\n+#define I40E_DEFAULT_RX_PTHRESH      8\n+#define I40E_DEFAULT_RX_HTHRESH      8\n+#define I40E_DEFAULT_RX_WTHRESH      0\n+\n+#define I40E_DEFAULT_TX_FREE_THRESH  32\n+#define I40E_DEFAULT_TX_PTHRESH      32\n+#define I40E_DEFAULT_TX_HTHRESH      0\n+#define I40E_DEFAULT_TX_WTHRESH      0\n+#define I40E_DEFAULT_TX_RSBIT_THRESH 32\n+\n /* Maximun number of MAC addresses */\n #define I40E_NUM_MACADDR_MAX       64\n #define I40E_CLEAR_PXE_WAIT_MS     200\n@@ -1231,6 +1242,28 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t\tDEV_TX_OFFLOAD_UDP_CKSUM |\n \t\tDEV_TX_OFFLOAD_TCP_CKSUM |\n \t\tDEV_TX_OFFLOAD_SCTP_CKSUM;\n+\n+\tdev_info->default_rxconf = (struct rte_eth_rxconf) {\n+\t\t.rx_thresh = {\n+\t\t\t.pthresh = I40E_DEFAULT_RX_PTHRESH,\n+\t\t\t.hthresh = I40E_DEFAULT_RX_HTHRESH,\n+\t\t\t.wthresh = I40E_DEFAULT_RX_WTHRESH,\n+\t\t},\n+\t\t.rx_free_thresh = I40E_DEFAULT_RX_FREE_THRESH,\n+\t\t.rx_drop_en = 0,\n+\t};\n+\n+\tdev_info->default_txconf = (struct rte_eth_txconf) {\n+\t\t.tx_thresh = {\n+\t\t\t.pthresh = I40E_DEFAULT_TX_PTHRESH,\n+\t\t\t.hthresh = I40E_DEFAULT_TX_HTHRESH,\n+\t\t\t.wthresh = I40E_DEFAULT_TX_WTHRESH,\n+\t\t},\n+\t\t.tx_free_thresh = I40E_DEFAULT_TX_FREE_THRESH,\n+\t\t.tx_rs_thresh = I40E_DEFAULT_TX_RSBIT_THRESH,\n+\t\t.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS,\n+\t};\n+\n }\n \n static int\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c\nindex 59122a1..3b1c156 100644\n--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c\n+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c\n@@ -92,6 +92,20 @@\n #define IXGBE_MMW_SIZE_DEFAULT        0x4\n #define IXGBE_MMW_SIZE_JUMBO_FRAME    0x14\n \n+/**\n+ *  Default values for RX/TX configuration\n+ */\n+#define IXGBE_DEFAULT_RX_FREE_THRESH  32\n+#define IXGBE_DEFAULT_RX_PTHRESH      8\n+#define IXGBE_DEFAULT_RX_HTHRESH      8\n+#define IXGBE_DEFAULT_RX_WTHRESH      0\n+\n+#define IXGBE_DEFAULT_TX_FREE_THRESH  32\n+#define IXGBE_DEFAULT_TX_PTHRESH      32\n+#define IXGBE_DEFAULT_TX_HTHRESH      0\n+#define IXGBE_DEFAULT_TX_WTHRESH      0\n+#define IXGBE_DEFAULT_TX_RSBIT_THRESH 32\n+\n #define IXGBEVF_PMD_NAME \"rte_ixgbevf_pmd\" /* PMD name */\n \n #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))\n@@ -1948,6 +1962,28 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t\tDEV_TX_OFFLOAD_UDP_CKSUM   |\n \t\tDEV_TX_OFFLOAD_TCP_CKSUM   |\n \t\tDEV_TX_OFFLOAD_SCTP_CKSUM;\n+\n+\tdev_info->default_rxconf = (struct rte_eth_rxconf) {\n+\t\t\t.rx_thresh = {\n+\t\t\t\t.pthresh = IXGBE_DEFAULT_RX_PTHRESH,\n+\t\t\t\t.hthresh = IXGBE_DEFAULT_RX_HTHRESH,\n+\t\t\t\t.wthresh = IXGBE_DEFAULT_RX_WTHRESH,\n+\t\t\t},\n+\t\t\t.rx_free_thresh = IXGBE_DEFAULT_RX_FREE_THRESH,\n+\t\t\t.rx_drop_en = 0,\n+\t};\n+\n+\n+\t dev_info->default_txconf = (struct rte_eth_txconf) {\n+\t\t\t.tx_thresh = {\n+\t\t\t\t.pthresh = IXGBE_DEFAULT_TX_PTHRESH,\n+\t\t\t\t.hthresh = IXGBE_DEFAULT_TX_HTHRESH,\n+\t\t\t\t.wthresh = IXGBE_DEFAULT_TX_WTHRESH,\n+\t\t\t},\n+\t\t\t.tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH,\n+\t\t\t.tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH,\n+\t\t\t.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS,\n+\t};\n }\n \n /* return 0 means link status changed, -1 means not changed */\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "1/2"
    ]
}