Skip to contentSkip to conversation

doc: announce API change for rte_ether.h

PATCH In review Stephen Hemminger 4 participants 8 messages Dec 10, 2015 – Dec 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: announce API change for rte_ether.h

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

---
 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -0
index 1c7ab01..8ecb990 100644
@@ -19,3 +19,8 @@ Deprecation Notices
   and table action handlers will be updated:
   the pipeline parameter will be added, the packets mask parameter will be
   either removed (for input port action handler) or made input-only.
+
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].
Signature · 1 line
2.1.4
#1 lore raw
Quoted 15 lines · Stephen Hemminger

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

---
  doc/guides/rel_notes/deprecation.rst | 5 +++++
  1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +0 -0
index 1c7ab01..8ecb990 100644

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 26

Quoted 8 lines
doc/guides/rel_notes/deprecation.rst +5 -0
@@ -19,3 +19,8 @@ Deprecation Notices
    and table action handlers will be updated:
    the pipeline parameter will be added, the packets mask parameter will be
    either removed (for input port action handler) or made input-only.
+
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].

I hope there is some other reason/benefit besides getting rid of a three-line custom struct definition. It may be a trivial s/addr_bytes/ether_addr_octet/ change but it touches a lot of places all over the DPDK codebase alone, and for 3rd party developers such (at least seemingly) gratuitous renames are really irritating.

- Panu -

#2 lore raw
Quoted 31 lines · On Fri, 11 Dec 2015 11:28:48 +0200 Panu Matilainen <[email protected]> wrote:
Quoted 15 lines · Stephen Hemminger

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

---
  doc/guides/rel_notes/deprecation.rst | 5 +++++
  1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +0 -0
index 1c7ab01..8ecb990 100644

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 26

Quoted 8 lines
doc/guides/rel_notes/deprecation.rst +5 -0
@@ -19,3 +19,8 @@ Deprecation Notices
    and table action handlers will be updated:
    the pipeline parameter will be added, the packets mask parameter will be
    either removed (for input port action handler) or made input-only.
+
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].

I hope there is some other reason/benefit besides getting rid of a three-line custom struct definition. It may be a trivial s/addr_bytes/ether_addr_octet/ change but it touches a lot of places all over the DPDK codebase alone, and for 3rd party developers such (at least seemingly) gratuitous renames are really irritating.

Quoted 2 lines

- Panu -

It allows dropping dependency on cmdline in several places in code (by using ether_ntoa instead). The problem was a day 0 choice in DPDK to define their own struct's everywhere.

Acked-by on v1 1/1
#3 lore raw
In reply to Stephen Hemminger

2015-12-10 15:27, Stephen Hemminger:

Quoted 3 lines

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

[...]

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 26

Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +4 -0
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].

Any other votes for this API cleanup?

#4 lore raw
Quoted 11 lines · Thomas Monjalon

2015-12-10 15:27, Stephen Hemminger:

Quoted 3 lines

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

[...]

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 26

Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +4 -0
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].
Quoted 4 lines

Any other votes for this API cleanup?

Are the structures and contents of net/ethernet.h the same on both Linux and FreeBSD?

/Bruce

#5 lore raw

2015-12-14 15:30, Bruce Richardson:

Quoted 12 lines · Thomas Monjalon
Quoted 11 lines

2015-12-10 15:27, Stephen Hemminger:

Quoted 3 lines

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

[...]

Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +4 -0
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].
Quoted 6 lines
Quoted 4 lines

Any other votes for this API cleanup?

Are the structures and contents of net/ethernet.h the same on both Linux and FreeBSD?

Good question. I'm afraid the answer is no.
In FreeBSD, it is ether_addr.octet[].

Linux
-----

struct ether_addr
{
u_int8_t ether_addr_octet[ETH_ALEN];
} __attribute__ ((__packed__));

struct ether_header
{

  u_int8_t  ether_dhost[ETH_ALEN];  /* destination eth addr */
  u_int8_t  ether_shost[ETH_ALEN];  /* source ether addr */

u_int16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));

FreeBSD
-------

struct ether_addr {
u_char octet[ETHER_ADDR_LEN];
} __packed;

struct ether_header {
u_char ether_dhost[ETHER_ADDR_LEN];
u_char ether_shost[ETHER_ADDR_LEN];
u_short ether_type;
} __packed;

#6 lore raw
Quoted 45 lines · Thomas Monjalon

2015-12-14 15:30, Bruce Richardson:

Quoted 12 lines · Thomas Monjalon
Quoted 11 lines

2015-12-10 15:27, Stephen Hemminger:

Quoted 3 lines

Plan to change to <net/ethernet.h> version of struct ether_addr in DPDK 2.3. The change in DPDK source is trivial but it will impact source compatablilty therefore notification is necessary.

[...]

Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +4 -0
+* librte_ether: The structure ether_addr in DPDK will be replaced
+  by using the standard header file <net/ethernet.h>. The structure
+  size will be the same (no ABI impact), but the structure field name
+  will change from addr_bytes[] to ether_addr_octet[].
Quoted 6 lines
Quoted 4 lines

Any other votes for this API cleanup?

Are the structures and contents of net/ethernet.h the same on both Linux and FreeBSD?

Good question. I'm afraid the answer is no.
In FreeBSD, it is ether_addr.octet[].

Linux
-----

struct ether_addr
{
u_int8_t ether_addr_octet[ETH_ALEN];
} __attribute__ ((__packed__));

struct ether_header
{

  u_int8_t  ether_dhost[ETH_ALEN];  /* destination eth addr */
  u_int8_t  ether_shost[ETH_ALEN];  /* source ether addr */

u_int16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));

FreeBSD
-------

struct ether_addr {
u_char octet[ETHER_ADDR_LEN];
} __packed;

Quoted 6 lines

struct ether_header {
u_char ether_dhost[ETHER_ADDR_LEN];
u_char ether_shost[ETHER_ADDR_LEN];
u_short ether_type;
} __packed;

Unfortunate. While the idea seems good, I think the structures being different on the different OS's is a problem that need to be solved before we make such a change.

/Bruce

#7 lore raw
Quoted 15 lines
Quoted 8 lines

FreeBSD
-------

struct ether_addr {
u_char octet[ETHER_ADDR_LEN];
} __packed;

Quoted 6 lines

struct ether_header {
u_char ether_dhost[ETHER_ADDR_LEN];
u_char ether_shost[ETHER_ADDR_LEN];
u_short ether_type;
} __packed;

Quoted 3 lines

Unfortunate. While the idea seems good, I think the structures being different on the different OS's is a problem that need to be solved before we make such a change.

The different BSD variants have different definitions (ie NetBSD different than FreeBSD)

Since the data structures are conformant, the other possiblity is adding ether_ntoa family prototypes to rte_ether.h