]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/dpdk: be compatible with DPDK 19.11 39460/head
authorKefu Chai <kchai@redhat.com>
Sun, 14 Feb 2021 07:30:26 +0000 (15:30 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 14 Feb 2021 15:11:33 +0000 (23:11 +0800)
since SPDK 21.01 has picked up DPDK 20.11, would be ideal if we can be
compatible with DPDK 19.11 at least

* s/ ETHER_/ RTE_ETHER_/
* s/struct ether_addr/struct rte_ether_addr/
* s/struct ether_hdr/struct rte_ether_hdr/

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/msg/async/dpdk/DPDK.cc
src/msg/async/dpdk/DPDK.h

index 0c1f0b2af8a1bb8acc70c033ec6da4460799100b..a17e1788e5474754aca0518d0c10bd4723decc49 100644 (file)
@@ -29,6 +29,7 @@
 #include <rte_eal.h>
 #include <rte_pci.h>
 #include <rte_ethdev.h>
+#include <rte_ether.h>
 #include <rte_cycles.h>
 #include <rte_memzone.h>
 
@@ -1023,14 +1024,14 @@ void DPDKQueuePair::tx_buf::set_cluster_offload_info(const Packet& p, const DPDK
   if (oi.needs_ip_csum) {
     head->ol_flags |= PKT_TX_IP_CKSUM;
     // TODO: Take a VLAN header into an account here
-    head->l2_len = sizeof(struct ether_hdr);
+    head->l2_len = sizeof(struct rte_ether_hdr);
     head->l3_len = oi.ip_hdr_len;
   }
   if (qp.port().get_hw_features().tx_csum_l4_offload) {
     if (oi.protocol == ip_protocol_num::tcp) {
       head->ol_flags |= PKT_TX_TCP_CKSUM;
       // TODO: Take a VLAN header into an account here
-      head->l2_len = sizeof(struct ether_hdr);
+      head->l2_len = sizeof(struct rte_ether_hdr);
       head->l3_len = oi.ip_hdr_len;
 
       if (oi.tso_seg_size) {
index ca9a124f2f7dab1b01a335701f4e17fc619bb581..eadba40fb49123af5b00f37b9425329598e2cea1 100644 (file)
@@ -353,7 +353,7 @@ class DPDKQueuePair {
    public:
     tx_buf(tx_buf_factory& fc) : _fc(fc) {
 
-      _buf_physaddr = _mbuf.buf_physaddr;
+      _buf_physaddr = _mbuf.buf_iova;
       _data_off     = _mbuf.data_off;
     }
 
@@ -366,7 +366,7 @@ class DPDKQueuePair {
 
       // Set the mbuf to point to our data
       _mbuf.buf_addr           = va;
-      _mbuf.buf_physaddr       = pa;
+      _mbuf.buf_iova           = pa;
       _mbuf.data_off           = 0;
       _is_zc                   = true;
     }
@@ -384,14 +384,14 @@ class DPDKQueuePair {
         // to call the "packet"'s destructor and reset the
         // "optional" state to "nonengaged".
         //
-        _p.destroy();
+        _p.reset();
 
       } else if (!_is_zc) {
         return;
       }
 
       // Restore the rte_mbuf fields we trashed in set_zc_info()
-      _mbuf.buf_physaddr = _buf_physaddr;
+      _mbuf.buf_iova     = _buf_physaddr;
       _mbuf.buf_addr     = rte_mbuf_to_baddr(&_mbuf);
       _mbuf.data_off     = _data_off;
 
@@ -618,7 +618,7 @@ class DPDKQueuePair {
     // actual data buffer.
     //
     m->buf_addr      = (char*)data - RTE_PKTMBUF_HEADROOM;
-    m->buf_physaddr  = rte_mem_virt2phy(data) - RTE_PKTMBUF_HEADROOM;
+    m->buf_iova      = rte_mem_virt2iova(data) - RTE_PKTMBUF_HEADROOM;
     return true;
   }
 
@@ -845,7 +845,7 @@ class DPDKDevice {
     return sub;
   }
   ethernet_address hw_address() {
-    struct ether_addr mac;
+    struct rte_ether_addr mac;
     rte_eth_macaddr_get(_port_idx, &mac);
 
     return mac.addr_bytes;