[ovs-dev,3/3] The netdev-dpdk uses the struct ether_addr rather than struct eth_addr internal ovs datatype.
diff mbox

Message ID 1441400010-15363-4-git-send-email-aconole@redhat.com
State Accepted
Headers show

Commit Message

Aaron Conole Sept. 4, 2015, 8:53 p.m. UTC
To facilitate using either the .ea OR the struct ether_addr.addr_bytes
argument for printing/logging, add a new ETH_ADDR_BYTES_ARG() define.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 lib/netdev-dpdk.c | 4 ++--
 lib/packets.h     | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Sept. 4, 2015, 11:32 p.m. UTC | #1
Would one of you mind reviewing this?

Thanks,

Ben.

On Fri, Sep 04, 2015 at 04:53:30PM -0400, Aaron Conole wrote:
> To facilitate using either the .ea OR the struct ether_addr.addr_bytes
> argument for printing/logging, add a new ETH_ADDR_BYTES_ARG() define.
> 
> Signed-off-by: Aaron Conole <aconole@redhat.com>
> ---
>  lib/netdev-dpdk.c | 4 ++--
>  lib/packets.h     | 4 +++-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 4ce0a1e..de8256e 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -524,9 +524,9 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex)
>      memset(&eth_addr, 0x0, sizeof(eth_addr));
>      rte_eth_macaddr_get(dev->port_id, &eth_addr);
>      VLOG_INFO_RL(&rl, "Port %d: "ETH_ADDR_FMT"",
> -                    dev->port_id, ETH_ADDR_ARGS(eth_addr.addr_bytes));
> +                    dev->port_id, ETH_ADDR_BYTES_ARG(eth_addr.addr_bytes));
>  
> -    memcpy(dev->hwaddr, eth_addr.addr_bytes, ETH_ADDR_LEN);
> +    memcpy(dev->hwaddr.ea, eth_addr.addr_bytes, ETH_ADDR_LEN);
>      rte_eth_link_get_nowait(dev->port_id, &dev->link);
>  
>      mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp);
> diff --git a/lib/packets.h b/lib/packets.h
> index a4f6383..b700e4b 100644
> --- a/lib/packets.h
> +++ b/lib/packets.h
> @@ -324,7 +324,9 @@ ovs_be32 set_mpls_lse_values(uint8_t ttl, uint8_t tc, uint8_t bos,
>  #define ETH_ADDR_SCAN_FMT "%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8
>  #define ETH_ADDR_SCAN_ARGS(EA) \
>      &(EA).ea[0], &(EA).ea[1], &(EA).ea[2], &(EA).ea[3], &(EA).ea[4], &(EA).ea[5]
> -
> +#define ETH_ADDR_BYTES_ARG(EAB) \
> +         EAB[0],     EAB[1],     EAB[2],     EAB[3],     EAB[4],     EAB[5]
> +    
>  #define ETH_TYPE_IP            0x0800
>  #define ETH_TYPE_ARP           0x0806
>  #define ETH_TYPE_TEB           0x6558
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Ben Pfaff Sept. 6, 2015, 2:46 a.m. UTC | #2
This was causing build failures in travis so I reviewed it and applied
myself after all.

I made stylistic and commit message changes.

On Fri, Sep 04, 2015 at 04:32:11PM -0700, Ben Pfaff wrote:
> Would one of you mind reviewing this?
> 
> Thanks,
> 
> Ben.
> 
> On Fri, Sep 04, 2015 at 04:53:30PM -0400, Aaron Conole wrote:
> > To facilitate using either the .ea OR the struct ether_addr.addr_bytes
> > argument for printing/logging, add a new ETH_ADDR_BYTES_ARG() define.
> > 
> > Signed-off-by: Aaron Conole <aconole@redhat.com>
> > ---
> >  lib/netdev-dpdk.c | 4 ++--
> >  lib/packets.h     | 4 +++-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> > index 4ce0a1e..de8256e 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -524,9 +524,9 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex)
> >      memset(&eth_addr, 0x0, sizeof(eth_addr));
> >      rte_eth_macaddr_get(dev->port_id, &eth_addr);
> >      VLOG_INFO_RL(&rl, "Port %d: "ETH_ADDR_FMT"",
> > -                    dev->port_id, ETH_ADDR_ARGS(eth_addr.addr_bytes));
> > +                    dev->port_id, ETH_ADDR_BYTES_ARG(eth_addr.addr_bytes));
> >  
> > -    memcpy(dev->hwaddr, eth_addr.addr_bytes, ETH_ADDR_LEN);
> > +    memcpy(dev->hwaddr.ea, eth_addr.addr_bytes, ETH_ADDR_LEN);
> >      rte_eth_link_get_nowait(dev->port_id, &dev->link);
> >  
> >      mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp);
> > diff --git a/lib/packets.h b/lib/packets.h
> > index a4f6383..b700e4b 100644
> > --- a/lib/packets.h
> > +++ b/lib/packets.h
> > @@ -324,7 +324,9 @@ ovs_be32 set_mpls_lse_values(uint8_t ttl, uint8_t tc, uint8_t bos,
> >  #define ETH_ADDR_SCAN_FMT "%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8
> >  #define ETH_ADDR_SCAN_ARGS(EA) \
> >      &(EA).ea[0], &(EA).ea[1], &(EA).ea[2], &(EA).ea[3], &(EA).ea[4], &(EA).ea[5]
> > -
> > +#define ETH_ADDR_BYTES_ARG(EAB) \
> > +         EAB[0],     EAB[1],     EAB[2],     EAB[3],     EAB[4],     EAB[5]
> > +    
> >  #define ETH_TYPE_IP            0x0800
> >  #define ETH_TYPE_ARP           0x0806
> >  #define ETH_TYPE_TEB           0x6558
> > -- 
> > 1.8.3.1
> > 
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
Mark Kavanagh Sept. 7, 2015, 8:08 a.m. UTC | #3
Hi Ben,

I pushed a patch that addresses that same issue early last week (September 2 - http://openvswitch.org/pipermail/dev/2015-September/059541.html) - just curious if there was any particular reason why this patch (which seems to have been submitted on September 4th) was selected over mine?

Thanks in advance,
Mark

>-----Original Message-----

>From: dev [mailto:dev-bounces@openvswitch.org] On Behalf Of Ben Pfaff

>Sent: Sunday, September 6, 2015 3:47 AM

>To: Pravin Shelar; Daniele di Proietto

>Cc: dev@openvswitch.com

>Subject: Re: [ovs-dev] [PATCH 3/3] The netdev-dpdk uses the struct ether_addr rather than

>struct eth_addr internal ovs datatype.

>

>This was causing build failures in travis so I reviewed it and applied

>myself after all.

>

>I made stylistic and commit message changes.

>

>On Fri, Sep 04, 2015 at 04:32:11PM -0700, Ben Pfaff wrote:

>> Would one of you mind reviewing this?

>>

>> Thanks,

>>

>> Ben.

>>

>> On Fri, Sep 04, 2015 at 04:53:30PM -0400, Aaron Conole wrote:

>> > To facilitate using either the .ea OR the struct ether_addr.addr_bytes

>> > argument for printing/logging, add a new ETH_ADDR_BYTES_ARG() define.

>> >

>> > Signed-off-by: Aaron Conole <aconole@redhat.com>

>> > ---

>> >  lib/netdev-dpdk.c | 4 ++--

>> >  lib/packets.h     | 4 +++-

>> >  2 files changed, 5 insertions(+), 3 deletions(-)

>> >

>> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c

>> > index 4ce0a1e..de8256e 100644

>> > --- a/lib/netdev-dpdk.c

>> > +++ b/lib/netdev-dpdk.c

>> > @@ -524,9 +524,9 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev)

>OVS_REQUIRES(dpdk_mutex)

>> >      memset(&eth_addr, 0x0, sizeof(eth_addr));

>> >      rte_eth_macaddr_get(dev->port_id, &eth_addr);

>> >      VLOG_INFO_RL(&rl, "Port %d: "ETH_ADDR_FMT"",

>> > -                    dev->port_id, ETH_ADDR_ARGS(eth_addr.addr_bytes));

>> > +                    dev->port_id, ETH_ADDR_BYTES_ARG(eth_addr.addr_bytes));

