media: dvb_core: slight optimization of addr compare
Subsystems (3)
PATCH v3 13/19 media: dvb_core: slight optimization of addr compare
Use possibly more efficient ether_addr_equal
instead of memcmp.
--- drivers/media/dvb-core/dvb_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/dvb-core/dvb_net.c +4 -4
@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, eth =eth_hdr (skb);if (*eth->h_dest &1 ) { -if (memcmp (eth->h_dest,dev->broadcast,ETH_ALEN )==0 ) +if (ether_addr_equal (eth->h_dest,dev->broadcast)) skb->pkt_type=PACKET_BROADCAST ;else skb->pkt_type=PACKET_MULTICAST ;
@@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )if (priv->rx_mode !=RX_MODE_PROMISC ) {if (priv->ule_skb->data[0 ] &0x01 ) {/* multicast or broadcast */ -if (memcmp (priv->ule_skb->data, bc_addr,ETH_ALEN )) { +if (!ether_addr_equal (priv->ule_skb->data, bc_addr)) {/* multicast */ if (priv->rx_mode ==RX_MODE_MULTI ) {int i; -for (i =0 ; i < priv->multi_num &&memcmp (priv->ule_skb->data, priv->multi_macs[i],ETH_ALEN ); i++) +for (i =0 ; i < priv->multi_num && !ether_addr_equal (priv->ule_skb->data, priv->multi_macs[i]); i++) ;if (i == priv->multi_num) drop =1 ;
@@ -688,7 +688,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) }/* else: broadcast */ } -else if (memcmp (priv->ule_skb->data, dev->dev_addr,ETH_ALEN )) +else if (!ether_addr_equal (priv->ule_skb->data, dev->dev_addr)) drop =1 ;/* else: destination address matches the MAC address of our receiver device */ }
Signature · 1 line
1.8.0
Hello.
Quoted 17 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal
instead of memcmp.Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Yang Yingliang <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/media/dvb-core/dvb_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/media/dvb-core/dvb_net.c +0
-0
drivers/media/dvb-core/dvb_net.c static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, · line 182
Quoted 5 lines
drivers/media/dvb-core/dvb_net.c +1
-1@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, eth =eth_hdr (skb);if (*eth->h_dest &1 ) { -if (memcmp (eth->h_dest,dev->broadcast,ETH_ALEN )==0 ) +if (ether_addr_equal (eth->h_dest,dev->broadcast))
There should be space after comma.
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 681
Quoted 11 lines
drivers/media/dvb-core/dvb_net.c +2
-2@@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )if (priv->rx_mode !=RX_MODE_PROMISC ) {if (priv->ule_skb->data[0 ] &0x01 ) {/* multicast or broadcast */ -if (memcmp (priv->ule_skb->data, bc_addr,ETH_ALEN )) { +if (!ether_addr_equal (priv->ule_skb->data, bc_addr)) {/* multicast */ if (priv->rx_mode ==RX_MODE_MULTI ) {int i; -for (i =0 ; i < priv->multi_num &&memcmp (priv->ule_skb->data, priv->multi_macs[i],ETH_ALEN ); i++) +for (i =0 ; i < priv->multi_num && !ether_addr_equal (priv->ule_skb->data, priv->multi_macs[i]); i++)
Shouldn't this line be broken?
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 684
Quoted 3 lines
drivers/media/dvb-core/dvb_net.c +0
-0;if (i == priv->multi_num) drop =1 ;
WBR, Sergei
Quoted 29 lines · Sergei Shtylyov
Hello.
Quoted 17 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal
instead of memcmp.Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Yang Yingliang <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/media/dvb-core/dvb_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/media/dvb-core/dvb_net.c +0
-0drivers/media/dvb-core/dvb_net.c static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, · line 182
Quoted 5 lines
drivers/media/dvb-core/dvb_net.c +1
-1@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, eth =eth_hdr (skb);if (*eth->h_dest &1 ) { -if (memcmp (eth->h_dest,dev->broadcast,ETH_ALEN )==0 ) +if (ether_addr_equal (eth->h_dest,dev->broadcast))There should be space after comma.
Quoted 14 lines
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 681
Quoted 11 lines
drivers/media/dvb-core/dvb_net.c +2
-2@@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )if (priv->rx_mode !=RX_MODE_PROMISC ) {if (priv->ule_skb->data[0 ] &0x01 ) {/* multicast or broadcast */ -if (memcmp (priv->ule_skb->data, bc_addr,ETH_ALEN )) { +if (!ether_addr_equal (priv->ule_skb->data, bc_addr)) {/* multicast */ if (priv->rx_mode ==RX_MODE_MULTI ) {int i; -for (i =0 ; i < priv->multi_num &&memcmp (priv->ule_skb->data, priv->multi_macs[i],ETH_ALEN ); i++) +for (i =0 ; i < priv->multi_num && !ether_addr_equal (priv->ule_skb->data, priv->multi_macs[i]); i++)Shouldn't this line be broken?
ok, thanks.
Regards
Quoted 9 lines
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 684
Quoted 3 lines
drivers/media/dvb-core/dvb_net.c +0
-0;if (i == priv->multi_num) drop =1 ;WBR, Sergei
Em Thu, 26 Dec 2013 19:09:10 +0800
Ding Tianhong <[email protected]> escreveu:
Quoted 45 lines · Sergei Shtylyov
Quoted 29 lines
Hello.
Quoted 17 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal
instead of memcmp.Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Yang Yingliang <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/media/dvb-core/dvb_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/media/dvb-core/dvb_net.c +0
-0drivers/media/dvb-core/dvb_net.c static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, · line 182
Quoted 5 lines
drivers/media/dvb-core/dvb_net.c +1
-1@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, eth =eth_hdr (skb);if (*eth->h_dest &1 ) { -if (memcmp (eth->h_dest,dev->broadcast,ETH_ALEN )==0 ) +if (ether_addr_equal (eth->h_dest,dev->broadcast))There should be space after comma.
Quoted 14 lines
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 681
Quoted 11 lines
drivers/media/dvb-core/dvb_net.c +2
-2@@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )if (priv->rx_mode !=RX_MODE_PROMISC ) {if (priv->ule_skb->data[0 ] &0x01 ) {/* multicast or broadcast */ -if (memcmp (priv->ule_skb->data, bc_addr,ETH_ALEN )) { +if (!ether_addr_equal (priv->ule_skb->data, bc_addr)) {/* multicast */ if (priv->rx_mode ==RX_MODE_MULTI ) {int i; -for (i =0 ; i < priv->multi_num &&memcmp (priv->ule_skb->data, priv->multi_macs[i],ETH_ALEN ); i++) +for (i =0 ; i < priv->multi_num && !ether_addr_equal (priv->ule_skb->data, priv->multi_macs[i]); i++)Shouldn't this line be broken?
Quoted 1 line
ok, thanks.
Also, since you're touching on those lines, could you please add an space after 'if' (on the first hunk) and after 'for' (on the second one)?
Quoted 13 lines
Regards
Quoted 9 lines
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 684
Quoted 3 lines
drivers/media/dvb-core/dvb_net.c +0
-0;if (i == priv->multi_num) drop =1 ;WBR, Sergei
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Mauro
Quoted 48 lines · Mauro Carvalho Chehab
Em Thu, 26 Dec 2013 19:09:10 +0800
Ding Tianhong <[email protected]> escreveu:Quoted 45 lines · Sergei Shtylyov
Quoted 43 lines
Hello.
Quoted 17 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal
instead of memcmp.Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Yang Yingliang <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/media/dvb-core/dvb_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/media/dvb-core/dvb_net.c +0
-0drivers/media/dvb-core/dvb_net.c static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, · line 182
Quoted 5 lines
drivers/media/dvb-core/dvb_net.c +1
-1@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, eth =eth_hdr (skb);if (*eth->h_dest &1 ) { -if (memcmp (eth->h_dest,dev->broadcast,ETH_ALEN )==0 ) +if (ether_addr_equal (eth->h_dest,dev->broadcast))There should be space after comma.
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 681
Quoted 11 lines
drivers/media/dvb-core/dvb_net.c +2
-2@@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )if (priv->rx_mode !=RX_MODE_PROMISC ) {if (priv->ule_skb->data[0 ] &0x01 ) {/* multicast or broadcast */ -if (memcmp (priv->ule_skb->data, bc_addr,ETH_ALEN )) { +if (!ether_addr_equal (priv->ule_skb->data, bc_addr)) {/* multicast */ if (priv->rx_mode ==RX_MODE_MULTI ) {int i; -for (i =0 ; i < priv->multi_num &&memcmp (priv->ule_skb->data, priv->multi_macs[i],ETH_ALEN ); i++) +for (i =0 ; i < priv->multi_num && !ether_addr_equal (priv->ule_skb->data, priv->multi_macs[i]); i++)Shouldn't this line be broken?
Quoted 5 lines
Quoted 1 line
ok, thanks.
Also, since you're touching on those lines, could you please add an space after 'if' (on the first hunk) and after 'for' (on the second one)?
Ok, thanks
Regards
Ding
Quoted 23 lines
Quoted 13 lines
Regards
Quoted 9 lines
drivers/media/dvb-core/dvb_net.c static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) · line 684
Quoted 3 lines
drivers/media/dvb-core/dvb_net.c +0
-0;if (i == priv->multi_num) drop =1 ;WBR, Sergei
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlThanks,
Mauro.