From: Simon Horman <horms@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Felix Fietkau <nbd@nbd.name>,
John Crispin <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: use be32 type to store be32 values
Date: Mon, 3 Apr 2023 14:52:38 +0200 [thread overview]
Message-ID: <ZCrMFtTxZSjqjdTZ@kernel.org> (raw)
In-Reply-To: <c7684349-535c-45a4-9a74-d47479a50020@lunn.ch>
On Sat, Apr 01, 2023 at 05:55:35PM +0200, Andrew Lunn wrote:
> On Sat, Apr 01, 2023 at 08:43:44AM +0200, Simon Horman wrote:
> > Perhaps there is a nicer way to handle this but the code
> > calls for converting an array of host byte order 32bit values
> > to big endian 32bit values: an ipv6 address to be pretty printed.
>
> Hi Simon
>
> Maybe make a generic helper? I could be used in other places, e.g:
>
> https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c#L6773
Hi Andrew,
do you mean something like this?
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 7332296eca44..cff6c1177502 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -935,6 +935,11 @@ static inline void iph_to_flow_copy_v6addrs(struct flow_keys *flow,
flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
}
+static inline void ipv6_addr_cpu_to_be32(__be32 *dst, const u32 *src)
+{
+ cpu_to_be32_array(dst, src, 4);
+}
+
#if IS_ENABLED(CONFIG_IPV6)
static inline bool ipv6_can_nonlocal_bind(struct net *net,
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Felix Fietkau <nbd@nbd.name>,
John Crispin <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: use be32 type to store be32 values
Date: Mon, 3 Apr 2023 14:52:38 +0200 [thread overview]
Message-ID: <ZCrMFtTxZSjqjdTZ@kernel.org> (raw)
In-Reply-To: <c7684349-535c-45a4-9a74-d47479a50020@lunn.ch>
On Sat, Apr 01, 2023 at 05:55:35PM +0200, Andrew Lunn wrote:
> On Sat, Apr 01, 2023 at 08:43:44AM +0200, Simon Horman wrote:
> > Perhaps there is a nicer way to handle this but the code
> > calls for converting an array of host byte order 32bit values
> > to big endian 32bit values: an ipv6 address to be pretty printed.
>
> Hi Simon
>
> Maybe make a generic helper? I could be used in other places, e.g:
>
> https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c#L6773
Hi Andrew,
do you mean something like this?
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 7332296eca44..cff6c1177502 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -935,6 +935,11 @@ static inline void iph_to_flow_copy_v6addrs(struct flow_keys *flow,
flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
}
+static inline void ipv6_addr_cpu_to_be32(__be32 *dst, const u32 *src)
+{
+ cpu_to_be32_array(dst, src, 4);
+}
+
#if IS_ENABLED(CONFIG_IPV6)
static inline bool ipv6_can_nonlocal_bind(struct net *net,
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-03 12:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-01 6:43 [PATCH] net: ethernet: mtk_eth_soc: use be32 type to store be32 values Simon Horman
2023-04-01 6:43 ` Simon Horman
2023-04-01 7:31 ` Simon Horman
2023-04-01 7:31 ` Simon Horman
2023-04-01 15:55 ` Andrew Lunn
2023-04-01 15:55 ` Andrew Lunn
2023-04-03 12:52 ` Simon Horman [this message]
2023-04-03 12:52 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZCrMFtTxZSjqjdTZ@kernel.org \
--to=horms@kernel.org \
--cc=Mark-MC.Lee@mediatek.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.