New upstream version 17.11-rc3
[deb_dpdk.git] / drivers / net / thunderx / nicvf_rxtx.h
index 9dad8a5..a3ccce2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *   BSD LICENSE
  *
- *   Copyright (C) Cavium networks Ltd. 2016.
+ *   Copyright (C) Cavium, Inc. 2016.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
  *       notice, this list of conditions and the following disclaimer in
  *       the documentation and/or other materials provided with the
  *       distribution.
- *     * Neither the name of Cavium networks nor the names of its
+ *     * Neither the name of Cavium, Inc nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
  *
@@ -60,7 +60,7 @@ fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt)
        sqe.gather.subdesc_type = SQ_DESC_TYPE_GATHER;
        sqe.gather.ld_type = NIC_SEND_LD_TYPE_E_LDT;
        sqe.gather.size = pkt->data_len;
-       sqe.gather.addr = rte_mbuf_data_dma_addr(pkt);
+       sqe.gather.addr = rte_mbuf_data_iova(pkt);
 
        entry->buff[0] = sqe.buff[0];
        entry->buff[1] = sqe.buff[1];
@@ -80,10 +80,37 @@ fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt)
        entry->buff[0] = (uint64_t)SQ_DESC_TYPE_GATHER << 60 |
                         (uint64_t)NIC_SEND_LD_TYPE_E_LDT << 58 |
                         pkt->data_len;
-       entry->buff[1] = rte_mbuf_data_dma_addr(pkt);
+       entry->buff[1] = rte_mbuf_data_iova(pkt);
 }
 #endif
 
+static inline void
+nicvf_mbuff_init_update(struct rte_mbuf *pkt, const uint64_t mbuf_init,
+                               uint16_t apad)
+{
+       union mbuf_initializer init = {.value = mbuf_init};
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+       init.fields.data_off += apad;
+#else
+       init.value += apad;
+#endif
+       *(uint64_t *)(&pkt->rearm_data) = init.value;
+}
+
+static inline void
+nicvf_mbuff_init_mseg_update(struct rte_mbuf *pkt, const uint64_t mbuf_init,
+                                               uint16_t apad, uint16_t nb_segs)
+{
+       union mbuf_initializer init = {.value = mbuf_init};
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+       init.fields.data_off += apad;
+#else
+       init.value += apad;
+#endif
+       init.fields.nb_segs = nb_segs;
+       *(uint64_t *)(&pkt->rearm_data) = init.value;
+}
+
 uint32_t nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx);
 uint32_t nicvf_dev_rbdr_refill(struct rte_eth_dev *dev, uint16_t queue_idx);