@@ -9,6 +9,7 @@
*/
#include "net_driver.h"
+#include <linux/find_atomic.h>
#include <linux/module.h>
#include <linux/iommu.h>
#include <net/rps.h>
@@ -953,9 +954,7 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
int rc;
/* find a free slot */
- for (slot_idx = 0; slot_idx < EFX_RPS_MAX_IN_FLIGHT; slot_idx++)
- if (!test_and_set_bit(slot_idx, &efx->rps_slot_map))
- break;
+ slot_idx = find_and_set_bit(&efx->rps_slot_map, EFX_RPS_MAX_IN_FLIGHT);
if (slot_idx >= EFX_RPS_MAX_IN_FLIGHT)
return -EBUSY;
@@ -9,6 +9,7 @@
*/
#include "net_driver.h"
+#include <linux/find_atomic.h>
#include <linux/module.h>
#include <linux/iommu.h>
#include <net/rps.h>
@@ -959,9 +960,7 @@ int efx_siena_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
int rc;
/* find a free slot */
- for (slot_idx = 0; slot_idx < EFX_RPS_MAX_IN_FLIGHT; slot_idx++)
- if (!test_and_set_bit(slot_idx, &efx->rps_slot_map))
- break;
+ slot_idx = find_and_set_bit(&efx->rps_slot_map, EFX_RPS_MAX_IN_FLIGHT);
if (slot_idx >= EFX_RPS_MAX_IN_FLIGHT)
return -EBUSY;
@@ -3,6 +3,7 @@
* Driver for Solarflare network controllers and boards
* Copyright 2010-2012 Solarflare Communications Inc.
*/
+#include <linux/find_atomic.h>
#include <linux/pci.h>
#include <linux/module.h>
#include "net_driver.h"
@@ -722,14 +723,12 @@ static int efx_vfdi_fini_all_queues(struct siena_vf *vf)
efx_vfdi_flush_wake(vf),
timeout);
rxqs_count = 0;
- for (index = 0; index < count; ++index) {
- if (test_and_clear_bit(index, vf->rxq_retry_mask)) {
- atomic_dec(&vf->rxq_retry_count);
- MCDI_SET_ARRAY_DWORD(
- inbuf, FLUSH_RX_QUEUES_IN_QID_OFST,
- rxqs_count, vf_offset + index);
- rxqs_count++;
- }
+ for_each_test_and_clear_bit(index, vf->rxq_retry_mask, count) {
+ atomic_dec(&vf->rxq_retry_count);
+ MCDI_SET_ARRAY_DWORD(
+ inbuf, FLUSH_RX_QUEUES_IN_QID_OFST,
+ rxqs_count, vf_offset + index);
+ rxqs_count++;
}
}