Skip to content

Commit

Permalink
dpdk: get rid of backward compatibility code
Browse files Browse the repository at this point in the history
   - README-DPDK.md:Bump the supported version to 2.0.0 and update
     the instructions.
   - Get rid of the compat macros and align the code with 2.0.0 semantics.

Signed-off-by: Vlad Zolotarov <[email protected]>
  • Loading branch information
Vlad Zolotarov authored and avikivity committed Jul 28, 2015
1 parent ce6c5c8 commit 020fb16
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 187 deletions.
16 changes: 6 additions & 10 deletions README-DPDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ To use your own self-compiled DPDK package, follow this procedure:
- Ubuntu
`sudo apt-get install -y build-essential linux-image-extra-$(uname -r)`
2. Prepare a DPDK SDK:
- Download the latest DPDK release: `wget http://dpdk.org/browse/dpdk/snapshot/dpdk-1.8.0.tar.gz`
- Download the latest DPDK release: `wget http://dpdk.org/browse/dpdk/snapshot/dpdk-2.0.0.tar.gz`
- Untar it.
- Edit config/common_linuxapp: set CONFIG_RTE_MBUF_REFCNT and CONFIG_RTE_LIBRTE_KNI to 'n'.
- For DPDK 1.7.x: edit config/common_linuxapp:
- Set CONFIG_RTE_LIBRTE_PMD_BOND to 'n'.
- Set CONFIG_RTE_MBUF_SCATTER_GATHER to 'n'.
- Set CONFIG_RTE_LIBRTE_IP_FRAG to 'n'.
- Edit config/common_linuxapp: set CONFIG_RTE_MBUF_REFCNT_ATOMIC and CONFIG_RTE_LIBRTE_KNI to 'n'.
- Start the tools/setup.sh script as root.
- Compile a linuxapp target (option 9).
- Install IGB_UIO module (option 11).
- Bind some physical port to IGB_UIO (option 17).
- Configure hugepage mappings (option 14/15).
3. Run a configure.py: `./configure.py --dpdk-target <Path to untared dpdk-1.8.0 above>/x86_64-native-linuxapp-gcc`.
- Install IGB_UIO module (option 12).
- Bind some physical port to IGB_UIO (option 18).
- Configure hugepage mappings (option 15/16).
3. Run a configure.py: `./configure.py --dpdk-target <Path to untared dpdk-2.0.0 above>/x86_64-native-linuxapp-gcc`.
8 changes: 0 additions & 8 deletions core/dpdk_rte.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ void eal::init(cpuset cpus, boost::program_options::variables_map opts)
rte_exit(EXIT_FAILURE, "Cannot init EAL\n");
}

// For 1.8 rte_eal_pci_probe() has been moved into the rte_eal_init().
#ifdef RTE_VERSION_1_7
/* probe the PCI devices in case we need to use DPDK drivers */
if (rte_eal_pci_probe() < 0) {
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
}
#endif

initialized = true;
}

Expand Down
48 changes: 5 additions & 43 deletions core/dpdk_rte.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,53 +27,15 @@
#include <boost/program_options.hpp>

/*********************** Compat section ***************************************/
// We currently support only versions 1.7 and above.
// So, since currently the only above version is 1.8.x we will use it as "else"
// of ver. 1.7.x.
#if (RTE_VERSION >= RTE_VERSION_NUM(1,7,0,0)) && \
(RTE_VERSION < RTE_VERSION_NUM(1,8,0,0))
#define RTE_VERSION_1_7
#endif

#ifdef RTE_VERSION_1_7
#if defined(RTE_LIBRTE_PMD_BOND) || defined(RTE_MBUF_SCATTER_GATHER) || \
defined(RTE_LIBRTE_IP_FRAG)
#error "RTE_LIBRTE_PMD_BOND, RTE_MBUF_SCATTER_GATHER," \
"and RTE_LIBRTE_IP_FRAG should be disabled in DPDK's " \
"config/common_linuxapp"
#endif

#define rte_mbuf_vlan_tci(m) ((m)->pkt.vlan_macip.f.vlan_tci)
#define rte_mbuf_rss_hash(m) ((m)->pkt.hash.rss)
#define rte_mbuf_data_len(m) ((m)->pkt.data_len)
#define rte_mbuf_pkt_len(m) ((m)->pkt.pkt_len)
#define rte_mbuf_next(m) ((m)->pkt.next)
#define rte_mbuf_nb_segs(m) ((m)->pkt.nb_segs)
#define rte_mbuf_l2_len(m) ((m)->pkt.vlan_macip.f.l2_len)
#define rte_mbuf_l3_len(m) ((m)->pkt.vlan_macip.f.l3_len)
#define rte_mbuf_buf_addr(m) ((m)->buf_addr)
#define rte_mbuf_buf_physaddr(m) ((m)->buf_physaddr)
#define rte_mbuf_buf_len(m) ((m)->buf_len)
#else
// We currently support only versions 2.0 and above.
#if (RTE_VERSION < RTE_VERSION_NUM(2,0,0,0))
#if defined(RTE_MBUF_REFCNT)
#error "RTE_MBUF_REFCNT should be disabled in DPDK's config/common_linuxapp"
#endif
#error "DPDK version above 2.0.0 is required"
#endif
#define rte_mbuf_vlan_tci(m) ((m)->vlan_tci)
#define rte_mbuf_rss_hash(m) ((m)->hash.rss)
#define rte_mbuf_data_len(m) ((m)->data_len)
#define rte_mbuf_pkt_len(m) ((m)->pkt_len)
#define rte_mbuf_next(m) ((m)->next)
#define rte_mbuf_nb_segs(m) ((m)->nb_segs)
#define rte_mbuf_l2_len(m) ((m)->l2_len)
#define rte_mbuf_l3_len(m) ((m)->l3_len)
#define rte_mbuf_buf_addr(m) ((m)->buf_addr)
#define rte_mbuf_buf_physaddr(m) ((m)->buf_physaddr)
#define rte_mbuf_buf_len(m) ((m)->buf_len)

#if defined(RTE_MBUF_REFCNT_ATOMIC)
#warning "CONFIG_RTE_MBUF_REFCNT_ATOMIC should be disabled in DPDK's " \
"config/common_linuxapp"
#endif

/******************************************************************************/

namespace dpdk {
Expand Down
Loading

0 comments on commit 020fb16

Please sign in to comment.