>> >

>> > -    memcpy(dev->hwaddr, eth_addr.addr_bytes, ETH_ADDR_LEN);

>> > +    memcpy(dev->hwaddr.ea, eth_addr.addr_bytes, ETH_ADDR_LEN);

>> >      rte_eth_link_get_nowait(dev->port_id, &dev->link);

>> >

>> >      mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp);

>> > diff --git a/lib/packets.h b/lib/packets.h

>> > index a4f6383..b700e4b 100644

>> > --- a/lib/packets.h

>> > +++ b/lib/packets.h

>> > @@ -324,7 +324,9 @@ ovs_be32 set_mpls_lse_values(uint8_t ttl, uint8_t tc, uint8_t bos,

>> >  #define ETH_ADDR_SCAN_FMT "%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8

>> >  #define ETH_ADDR_SCAN_ARGS(EA) \

>> >      &(EA).ea[0], &(EA).ea[1], &(EA).ea[2], &(EA).ea[3], &(EA).ea[4], &(EA).ea[5]

>> > -

>> > +#define ETH_ADDR_BYTES_ARG(EAB) \

>> > +         EAB[0],     EAB[1],     EAB[2],     EAB[3],     EAB[4],     EAB[5]

>> > +

>> >  #define ETH_TYPE_IP            0x0800

>> >  #define ETH_TYPE_ARP           0x0806

>> >  #define ETH_TYPE_TEB           0x6558

>> > --

>> > 1.8.3.1

>> >

>> > _______________________________________________

>> > dev mailing list

>> > dev@openvswitch.org

>> > http://openvswitch.org/mailman/listinfo/dev

>_______________________________________________

>dev mailing list

>dev@openvswitch.org

>http://openvswitch.org/mailman/listinfo/dev
Aaron Conole Sept. 7, 2015, 1:45 p.m. UTC | #4
On Sat, Sep 05, 2015 at 07:46:54PM -0700, Ben Pfaff wrote:
> This was causing build failures in travis so I reviewed it and applied
> myself after all.
> 
> I made stylistic and commit message changes.
> 
Thank you for the changes, I ack them ;)

