* [PATCH] IB/core: replace memcpy with ether_addr_copy @ 2017-08-24 15:41 ` Himanshu Jha 0 siblings, 0 replies; 7+ messages in thread From: Himanshu Jha @ 2017-08-24 15:41 UTC (permalink / raw) To: dledford-H+wXaHxf7aLQT0dZR+AlfA Cc: sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Himanshu Jha Use ether_addr_copy to copy an ethernet address of size ETH_ALEN instead of memcpy. Signed-off-by: Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/infiniband/core/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 437522c..fc5bf11 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, if (ret) return ret; - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); + ether_addr_copy(dmac, dev_addr.dst_dev_addr); dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); if (!dev) return -ENODEV; @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) if (ret) return ret; - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); + ether_addr_copy(smac, dev_addr.src_dev_addr); return ret; } EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] IB/core: replace memcpy with ether_addr_copy @ 2017-08-24 15:41 ` Himanshu Jha 0 siblings, 0 replies; 7+ messages in thread From: Himanshu Jha @ 2017-08-24 15:41 UTC (permalink / raw) To: dledford; +Cc: sean.hefty, hal.rosenstock, linux-rdma, linux-kernel, Himanshu Jha Use ether_addr_copy to copy an ethernet address of size ETH_ALEN instead of memcpy. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> --- drivers/infiniband/core/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 437522c..fc5bf11 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, if (ret) return ret; - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); + ether_addr_copy(dmac, dev_addr.dst_dev_addr); dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); if (!dev) return -ENODEV; @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) if (ret) return ret; - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); + ether_addr_copy(smac, dev_addr.src_dev_addr); return ret; } EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] IB/core: replace memcpy with ether_addr_copy 2017-08-24 15:41 ` Himanshu Jha (?) @ 2017-08-24 16:06 ` Joe Perches [not found] ` <1503590792.12569.2.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> -1 siblings, 1 reply; 7+ messages in thread From: Joe Perches @ 2017-08-24 16:06 UTC (permalink / raw) To: Himanshu Jha, dledford Cc: sean.hefty, hal.rosenstock, linux-rdma, linux-kernel On Thu, 2017-08-24 at 21:11 +0530, Himanshu Jha wrote: > Use ether_addr_copy to copy an ethernet address of size ETH_ALEN > instead of memcpy. [] diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c [] > @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, > if (ret) > return ret; > > - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); > + ether_addr_copy(dmac, dev_addr.dst_dev_addr); > dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); > if (!dev) > return -ENODEV; > @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) > if (ret) > return ret; > > - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); > + ether_addr_copy(smac, dev_addr.src_dev_addr); > return ret; > } > EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); Both dmac and smac are function arguments. What guarantees these to be aligned properly? ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1503590792.12569.2.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH] IB/core: replace memcpy with ether_addr_copy 2017-08-24 16:06 ` Joe Perches @ 2017-08-24 17:31 ` Himanshu Jha 0 siblings, 0 replies; 7+ messages in thread From: Himanshu Jha @ 2017-08-24 17:31 UTC (permalink / raw) To: Joe Perches Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, Aug 24, 2017 at 09:06:32AM -0700, Joe Perches wrote: > On Thu, 2017-08-24 at 21:11 +0530, Himanshu Jha wrote: > > Use ether_addr_copy to copy an ethernet address of size ETH_ALEN > > instead of memcpy. > [] > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c > [] > > @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, > > if (ret) > > return ret; > > > > - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); > > + ether_addr_copy(dmac, dev_addr.dst_dev_addr); > > dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); > > if (!dev) > > return -ENODEV; > > @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) > > if (ret) > > return ret; > > > > - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); > > + ether_addr_copy(smac, dev_addr.src_dev_addr); > > return ret; > > } > > EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); > > Both dmac and smac are function arguments. > What guarantees these to be > aligned properly? > Yes, you are correct! The arguments should be a pointer to a six byte Ethernet address. Apologies! -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] IB/core: replace memcpy with ether_addr_copy @ 2017-08-24 17:31 ` Himanshu Jha 0 siblings, 0 replies; 7+ messages in thread From: Himanshu Jha @ 2017-08-24 17:31 UTC (permalink / raw) To: Joe Perches Cc: dledford, sean.hefty, hal.rosenstock, linux-rdma, linux-kernel On Thu, Aug 24, 2017 at 09:06:32AM -0700, Joe Perches wrote: > On Thu, 2017-08-24 at 21:11 +0530, Himanshu Jha wrote: > > Use ether_addr_copy to copy an ethernet address of size ETH_ALEN > > instead of memcpy. > [] > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c > [] > > @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, > > if (ret) > > return ret; > > > > - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); > > + ether_addr_copy(dmac, dev_addr.dst_dev_addr); > > dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); > > if (!dev) > > return -ENODEV; > > @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) > > if (ret) > > return ret; > > > > - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); > > + ether_addr_copy(smac, dev_addr.src_dev_addr); > > return ret; > > } > > EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); > > Both dmac and smac are function arguments. > What guarantees these to be > aligned properly? > Yes, you are correct! The arguments should be a pointer to a six byte Ethernet address. Apologies! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] IB/core: replace memcpy with ether_addr_copy 2017-08-24 17:31 ` Himanshu Jha @ 2017-08-24 17:41 ` Joe Perches -1 siblings, 0 replies; 7+ messages in thread From: Joe Perches @ 2017-08-24 17:41 UTC (permalink / raw) To: Himanshu Jha Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, 2017-08-24 at 23:01 +0530, Himanshu Jha wrote: > On Thu, Aug 24, 2017 at 09:06:32AM -0700, Joe Perches wrote: > > On Thu, 2017-08-24 at 21:11 +0530, Himanshu Jha wrote: > > > Use ether_addr_copy to copy an ethernet address of size ETH_ALEN > > > instead of memcpy. > > > > [] > > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c > > [] > > > @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, > > > if (ret) > > > return ret; > > > > > > - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); > > > + ether_addr_copy(dmac, dev_addr.dst_dev_addr); > > > dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); > > > if (!dev) > > > return -ENODEV; > > > @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) > > > if (ret) > > > return ret; > > > > > > - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); > > > + ether_addr_copy(smac, dev_addr.src_dev_addr); > > > return ret; > > > } > > > EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); > > > > Both dmac and smac are function arguments. > > What guarantees these to be > > aligned properly? > > > > Yes, you are correct! > The arguments should be a pointer to a six byte Ethernet address. Just for completeness: The argument should be a pointer to a 6 byte Ethernet address which is also aligned to an even hardware address. i.e.: u8 mac_addr[ETH_ALEN] __aligned(2); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] IB/core: replace memcpy with ether_addr_copy @ 2017-08-24 17:41 ` Joe Perches 0 siblings, 0 replies; 7+ messages in thread From: Joe Perches @ 2017-08-24 17:41 UTC (permalink / raw) To: Himanshu Jha Cc: dledford, sean.hefty, hal.rosenstock, linux-rdma, linux-kernel On Thu, 2017-08-24 at 23:01 +0530, Himanshu Jha wrote: > On Thu, Aug 24, 2017 at 09:06:32AM -0700, Joe Perches wrote: > > On Thu, 2017-08-24 at 21:11 +0530, Himanshu Jha wrote: > > > Use ether_addr_copy to copy an ethernet address of size ETH_ALEN > > > instead of memcpy. > > > > [] > > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c > > [] > > > @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, > > > if (ret) > > > return ret; > > > > > > - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); > > > + ether_addr_copy(dmac, dev_addr.dst_dev_addr); > > > dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); > > > if (!dev) > > > return -ENODEV; > > > @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) > > > if (ret) > > > return ret; > > > > > > - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); > > > + ether_addr_copy(smac, dev_addr.src_dev_addr); > > > return ret; > > > } > > > EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); > > > > Both dmac and smac are function arguments. > > What guarantees these to be > > aligned properly? > > > > Yes, you are correct! > The arguments should be a pointer to a six byte Ethernet address. Just for completeness: The argument should be a pointer to a 6 byte Ethernet address which is also aligned to an even hardware address. i.e.: u8 mac_addr[ETH_ALEN] __aligned(2); ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-08-24 17:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 15:41 [PATCH] IB/core: replace memcpy with ether_addr_copy Himanshu Jha
2017-08-24 15:41 ` Himanshu Jha
2017-08-24 16:06 ` Joe Perches
[not found] ` <1503590792.12569.2.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2017-08-24 17:31 ` Himanshu Jha
2017-08-24 17:31 ` Himanshu Jha
2017-08-24 17:41 ` Joe Perches
2017-08-24 17:41 ` Joe Perches
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.