On 07/03/15 10:05, Nicolas Morey-Chaisemartin wrote:
The goal of this patch series is to remove all the switch/case from all
the odp_packet_io.c functions and go through a generic interface (function 
pointers) that
each pktio implementation should implement.

This means that adding a new pktio type now only requires a few single steps
and no changes in odp_packet_io.c:
* Implement a pktio_if_opts_t structure
= Make sure that the new setup function will only use the interfaces it is 
intended to
= Maybe reorder packet_io type enum to handle type priority
* Add the new pktio_type to the enum and to the global pktio_if_opts structure
* Compile and run !

This way, any port of ODP should be able to add its own interface type without 
touching odp_packet_io.c

The patch series is a bit long. It starts with a bit of cleanup and 
reorganizing functions in different files,
then add a bunch of new methods to move from the basic odp_packet_io.c 
functions to pktio type specific functions.
The last one is still a bit big, but I'm not sure how to split it to make it 
more human friendly to read/understand.
It changes a little bit the existing open/close function API to match the new 
interface, remove all declaration from headers and switch to the new function 
pointer interface

I really like that changes. They should simplify porting to new platform and adding new pktio.

Also we can think about moving all pktio files to platform/linux-generic/pktio/ or directory, so that
we can remove odp_packet_ prefix in all file names.

I think it might be interesting to use dpdk way to include new pktio drivers. I.e. the same thing like they do with PMD. Just link all pkio to library then walk thought symbols and find all available "drivers", then register them. Because we reference to pktio by name, not by enum value it should work in our case. I.e. if we implement code like that to add new pktio we even
don't need to extend any internal enum.

But change is fine for me.

Maxim.

Nicolas Morey-Chaisemartin (15):
   linux-generic: pktio: replace linux/if.h by net/if.h
   checkpatch: remove check for potential ether_addr_copy
   linux-generic: packet_socket: move socket_mmap to another file
   linux-generic: packet_io: move loopback to another file
   linux-generic: packet_loop: add function get MTU
   linux-generic: packet_loop: add method to get mac address
   linux-generic: packet_loop: add method to close a loopback pktio
   linux-generic: packet_loop: add method for setting promisc mode
   linux-generic: packet_pool: add method to get promisc mode
   linux-generic: packet_io: add mtu_get methods for all pktio_socks
   linux-generic: packet_io: add mac_addr_get methods for all pktio_socks
   linux-generic: packet_io: promisc_mode_set methods for all pktio_socks
   linux-generic: packet_io: promisc_mode_get methods for all pktio_socks
   linux-generic: packet_io: packet_sock_* self closes on error during
     setup
   linux-generic: packet_io: use generic interface for all pktio
     implementations

  platform/linux-generic/Makefile.am                 |   3 +
  .../linux-generic/include/odp_packet_io_internal.h |  31 +-
  platform/linux-generic/include/odp_packet_socket.h |  44 +-
  platform/linux-generic/odp_packet_io.c             | 272 +--------
  platform/linux-generic/odp_packet_io_ops.c         |  14 +
  platform/linux-generic/odp_packet_loop.c           | 116 ++++
  platform/linux-generic/odp_packet_socket.c         | 618 +++++----------------
  platform/linux-generic/odp_packet_socket_mmap.c    | 543 ++++++++++++++++++
  scripts/checkpatch.pl                              |  10 -
  9 files changed, 894 insertions(+), 757 deletions(-)
  create mode 100644 platform/linux-generic/odp_packet_io_ops.c
  create mode 100644 platform/linux-generic/odp_packet_loop.c
  create mode 100644 platform/linux-generic/odp_packet_socket_mmap.c


_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to