* [PATCH -next] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair
@ 2022-09-27 2:29 Shang XiaoJing
2022-09-27 12:10 ` Dennis Dalessandro
2022-09-27 14:12 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Shang XiaoJing @ 2022-09-27 2:29 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma; +Cc: shangxiaojing
Use skb_put_data() instead of skb_put() and memcpy(), which is shorter
and clear. Drop the tmp variable that is not needed any more.
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
drivers/infiniband/hw/hfi1/ipoib_rx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/ipoib_rx.c b/drivers/infiniband/hw/hfi1/ipoib_rx.c
index 3afa7545242c..629691a572ef 100644
--- a/drivers/infiniband/hw/hfi1/ipoib_rx.c
+++ b/drivers/infiniband/hw/hfi1/ipoib_rx.c
@@ -11,13 +11,10 @@
static void copy_ipoib_buf(struct sk_buff *skb, void *data, int size)
{
- void *dst_data;
-
skb_checksum_none_assert(skb);
skb->protocol = *((__be16 *)data);
- dst_data = skb_put(skb, size);
- memcpy(dst_data, data, size);
+ skb_put_data(skb, data, size);
skb->mac_header = HFI1_IPOIB_PSEUDO_LEN;
skb_pull(skb, HFI1_IPOIB_ENCAP_LEN);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair
2022-09-27 2:29 [PATCH -next] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair Shang XiaoJing
@ 2022-09-27 12:10 ` Dennis Dalessandro
2022-09-27 14:12 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Dennis Dalessandro @ 2022-09-27 12:10 UTC (permalink / raw)
To: Shang XiaoJing, jgg, leon, linux-rdma
On 9/26/22 10:29 PM, Shang XiaoJing wrote:
> Use skb_put_data() instead of skb_put() and memcpy(), which is shorter
> and clear. Drop the tmp variable that is not needed any more.
>
> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> ---
> drivers/infiniband/hw/hfi1/ipoib_rx.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/ipoib_rx.c b/drivers/infiniband/hw/hfi1/ipoib_rx.c
> index 3afa7545242c..629691a572ef 100644
> --- a/drivers/infiniband/hw/hfi1/ipoib_rx.c
> +++ b/drivers/infiniband/hw/hfi1/ipoib_rx.c
> @@ -11,13 +11,10 @@
>
> static void copy_ipoib_buf(struct sk_buff *skb, void *data, int size)
> {
> - void *dst_data;
> -
> skb_checksum_none_assert(skb);
> skb->protocol = *((__be16 *)data);
>
> - dst_data = skb_put(skb, size);
> - memcpy(dst_data, data, size);
> + skb_put_data(skb, data, size);
> skb->mac_header = HFI1_IPOIB_PSEUDO_LEN;
> skb_pull(skb, HFI1_IPOIB_ENCAP_LEN);
> }
Seems OK to me. Although I don't know that it's any more "clear". More
appropriate commit message would say it removes the open coded way of doing
things. Regardless...
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair
2022-09-27 2:29 [PATCH -next] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair Shang XiaoJing
2022-09-27 12:10 ` Dennis Dalessandro
@ 2022-09-27 14:12 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2022-09-27 14:12 UTC (permalink / raw)
To: Shang XiaoJing, leon, jgg, linux-rdma, dennis.dalessandro
On Tue, 27 Sep 2022 10:29:19 +0800, Shang XiaoJing wrote:
> Use skb_put_data() instead of skb_put() and memcpy(), which is shorter
> and clear. Drop the tmp variable that is not needed any more.
>
>
Applied, thanks!
[1/1] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair
https://git.kernel.org/rdma/rdma/c/cbdae01d8b517b
Best regards,
--
Jason Gunthorpe <jgg@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-27 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 2:29 [PATCH -next] IB/hfi1: Use skb_put_data() instead of skb_put/memcpy pair Shang XiaoJing
2022-09-27 12:10 ` Dennis Dalessandro
2022-09-27 14:12 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).