Show a patch.

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

{
    "id": 44845,
    "url": "http://patches.dpdk.org/api/patches/44845/",
    "web_url": "http://patches.dpdk.org/patch/44845/",
    "project": {
        "id": 1,
        "url": "http://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": "<1537277516-8876-4-git-send-email-hemant.agrawal@nxp.com>",
    "date": "2018-09-18T13:31:46",
    "name": "[v2,03/13] net/dpaa: implement scatter offload support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8661845bf78557d933e27b2230dea4dc37dfa7e5",
    "submitter": {
        "id": 477,
        "url": "http://patches.dpdk.org/api/people/477/",
        "name": "Hemant Agrawal",
        "email": "hemant.agrawal@nxp.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "mbox": "http://patches.dpdk.org/patch/44845/mbox/",
    "series": [
        {
            "id": 1371,
            "url": "http://patches.dpdk.org/api/series/1371/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1371",
            "date": "2018-09-18T13:31:43",
            "name": "NXP DPAA driver enhancements",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/1371/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44845/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44845/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<1537277516-8876-1-git-send-email-hemant.agrawal@nxp.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.7.4",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CEBDC4CA2;\n\tTue, 18 Sep 2018 15:34:02 +0200 (CEST)",
            "from inva020.nxp.com (inva020.nxp.com [92.121.34.13])\n\tby dpdk.org (Postfix) with ESMTP id 8ABC42C57\n\tfor <dev@dpdk.org>; Tue, 18 Sep 2018 15:34:00 +0200 (CEST)",
            "from inva020.nxp.com (localhost [127.0.0.1])\n\tby inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 511F71A0138;\n\tTue, 18 Sep 2018 15:34:00 +0200 (CEST)",
            "from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com\n\t[165.114.16.14])\n\tby inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id EEEB71A0143;\n\tTue, 18 Sep 2018 15:33:57 +0200 (CEST)",
            "from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net\n\t[10.232.134.28])\n\tby invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5A7FA402F8;\n\tTue, 18 Sep 2018 21:33:54 +0800 (SGT)"
        ],
        "References": "<1535539660-20228-2-git-send-email-hemant.agrawal@nxp.com>\n\t<1537277516-8876-1-git-send-email-hemant.agrawal@nxp.com>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1537277516-8876-4-git-send-email-hemant.agrawal@nxp.com>",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "Hemant Agrawal <hemant.agrawal@nxp.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org,\n\tthomas@monjalon.net,\n\tferruh.yigit@intel.com",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Tue, 18 Sep 2018 19:01:46 +0530",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v2 03/13] net/dpaa: implement scatter offload\n\tsupport"
    },
    "content": "This patch implement the sg support, which can be\nenabled/disabled w.r.t configuration.\n\nSigned-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>\n---\n drivers/net/dpaa/dpaa_ethdev.c | 62 +++++++++++++++++++++++++++++++++++++++---\n drivers/net/dpaa/dpaa_ethdev.h |  3 +-\n drivers/net/dpaa/dpaa_rxtx.c   |  8 +++---\n drivers/net/dpaa/dpaa_rxtx.h   |  2 --\n 4 files changed, 64 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c\nindex db166f5..9ea8510 100644\n--- a/drivers/net/dpaa/dpaa_ethdev.c\n+++ b/drivers/net/dpaa/dpaa_ethdev.c\n@@ -47,15 +47,15 @@\n \n /* Supported Rx offloads */\n static uint64_t dev_rx_offloads_sup =\n-\t\tDEV_RX_OFFLOAD_JUMBO_FRAME;\n+\t\tDEV_RX_OFFLOAD_JUMBO_FRAME |\n+\t\tDEV_RX_OFFLOAD_SCATTER;\n \n /* Rx offloads which cannot be disabled */\n static uint64_t dev_rx_offloads_nodis =\n \t\tDEV_RX_OFFLOAD_IPV4_CKSUM |\n \t\tDEV_RX_OFFLOAD_UDP_CKSUM |\n \t\tDEV_RX_OFFLOAD_TCP_CKSUM |\n-\t\tDEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |\n-\t\tDEV_RX_OFFLOAD_SCATTER;\n+\t\tDEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;\n \n /* Supported Tx offloads */\n static uint64_t dev_tx_offloads_sup;\n@@ -147,11 +147,30 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)\n \tstruct dpaa_if *dpaa_intf = dev->data->dev_private;\n \tuint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN\n \t\t\t\t+ VLAN_TAG_SIZE;\n+\tuint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM;\n \n \tPMD_INIT_FUNC_TRACE();\n \n \tif (mtu < ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN)\n \t\treturn -EINVAL;\n+\t/*\n+\t * Refuse mtu that requires the support of scattered packets\n+\t * when this feature has not been enabled before.\n+\t */\n+\tif (dev->data->min_rx_buf_size &&\n+\t\t!dev->data->scattered_rx && frame_size > buffsz) {\n+\t\tDPAA_PMD_ERR(\"SG not enabled, will not fit in one buffer\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* check <seg size> * <max_seg>  >= max_frame */\n+\tif (dev->data->min_rx_buf_size && dev->data->scattered_rx &&\n+\t\t(frame_size > buffsz * DPAA_SGT_MAX_ENTRIES)) {\n+\t\tDPAA_PMD_ERR(\"Too big to fit for Max SG list %d\",\n+\t\t\t\tbuffsz * DPAA_SGT_MAX_ENTRIES);\n+\t\treturn -EINVAL;\n+\t}\n+\n \tif (frame_size > ETHER_MAX_LEN)\n \t\tdev->data->dev_conf.rxmode.offloads &=\n \t\t\t\t\t\tDEV_RX_OFFLOAD_JUMBO_FRAME;\n@@ -208,6 +227,13 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)\n \t\t\t\tDPAA_MAX_RX_PKT_LEN);\n \t\t}\n \t}\n+\n+\tif (rx_offloads & DEV_RX_OFFLOAD_SCATTER) {\n+\t\tDPAA_PMD_DEBUG(\"enabling scatter mode\");\n+\t\tfman_if_set_sg(dpaa_intf->fif, 1);\n+\t\tdev->data->scattered_rx = 1;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -305,7 +331,6 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev,\n \n \tdev_info->max_rx_queues = dpaa_intf->nb_rx_queues;\n \tdev_info->max_tx_queues = dpaa_intf->nb_tx_queues;\n-\tdev_info->min_rx_bufsize = DPAA_MIN_RX_BUF_SIZE;\n \tdev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;\n \tdev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER;\n \tdev_info->max_hash_mac_addrs = 0;\n@@ -519,6 +544,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,\n \tstruct qm_mcc_initfq opts = {0};\n \tu32 flags = 0;\n \tint ret;\n+\tu32 buffsz = rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM;\n \n \tPMD_INIT_FUNC_TRACE();\n \n@@ -532,6 +558,28 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,\n \tDPAA_PMD_INFO(\"Rx queue setup for queue index: %d fq_id (0x%x)\",\n \t\t\tqueue_idx, rxq->fqid);\n \n+\t/* Max packet can fit in single buffer */\n+\tif (dev->data->dev_conf.rxmode.max_rx_pkt_len <= buffsz) {\n+\t\t;\n+\t} else if (dev->data->dev_conf.rxmode.offloads &\n+\t\t\tDEV_RX_OFFLOAD_SCATTER) {\n+\t\tif (dev->data->dev_conf.rxmode.max_rx_pkt_len >\n+\t\t\tbuffsz * DPAA_SGT_MAX_ENTRIES) {\n+\t\t\tDPAA_PMD_ERR(\"max RxPkt size %d too big to fit \"\n+\t\t\t\t\"MaxSGlist %d\",\n+\t\t\t\tdev->data->dev_conf.rxmode.max_rx_pkt_len,\n+\t\t\t\tbuffsz * DPAA_SGT_MAX_ENTRIES);\n+\t\t\trte_errno = EOVERFLOW;\n+\t\t\treturn -rte_errno;\n+\t\t}\n+\t} else {\n+\t\tDPAA_PMD_WARN(\"The requested maximum Rx packet size (%u) is\"\n+\t\t     \" larger than a single mbuf (%u) and scattered\"\n+\t\t     \" mode has not been requested\",\n+\t\t     dev->data->dev_conf.rxmode.max_rx_pkt_len,\n+\t\t     buffsz - RTE_PKTMBUF_HEADROOM);\n+\t}\n+\n \tif (!dpaa_intf->bp_info || dpaa_intf->bp_info->mp != mp) {\n \t\tstruct fman_if_ic_params icp;\n \t\tuint32_t fd_offset;\n@@ -562,6 +610,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,\n \t\t\t    dpaa_intf->name, fd_offset,\n \t\t\tfman_if_get_fdoff(dpaa_intf->fif));\n \t}\n+\tDPAA_PMD_DEBUG(\"if:%s sg_on = %d, max_frm =%d\", dpaa_intf->name,\n+\t\tfman_if_get_sg_enable(dpaa_intf->fif),\n+\t\tdev->data->dev_conf.rxmode.max_rx_pkt_len);\n \t/* checking if push mode only, no error check for now */\n \tif (dpaa_push_mode_max_queue > dpaa_push_queue_idx) {\n \t\tdpaa_push_queue_idx++;\n@@ -1312,6 +1363,9 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)\n \tfman_if_reset_mcast_filter_table(fman_intf);\n \t/* Reset interface statistics */\n \tfman_if_stats_reset(fman_intf);\n+\t/* Disable SG by default */\n+\tfman_if_set_sg(fman_intf, 0);\n+\tfman_if_set_maxfrm(fman_intf, ETHER_MAX_LEN + VLAN_TAG_SIZE);\n \n \treturn 0;\n \ndiff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h\nindex 2c38c34..2fc7231 100644\n--- a/drivers/net/dpaa/dpaa_ethdev.h\n+++ b/drivers/net/dpaa/dpaa_ethdev.h\n@@ -39,9 +39,10 @@\n /* Alignment to use for cpu-local structs to avoid coherency problems. */\n #define MAX_CACHELINE\t\t\t64\n \n-#define DPAA_MIN_RX_BUF_SIZE 512\n #define DPAA_MAX_RX_PKT_LEN  10240\n \n+#define DPAA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */\n+\n /* RX queue tail drop threshold (CGR Based) in frame count */\n #define CGR_RX_PERFQ_THRESH 256\n \ndiff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c\nindex 168b77e..3a3a048 100644\n--- a/drivers/net/dpaa/dpaa_rxtx.c\n+++ b/drivers/net/dpaa/dpaa_rxtx.c\n@@ -306,8 +306,6 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid)\n \tint i = 0;\n \tuint8_t fd_offset = fd->offset;\n \n-\tDPAA_DP_LOG(DEBUG, \"Received an SG frame\");\n-\n \tvaddr = DPAA_MEMPOOL_PTOV(bp_info, qm_fd_addr(fd));\n \tif (!vaddr) {\n \t\tDPAA_PMD_ERR(\"unable to convert physical address\");\n@@ -349,6 +347,8 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid)\n \t\t}\n \t\tprev_seg = cur_seg;\n \t}\n+\tDPAA_DP_LOG(DEBUG, \"Received an SG frame len =%d, num_sg =%d\",\n+\t\t\tfirst_seg->pkt_len, first_seg->nb_segs);\n \n \tdpaa_eth_packet_info(first_seg, vaddr);\n \trte_pktmbuf_free_seg(temp);\n@@ -367,8 +367,6 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid)\n \tuint16_t offset;\n \tuint32_t length;\n \n-\tDPAA_DP_LOG(DEBUG, \" FD--->MBUF\");\n-\n \tif (unlikely(format == qm_fd_sg))\n \t\treturn dpaa_eth_sg_to_mbuf(fd, ifid);\n \n@@ -379,6 +377,8 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid)\n \toffset = (fd->opaque & DPAA_FD_OFFSET_MASK) >> DPAA_FD_OFFSET_SHIFT;\n \tlength = fd->opaque & DPAA_FD_LENGTH_MASK;\n \n+\tDPAA_DP_LOG(DEBUG, \" FD--->MBUF off %d len = %d\", offset, length);\n+\n \t/* Ignoring case when format != qm_fd_contig */\n \tdpaa_display_frame(fd);\n \ndiff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h\nindex d3e6351..6de70a7 100644\n--- a/drivers/net/dpaa/dpaa_rxtx.h\n+++ b/drivers/net/dpaa/dpaa_rxtx.h\n@@ -32,8 +32,6 @@\n /* L4 Type field: TCP */\n #define DPAA_L4_PARSE_RESULT_TCP\t0x20\n \n-#define DPAA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */\n-\n #define DPAA_MAX_DEQUEUE_NUM_FRAMES    63\n \t/** <Maximum number of frames to be dequeued in a single rx call*/\n \n",
    "prefixes": [
        "v2",
        "03/13"
    ]
}