Message ID | 20120611212901.2b4d0a17.yoshikawa.takuya@oss.ntt.co.jp |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Monday 11 June 2012, Takuya Yoshikawa wrote: > > /* Set bit in a little-endian bitfield */ > -static inline void set_bit_le(unsigned nr, unsigned char *addr) > +static inline void efx_set_bit_le(unsigned nr, unsigned char *addr) > { > addr[nr / 8] |= (1 << (nr % 8)); > } > > /* Clear bit in a little-endian bitfield */ > -static inline void clear_bit_le(unsigned nr, unsigned char *addr) > +static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr) > { > addr[nr / 8] &= ~(1 << (nr % 8)); > } Hmm, any reason why we're not just using the existing non-atomic __set_bit_le() here? I think the helpers in sfc and tulip can just get removed if you use those. Arnd -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 11 Jun 2012 14:09:15 +0000 Arnd Bergmann <arnd@arndb.de> wrote: > On Monday 11 June 2012, Takuya Yoshikawa wrote: > > > > /* Set bit in a little-endian bitfield */ > > -static inline void set_bit_le(unsigned nr, unsigned char *addr) > > +static inline void efx_set_bit_le(unsigned nr, unsigned char *addr) > > { > > addr[nr / 8] |= (1 << (nr % 8)); > > } > > > > /* Clear bit in a little-endian bitfield */ > > -static inline void clear_bit_le(unsigned nr, unsigned char *addr) > > +static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr) > > { > > addr[nr / 8] &= ~(1 << (nr % 8)); > > } > > Hmm, any reason why we're not just using the existing non-atomic > __set_bit_le() here? I think the helpers in sfc and tulip can > just get removed if you use those. __set_bit_le() assumes long word alignment and does endian conversion when needed. To be honest, I am a bit scared of changing drivers which I cannot test on real hardware. Takuya -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tuesday 12 June 2012, Takuya Yoshikawa wrote: > > > > Hmm, any reason why we're not just using the existing non-atomic > > __set_bit_le() here? I think the helpers in sfc and tulip can > > just get removed if you use those. > > __set_bit_le() assumes long word alignment and does endian conversion > when needed. Ah, I see. > To be honest, I am a bit scared of changing drivers which I cannot test > on real hardware. Ok, let's take your patches as they are then. With the change to add clear_bit_le: Acked-by: Arnd Bergmann <arnd@arndb.de> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index b95f2e1..de11449 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1976,14 +1976,14 @@ static void efx_set_rx_mode(struct net_device *net_dev) netdev_for_each_mc_addr(ha, net_dev) { crc = ether_crc_le(ETH_ALEN, ha->addr); bit = crc & (EFX_MCAST_HASH_ENTRIES - 1); - set_bit_le(bit, mc_hash->byte); + efx_set_bit_le(bit, mc_hash->byte); } /* Broadcast packets go through the multicast hash filter. * ether_crc_le() of the broadcast address is 0xbe2612ff * so we always add bit 0xff to the mask. */ - set_bit_le(0xff, mc_hash->byte); + efx_set_bit_le(0xff, mc_hash->byte); } if (efx->port_enabled) diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 0e57535..5e084bf 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1081,13 +1081,13 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue, } /* Set bit in a little-endian bitfield */ -static inline void set_bit_le(unsigned nr, unsigned char *addr) +static inline void efx_set_bit_le(unsigned nr, unsigned char *addr) { addr[nr / 8] |= (1 << (nr % 8)); } /* Clear bit in a little-endian bitfield */ -static inline void clear_bit_le(unsigned nr, unsigned char *addr) +static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr) { addr[nr / 8] &= ~(1 << (nr % 8)); } diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index 4a9a5be..3abde7b 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c @@ -473,9 +473,9 @@ void efx_nic_init_tx(struct efx_tx_queue *tx_queue) efx_reado(efx, ®, FR_AA_TX_CHKSM_CFG); if (tx_queue->queue & EFX_TXQ_TYPE_OFFLOAD) - clear_bit_le(tx_queue->queue, (void *)®); + efx_clear_bit_le(tx_queue->queue, (void *)®); else - set_bit_le(tx_queue->queue, (void *)®); + efx_set_bit_le(tx_queue->queue, (void *)®); efx_writeo(efx, ®, FR_AA_TX_CHKSM_CFG); }