* [PATCH net-next] net: dsa: b53: Utilize common helpers for u64/MAC
@ 2017-01-04 21:53 Florian Fainelli
2017-01-04 22:07 ` Andrew Lunn
2017-01-05 13:39 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2017-01-04 21:53 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, volodymyr.bendiuga,
Florian Fainelli
Utilize the two functions recently introduced: u64_to_ether() and
ether_to_u64() instead of our own versions.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 2 +-
drivers/net/dsa/b53/b53_priv.h | 23 ++---------------------
2 files changed, 3 insertions(+), 22 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 947adda3397d..d5370c227043 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1137,7 +1137,7 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
int ret;
/* Convert the array into a 64-bit MAC */
- mac = b53_mac_to_u64(addr);
+ mac = ether_addr_to_u64(addr);
/* Perform a read for the given MAC and VID */
b53_write48(dev, B53_ARLIO_PAGE, B53_MAC_ADDR_IDX, mac);
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index f192a673caba..d9833540fe26 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -325,25 +325,6 @@ struct b53_arl_entry {
u8 is_static:1;
};
-static inline void b53_mac_from_u64(u64 src, u8 *dst)
-{
- unsigned int i;
-
- for (i = 0; i < ETH_ALEN; i++)
- dst[ETH_ALEN - 1 - i] = (src >> (8 * i)) & 0xff;
-}
-
-static inline u64 b53_mac_to_u64(const u8 *src)
-{
- unsigned int i;
- u64 dst = 0;
-
- for (i = 0; i < ETH_ALEN; i++)
- dst |= (u64)src[ETH_ALEN - 1 - i] << (8 * i);
-
- return dst;
-}
-
static inline void b53_arl_to_entry(struct b53_arl_entry *ent,
u64 mac_vid, u32 fwd_entry)
{
@@ -352,14 +333,14 @@ static inline void b53_arl_to_entry(struct b53_arl_entry *ent,
ent->is_valid = !!(fwd_entry & ARLTBL_VALID);
ent->is_age = !!(fwd_entry & ARLTBL_AGE);
ent->is_static = !!(fwd_entry & ARLTBL_STATIC);
- b53_mac_from_u64(mac_vid, ent->mac);
+ u64_to_ether_addr(mac_vid, ent->mac);
ent->vid = mac_vid >> ARLTBL_VID_S;
}
static inline void b53_arl_from_entry(u64 *mac_vid, u32 *fwd_entry,
const struct b53_arl_entry *ent)
{
- *mac_vid = b53_mac_to_u64(ent->mac);
+ *mac_vid = ether_addr_to_u64(ent->mac);
*mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
*fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK;
if (ent->is_valid)
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: dsa: b53: Utilize common helpers for u64/MAC
2017-01-04 21:53 [PATCH net-next] net: dsa: b53: Utilize common helpers for u64/MAC Florian Fainelli
@ 2017-01-04 22:07 ` Andrew Lunn
2017-01-05 13:39 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2017-01-04 22:07 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, volodymyr.bendiuga
On Wed, Jan 04, 2017 at 01:53:20PM -0800, Florian Fainelli wrote:
> Utilize the two functions recently introduced: u64_to_ether() and
> ether_to_u64() instead of our own versions.
:-)
And i expect these have been tested on big endian systems. I never
thought to look if one of the other drivers already had them.
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: dsa: b53: Utilize common helpers for u64/MAC
2017-01-04 21:53 [PATCH net-next] net: dsa: b53: Utilize common helpers for u64/MAC Florian Fainelli
2017-01-04 22:07 ` Andrew Lunn
@ 2017-01-05 13:39 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-01-05 13:39 UTC (permalink / raw)
To: Florian Fainelli
Cc: kbuild-all, netdev, davem, andrew, vivien.didelot,
volodymyr.bendiuga, Florian Fainelli
[-- Attachment #1: Type: text/plain, Size: 2165 bytes --]
Hi Florian,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-dsa-b53-Utilize-common-helpers-for-u64-MAC/20170105-203441
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All errors (new ones prefixed by >>):
In file included from drivers/net/dsa/b53/b53_spi.c:27:0:
drivers/net/dsa/b53/b53_priv.h: In function 'b53_arl_to_entry':
>> drivers/net/dsa/b53/b53_priv.h:336:2: error: implicit declaration of function 'u64_to_ether_addr' [-Werror=implicit-function-declaration]
u64_to_ether_addr(mac_vid, ent->mac);
^~~~~~~~~~~~~~~~~
drivers/net/dsa/b53/b53_priv.h: In function 'b53_arl_from_entry':
>> drivers/net/dsa/b53/b53_priv.h:343:13: error: implicit declaration of function 'ether_addr_to_u64' [-Werror=implicit-function-declaration]
*mac_vid = ether_addr_to_u64(ent->mac);
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/u64_to_ether_addr +336 drivers/net/dsa/b53/b53_priv.h
330 {
331 memset(ent, 0, sizeof(*ent));
332 ent->port = fwd_entry & ARLTBL_DATA_PORT_ID_MASK;
333 ent->is_valid = !!(fwd_entry & ARLTBL_VALID);
334 ent->is_age = !!(fwd_entry & ARLTBL_AGE);
335 ent->is_static = !!(fwd_entry & ARLTBL_STATIC);
> 336 u64_to_ether_addr(mac_vid, ent->mac);
337 ent->vid = mac_vid >> ARLTBL_VID_S;
338 }
339
340 static inline void b53_arl_from_entry(u64 *mac_vid, u32 *fwd_entry,
341 const struct b53_arl_entry *ent)
342 {
> 343 *mac_vid = ether_addr_to_u64(ent->mac);
344 *mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
345 *fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK;
346 if (ent->is_valid)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45845 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-05 13:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 21:53 [PATCH net-next] net: dsa: b53: Utilize common helpers for u64/MAC Florian Fainelli
2017-01-04 22:07 ` Andrew Lunn
2017-01-05 13:39 ` kbuild test robot
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).