Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace the mcopy when transmit packet from BSD to DPDK #364

Merged
merged 11 commits into from
May 21, 2019
Merged

replace the mcopy when transmit packet from BSD to DPDK #364

merged 11 commits into from
May 21, 2019

Conversation

jinhao2
Copy link
Contributor

@jinhao2 jinhao2 commented Mar 29, 2019

  • mmap a fixed number of pages for BSD stack, and mlock() fixed physical memory. Calculate each page's start address and save them. Init a stack structure to manage all allocted pages.

  • replace the ff_mmap()/ff_munmap() by get/free one page from pre_init stack structure.

  • when transmit bsd mbuf, using rte_mbuf's buf_addr/buf_physaddr to reference the real pkt, not using mcopy from mbuf to rte_mbuf.

  • using one circular queue saving sented mbuf's pointer, the queue should be same length with NIC's tx_queue_length. Before one item in queue pushed into new value, the old mbuf must be processed by NIC and can be freed safely.

  • if mbuf is ext_cluster type, which including one rte_mbuf, then using rte_pktmbuf_clone() instead.

  • all functions can be turned of by "USE_PAGE_ARRAY" in ./lib/Makefile

@whl739
Copy link
Member

whl739 commented Mar 29, 2019

Some coding style comments below:

  1. use 4 spaces for indentation.
  2. use lowercase letters for variable names or function names.
  3. use a space after these keywords: if, switch, case, for, do, while.
  4. the preferred use of * is adjacent to the data name or function name and not adjacent to the type name.
  5. put the opening brace last on the line, and put the closing brace first except functions.
  6. it's better to add this feature to a new file, maybe named ff_memory.c, and provide some interfaces which will be called in ff_dpdk_if.c.
  7. macro USE_PAGE_ARRAY is good, but it's better to add in HOST_CFLAGS, because DPDK_CFLAGS is all dpdk related cflags, it can be like this:
ifdef FF_USE_PAGE_ARRAY
HOST_CFLAGS+= -DFF_USE_PAGE_ARRAY
endif

@whl739 whl739 changed the base branch from master to dev May 21, 2019 14:11
@whl739 whl739 merged commit aca62ec into F-Stack:dev May 21, 2019
jfb8856606 pushed a commit that referenced this pull request Jun 25, 2019
replace the mcopy when transmit packet from BSD to DPDK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants