Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: BCM5809S support in bnx(4) and brgphy(4)



>  Also, there is a comment above saying that:
> 
>  /*
>   * The following data structures are generated from RTL code.
>   * Do not modify any values below this line.
>   */

IMO all members fetched via PCI bus master should be uint32_t
if hardware supports byte swap ops since swap is always done
against each uint32_t.

>  -    u_int16_t tx_bd_flags;
>  -    u_int16_t tx_bd_vlan_tag;
>  +    u_int32_t tx_bd_flags_vtag;
>  +#define VAL_HIGH(val) (((val) & 0xffff0000) >> 16)
>  +#define VAL_LOW(val)   ((val) & 0x0000ffff)
>  +#if BYTE_ORDER == BIG_ENDIAN
>  +#define TX_BD_VLAN_TAG(tx_bd)       VAL_HIGH((tx_bd)->tx_bd_flags_vtag)
>  +#define TX_BD_FLAGS(tx_bd)  VAL_LOW ((tx_bd)->tx_bd_flags_vtag)
>  +#else
>  +#define TX_BD_VLAN_TAG(tx_bd)       VAL_LOW ((tx_bd)->tx_bd_flags_vtag)
>  +#define TX_BD_FLAGS(tx_bd)  VAL_HIGH((tx_bd)->tx_bd_flags_vtag)
>  +#endif
 :
>  Looks messy :/

Well, no need to use #if BYTE_ORDER if we use uint32_t with
shift ops because word swap is done by hardware.
(that's the reason why we have to swap uint16_t members by #ifdef)

Anyway, no problem to leave them as is to sync FreeBSD/OpenBSD.
---
Izum iTsutsui


Home | Main Index | Thread Index | Old Index