Skip to content

Commit 9d0a58f

Browse files
Vasily Gorbikdavem330
authored andcommitted
s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]
*ether_addr*_64bits functions have been introduced to optimize performance critical paths, which access 6-byte ethernet address as u64 value to get "nice" assembly. A harmless hack works nicely on ethernet addresses shoved into a structure or a larger buffer, until busted by Kasan on smth like plain (u8 *)[6]. qeth_l2_set_mac_address calls qeth_l2_remove_mac passing u8 old_addr[ETH_ALEN] as an argument. Adding/removing macs for an ethernet adapter is not that performance critical. Moreover is_multicast_ether_addr_64bits itself on s390 is not faster than is_multicast_ether_addr: is_multicast_ether_addr(%r2) -> %r2 llc %r2,0(%r2) risbg %r2,%r2,63,191,0 is_multicast_ether_addr_64bits(%r2) -> %r2 llgc %r2,0(%r2) risbg %r2,%r2,63,191,0 So, let's just use is_multicast_ether_addr instead of is_multicast_ether_addr_64bits. Fixes: bcacfcb ("s390/qeth: fix MAC address update sequence") Reviewed-by: Julian Wiedmann <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Julian Wiedmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4789a21 commit 9d0a58f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/s390/net/qeth_l2_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
140140

141141
static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac)
142142
{
143-
enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ?
143+
enum qeth_ipa_cmds cmd = is_multicast_ether_addr(mac) ?
144144
IPA_CMD_SETGMAC : IPA_CMD_SETVMAC;
145145
int rc;
146146

@@ -157,7 +157,7 @@ static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac)
157157

158158
static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac)
159159
{
160-
enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ?
160+
enum qeth_ipa_cmds cmd = is_multicast_ether_addr(mac) ?
161161
IPA_CMD_DELGMAC : IPA_CMD_DELVMAC;
162162
int rc;
163163

0 commit comments

Comments
 (0)