net/dpaa2: enable physical addressing for packet buffers
authorHemant Agrawal <hemant.agrawal@nxp.com>
Tue, 11 Apr 2017 13:49:35 +0000 (19:19 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 19 Apr 2017 13:37:37 +0000 (15:37 +0200)
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/net/dpaa2/base/dpaa2_hw_dpni.c
drivers/net/dpaa2/dpaa2_rxtx.c

index 08f53b3..3dc60cc 100644 (file)
@@ -76,7 +76,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
        memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
 
        dpaa2_distset_to_dpkg_profile_cfg(req_dist_set, &kg_cfg);
-       tc_cfg.key_cfg_iova = (uint64_t)(p_params);
+       tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params));
        tc_cfg.dist_size = eth_dev->data->nb_rx_queues;
        tc_cfg.dist_mode = DPNI_DIST_MODE_HASH;
 
@@ -119,7 +119,7 @@ int dpaa2_remove_flow_dist(
        memset(p_params, 0, DIST_PARAM_IOVA_SIZE);
        memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
 
-       tc_cfg.key_cfg_iova = (uint64_t)(p_params);
+       tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params));
        tc_cfg.dist_size = 0;
        tc_cfg.dist_mode = DPNI_DIST_MODE_NONE;
 
index deec210..c5d49cb 100644 (file)
@@ -136,7 +136,7 @@ static inline struct rte_mbuf *__attribute__((hot))
 eth_fd_to_mbuf(const struct qbman_fd *fd)
 {
        struct rte_mbuf *mbuf = DPAA2_INLINE_MBUF_FROM_BUF(
-                       DPAA2_GET_FD_ADDR(fd),
+               DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)),
                     rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size);
 
        /* need to repopulated some of the fields,
@@ -151,10 +151,11 @@ eth_fd_to_mbuf(const struct qbman_fd *fd)
        /* Parse the packet */
        /* parse results are after the private - sw annotation area */
        mbuf->packet_type = dpaa2_dev_rx_parse(
-                       (uint64_t)(DPAA2_GET_FD_ADDR(fd))
+                       (uint64_t)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd))
                         + DPAA2_FD_PTA_SIZE);
 
-       dpaa2_dev_rx_offload((uint64_t)(DPAA2_GET_FD_ADDR(fd)) +
+       dpaa2_dev_rx_offload((uint64_t)DPAA2_IOVA_TO_VADDR(
+                            DPAA2_GET_FD_ADDR(fd)) +
                             DPAA2_FD_PTA_SIZE, mbuf);
 
        mbuf->next = NULL;
@@ -177,7 +178,7 @@ eth_mbuf_to_fd(struct rte_mbuf *mbuf,
        /*Resetting the buffer pool id and offset field*/
        fd->simple.bpid_offset = 0;
 
-       DPAA2_SET_FD_ADDR(fd, (mbuf->buf_addr));
+       DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(mbuf));
        DPAA2_SET_FD_LEN(fd, mbuf->data_len);
        DPAA2_SET_FD_BPID(fd, bpid);
        DPAA2_SET_FD_OFFSET(fd, mbuf->data_off);
@@ -219,7 +220,7 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf,
        /*Resetting the buffer pool id and offset field*/
        fd->simple.bpid_offset = 0;
 
-       DPAA2_SET_FD_ADDR(fd, (m->buf_addr));
+       DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(m));
        DPAA2_SET_FD_LEN(fd, mbuf->data_len);
        DPAA2_SET_FD_BPID(fd, bpid);
        DPAA2_SET_FD_OFFSET(fd, mbuf->data_off);
@@ -271,7 +272,7 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
        qbman_pull_desc_set_fq(&pulldesc, fqid);
        /* todo optimization - we can have dq_storage_phys available*/
        qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-                       (dma_addr_t)(dq_storage), 1);
+                       (dma_addr_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
 
        /*Issue a volatile dequeue command. */
        while (1) {
@@ -312,7 +313,8 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
                }
 
                fd = qbman_result_DQ_fd(dq_storage);
-               mbuf = (struct rte_mbuf *)(DPAA2_GET_FD_ADDR(fd)
+               mbuf = (struct rte_mbuf *)DPAA2_IOVA_TO_VADDR(
+                  DPAA2_GET_FD_ADDR(fd)
                   - rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size);
                /* Prefeth mbuf */
                rte_prefetch0(mbuf);