-Aaron
Ben Pfaff Sept. 7, 2015, 5:04 p.m. UTC | #5
On Mon, Sep 07, 2015 at 08:08:39AM +0000, Kavanagh, Mark B wrote:
> I pushed a patch that addresses that same issue early last week
> (September 2 -
> http://openvswitch.org/pipermail/dev/2015-September/059541.html) -
> just curious if there was any particular reason why this patch (which
> seems to have been submitted on September 4th) was selected over mine?

Just luck in terms of which patch I looked at first.  Sorry.
Mark Kavanagh Sept. 8, 2015, 9:07 a.m. UTC | #6
No worries - thanks for the update.

>-----Original Message-----
>From: Ben Pfaff [mailto:blp@nicira.com]
>Sent: Monday, September 7, 2015 6:04 PM
>To: Kavanagh, Mark B
>Cc: Pravin Shelar; Daniele di Proietto; dev@openvswitch.com
>Subject: Re: [ovs-dev] [PATCH 3/3] The netdev-dpdk uses the struct ether_addr rather than
>struct eth_addr internal ovs datatype.
>
>On Mon, Sep 07, 2015 at 08:08:39AM +0000, Kavanagh, Mark B wrote:
>> I pushed a patch that addresses that same issue early last week
>> (September 2 -
>> http://openvswitch.org/pipermail/dev/2015-September/059541.html) -
>> just curious if there was any particular reason why this patch (which
>> seems to have been submitted on September 4th) was selected over mine?
>
>Just luck in terms of which patch I looked at first.  Sorry.

Patch
diff mbox

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 4ce0a1e..de8256e 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -524,9 +524,9 @@  dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex)
     memset(&eth_addr, 0x0, sizeof(eth_addr));
     rte_eth_macaddr_get(dev->port_id, &eth_addr);
     VLOG_INFO_RL(&rl, "Port %d: "ETH_ADDR_FMT"",
-                    dev->port_id, ETH_ADDR_ARGS(eth_addr.addr_bytes));
+                    dev->port_id, ETH_ADDR_BYTES_ARG(eth_addr.addr_bytes));
 
-    memcpy(dev->hwaddr, eth_addr.addr_bytes, ETH_ADDR_LEN);
+    memcpy(dev->hwaddr.ea, eth_addr.addr_bytes, ETH_ADDR_LEN);
     rte_eth_link_get_nowait(dev->port_id, &dev->link);
 
     mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp);
diff --git a/lib/packets.h b/lib/packets.h
index a4f6383..b700e4b 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -324,7 +324,9 @@  ovs_be32 set_mpls_lse_values(uint8_t ttl, uint8_t tc, uint8_t bos,
 #define ETH_ADDR_SCAN_FMT "%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8":%"SCNx8
 #define ETH_ADDR_SCAN_ARGS(EA) \
     &(EA).ea[0], &(EA).ea[1], &(EA).ea[2], &(EA).ea[3], &(EA).ea[4], &(EA).ea[5]
-
+#define ETH_ADDR_BYTES_ARG(EAB) \
+         EAB[0],     EAB[1],     EAB[2],     EAB[3],     EAB[4],     EAB[5]
+    
 #define ETH_TYPE_IP            0x0800
 #define ETH_TYPE_ARP           0x0806
 #define ETH_TYPE_TEB           0x6558