eth1394: endian fixes
Subsystems (2)
PATCH 1/1 eth1394: endian fixes
---
drivers/ieee1394/eth1394.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ieee1394/eth1394.c +3 -3
@@ -935,7 +935,7 @@ static inline u16 ether1394_parse_encap( *(u32 *)arp_ptr = arp1394->sip;/* move sender IP addr */ arp_ptr += arp->ar_pln;/* skip over sender IP addr */ -if (arp->ar_op ==1 ) +if (arp->ar_op ==htons (1 ))/* just set ARP req target unique ID to 0 */ *((u64 *)arp_ptr) =0 ;else
@@ -1395,7 +1395,7 @@ static inline void ether1394_arp_to_1394/* We need to encapsulate the standard header with our own. We use the * ethernet header's proto for our own. */ static inline unsigned int ether1394_encapsulate_prep (unsigned int max_payload, -int proto, +__be16 proto,union eth1394_hdr *hdr,u16 dg_size,u16 dgl) {
@@ -1626,7 +1626,7 @@ static int ether1394_tx (struct sk_buffgfp_t kmflags =in_interrupt () ?GFP_ATOMIC :GFP_KERNEL ;struct eth1394hdr *eth;struct eth1394_priv *priv =netdev_priv (dev); -int proto; +__be16 proto;unsigned long flags;nodeid_t dest_node;eth1394_tx_type tx_type;
Alexey Dobriyan wrote on 2006-05-16:
Quoted 1 line
Signed-off-by Alexey Dobriyan <[email protected]>
...
drivers/ieee1394/eth1394.c static inline u16 ether1394_parse_encap( · line 941
Quoted 9 lines
drivers/ieee1394/eth1394.c +1
-1@@ -935,7 +935,7 @@ static inline u16 ether1394_parse_encap( *(u32 *)arp_ptr = arp1394->sip;/* move sender IP addr */ arp_ptr += arp->ar_pln;/* skip over sender IP addr */ -if (arp->ar_op ==1 ) +if (arp->ar_op ==htons (1 ))/* just set ARP req target unique ID to 0 */ *((u64 *)arp_ptr) =0 ;else
I suggest __constant_htons(ARPOP_REQUEST).
Quoted 10 lines
drivers/ieee1394/eth1394.c +1
-1@@ -1395,7 +1395,7 @@ static inline void ether1394_arp_to_1394/* We need to encapsulate the standard header with our own. We use the * ethernet header's proto for our own. */ static inline unsigned int ether1394_encapsulate_prep (unsigned int max_payload, -int proto, +__be16 proto,union eth1394_hdr *hdr,u16 dg_size,u16 dgl) {
drivers/ieee1394/eth1394.c static int ether1394_tx (struct sk_buff · line 1632
Quoted 8 lines
drivers/ieee1394/eth1394.c +1
-1@@ -1626,7 +1626,7 @@ static int ether1394_tx (struct sk_buffgfp_t kmflags =in_interrupt () ?GFP_ATOMIC :GFP_KERNEL ;struct eth1394hdr *eth;struct eth1394_priv *priv =netdev_priv (dev); -int proto; +__be16 proto;unsigned long flags;nodeid_t dest_node;eth1394_tx_type tx_type;
Alexey, I am afraid none of the current 1394 developers is actively using eth1394. Did you have the chance to test your patch on different platforms and with different peer OSs/platforms?
Also, did someone of the netdev guys already forward the patch (since we 1394 people are slow and eth1394 is marked unmaintained)? If not, I could send it along with a few other 1394 patches to akpm soon.
Signature · 3 lines
Stefan Richter -=====-=-==- -=-= ==-== http://arcgraph.de/sr/
Quoted 8 lines · Stefan Richter
Alexey Dobriyan wrote on 2006-05-16:
Quoted 1 line
Signed-off-by Alexey Dobriyan <[email protected]>...
Quoted 5 lines
(quoted diff) +0
-0@@ -935,7 +935,7 @@ static inline u16 ether1394_parse_encap( *(u32*)arp_ptr = arp1394->sip; /* move sender IP addr */ arp_ptr += arp->ar_pln; /* skip over sender IP addr */
Quoted 7 lines
Quoted 5 lines
(quoted diff) +1
-1- if (arp->ar_op == 1) + if (arp->ar_op == htons(1)) /* just set ARP req target unique ID to 0 */ *((u64*)arp_ptr) = 0;else
I suggest
__constant_htons(ARPOP_REQUEST).
OK. htons(ARPOP_REQUEST) should be enough. __constant_* really needed in initializators. Updated patch below.
Quoted 3 lines
Alexey, I am afraid none of the current 1394 developers is actively using eth1394. Did you have the chance to test your patch on different platforms and with different peer OSs/platforms?
Unfortunately not.
Quoted 3 lines
Also, did someone of the netdev guys already forward the patch (since we 1394 people are slow and eth1394 is marked unmaintained)? If not, I could send it along with a few other 1394 patches to akpm soon.
[PATCH] eth1394: endian fixes
---
drivers/ieee1394/eth1394.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ieee1394/eth1394.c +3 -3
@@ -935,7 +935,7 @@ static inline u16 ether1394_parse_encap( *(u32 *)arp_ptr = arp1394->sip;/* move sender IP addr */ arp_ptr += arp->ar_pln;/* skip over sender IP addr */ -if (arp->ar_op ==1 ) +if (arp->ar_op ==htons (ARPOP_REQUEST ))/* just set ARP req target unique ID to 0 */ *((u64 *)arp_ptr) =0 ;else
@@ -1395,7 +1395,7 @@ static inline void ether1394_arp_to_1394/* We need to encapsulate the standard header with our own. We use the * ethernet header's proto for our own. */ static inline unsigned int ether1394_encapsulate_prep (unsigned int max_payload, -int proto, +__be16 proto,union eth1394_hdr *hdr,u16 dg_size,u16 dgl) {
@@ -1626,7 +1626,7 @@ static int ether1394_tx (struct sk_buffgfp_t kmflags =in_interrupt () ?GFP_ATOMIC :GFP_KERNEL ;struct eth1394hdr *eth;struct eth1394_priv *priv =netdev_priv (dev); -int proto; +__be16 proto;unsigned long flags;nodeid_t dest_node;eth1394_tx_type tx_type;
Alexey Dobriyan wrote on 2006-05-27:
Quoted 5 lines · Stefan Richter
Quoted 2 lines
Did you have the chance to test your patch on different platforms and with different peer OSs/platforms?
Unfortunately not.
The patch works OK on an x86/Linux host with x86/WinXP peer and ppc32/OSX peer. Thanks,
Signature · 3 lines
Stefan Richter -=====-=-==- -==- -=-=- http://arcgraph.de/sr/
Quoted 7 lines · On Sat, 27 May 2006 12:05:40 +0200 Stefan Richter <[email protected]>…
Alexey Dobriyan wrote on 2006-05-16:
Quoted 1 line
Signed-off-by Alexey Dobriyan <[email protected]>...
Quoted 4 lines
drivers/ieee1394/eth1394.c +0
-0@@ -935,7 +935,7 @@ static inline u16 ether1394_parse_encap( *(u32 *)arp_ptr = arp1394->sip;/* move sender IP addr */ arp_ptr += arp->ar_pln;/* skip over sender IP addr */
Quoted 7 lines
drivers/ieee1394/eth1394.c static inline u16 ether1394_parse_encap( · line 941
Quoted 5 lines
drivers/ieee1394/eth1394.c +1
-1-if (arp->ar_op ==1 ) +if (arp->ar_op ==htons (1 ))/* just set ARP req target unique ID to 0 */ *((u64 *)arp_ptr) =0 ;else I suggest
__constant_htons(ARPOP_REQUEST).
No. That is only for initializers and switch cases. Otherwise, it adds unnecessary verbosity. The htons() does the right thing automatically.
Quoted 35 lines
Quoted 11 lines
drivers/ieee1394/eth1394.c +1
-1@@ -1395,7 +1395,7 @@ static inline void ether1394_arp_to_1394/* We need to encapsulate the standard header with our own. We use the * ethernet header's proto for our own. */ static inline unsigned int ether1394_encapsulate_prep (unsigned int max_payload, -int proto, +__be16 proto,union eth1394_hdr *hdr,u16 dg_size,u16 dgl) {drivers/ieee1394/eth1394.c static int ether1394_tx (struct sk_buff · line 1632
Quoted 8 lines
drivers/ieee1394/eth1394.c +1
-1@@ -1626,7 +1626,7 @@ static int ether1394_tx (struct sk_buffgfp_t kmflags =in_interrupt () ?GFP_ATOMIC :GFP_KERNEL ;struct eth1394hdr *eth;struct eth1394_priv *priv =netdev_priv (dev); -int proto; +__be16 proto;unsigned long flags;nodeid_t dest_node;eth1394_tx_type tx_type;Alexey, I am afraid none of the current 1394 developers is actively using eth1394. Did you have the chance to test your patch on different platforms and with different peer OSs/platforms?
Also, did someone of the netdev guys already forward the patch (since we 1394 people are slow and eth1394 is marked unmaintained)? If not, I could send it along with a few other 1394 patches to akpm soon.
Signature · 7 lines
Stefan Richter -=====-=-==- -=-= ==-== http://arcgraph.de/sr/ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 eth1394: replace __constant_htons by htons
...and __constant_ntohs, __constant_ntohl, __constant_cpu_to_be32 too where possible. Htons and friends are resolved to constants in these places anyway. Also fix an endianess glitch in a log message, spotted by Alexey Dobriyan.
--- drivers/ieee1394/eth1394.c | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-)
drivers/ieee1394/eth1394.c +11 -12
@@ -770,7 +770,7 @@ static int ether1394_rebuild_header(strudefault :ETH1394_PRINT (KERN_DEBUG , dev->name,"unable to resolve type %04x addresses.\n" , - eth->h_proto); +ntohs (eth->h_proto));break ; }
@@ -792,9 +792,8 @@ static int ether1394_header_cache(struct (16 - ETH1394_HLEN));struct net_device *dev = neigh->dev; -if (type ==__constant_htons (ETH_P_802_3 )) { +if (type ==htons (ETH_P_802_3 ))return -1 ; - } eth->h_proto = type;memcpy (eth->h_dest, neigh->ha, dev->addr_len);
@@ -883,7 +882,7 @@ static inline u16 ether1394_parse_encap(/* If this is an ARP packet, convert it. First, we want to make * use of some of the fields, since they tell us a little bit * about the sending machine. */ -if (ether_type ==__constant_htons (ETH_P_ARP )) { +if (ether_type ==htons (ETH_P_ARP )) {struct eth1394_arp *arp1394 = (struct eth1394_arp *)skb->data;struct arphdr *arp = (struct arphdr *)skb->data;unsigned char *arp_ptr = (unsigned char *)(arp +1 );
@@ -939,8 +938,8 @@ static inline u16 ether1394_parse_encap( }/* Now add the ethernet header. */ -if (dev->hard_header (skb, dev,__constant_ntohs (ether_type), - &dest_hw,NULL , skb->len) >=0 ) +if (dev->hard_header (skb, dev,ntohs (ether_type), &dest_hw,NULL , + skb->len) >=0 ) ret =ether1394_type_trans (skb, dev);return ret;
@@ -1509,8 +1508,8 @@ static inline void ether1394_prep_gasp_p p->data = ((quadlet_t *)skb->data) -2 ; p->data[0 ] =cpu_to_be32 ((priv->host->node_id <<16 ) |ETHER1394_GASP_SPECIFIER_ID_HI ); - p->data[1 ] =__constant_cpu_to_be32 ((ETHER1394_GASP_SPECIFIER_ID_LO <<24 ) | -ETHER1394_GASP_VERSION ); + p->data[1 ] =cpu_to_be32 ((ETHER1394_GASP_SPECIFIER_ID_LO <<24 ) | +ETHER1394_GASP_VERSION );/* Setting the node id to ALL_NODES (not LOCAL_BUS | ALL_NODES) * prevents hpsb_send_packet() from setting the speed to an arbitrary
@@ -1665,9 +1664,9 @@ static int ether1394_tx (struct sk_buff/* Set the transmission type for the packet. ARP packets and IP * broadcast packets are sent via GASP. */ if (memcmp (eth->h_dest, dev->broadcast,ETH1394_ALEN ) ==0 || - proto ==__constant_htons (ETH_P_ARP ) || - (proto ==__constant_htons (ETH_P_IP ) && -IN_MULTICAST (__constant_ntohl (skb->nh.iph->daddr)))) { + proto ==htons (ETH_P_ARP ) || + (proto ==htons (ETH_P_IP ) && +IN_MULTICAST (ntohl (skb->nh.iph->daddr)))) { tx_type =ETH1394_GASP ; dest_node =LOCAL_BUS |ALL_NODES ; max_payload = priv->bc_maxpayload -ETHER1394_GASP_OVERHEAD ;
@@ -1699,7 +1698,7 @@ static int ether1394_tx (struct sk_buff }/* If this is an ARP packet, convert it */ -if (proto ==__constant_htons (ETH_P_ARP )) +if (proto ==htons (ETH_P_ARP ))ether1394_arp_to_1394arp (skb, dev); ptask->hdr.words.word1 =0 ;