#ifdef CONFIG_RFS_ACCEL
#include <linux/cpu_rmap.h>
#endif
-#ifdef CONFIG_NET_RX_BUSY_POLL
-#include <net/busy_poll.h>
-#endif
#include <linux/crash_dump.h>
+#include <net/busy_poll.h>
#include "cq_enet_desc.h"
#include "vnic_dev.h"
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
skb_mark_napi_id(skb, &enic->napi[rq->index]);
- if (enic_poll_busy_polling(rq) ||
- !(netdev->features & NETIF_F_GRO))
+ if (!(netdev->features & NETIF_F_GRO))
netif_receive_skb(skb);
else
napi_gro_receive(&enic->napi[q_number], skb);
wq_work_done = vnic_cq_service(&enic->cq[cq_wq], wq_work_to_do,
enic_wq_service, NULL);
- if (!enic_poll_lock_napi(&enic->rq[cq_rq])) {
- if (wq_work_done > 0)
- vnic_intr_return_credits(&enic->intr[intr],
- wq_work_done,
- 0 /* dont unmask intr */,
- 0 /* dont reset intr timer */);
- return budget;
- }
-
if (budget > 0)
rq_work_done = vnic_cq_service(&enic->cq[cq_rq],
rq_work_to_do, enic_rq_service, NULL);
0 /* don't reset intr timer */);
err = vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf);
- enic_poll_unlock_napi(&enic->rq[cq_rq], napi);
/* Buffer allocation failed. Stay in polling
* mode so we can try to fill the ring again.
#endif /* CONFIG_RFS_ACCEL */
-#ifdef CONFIG_NET_RX_BUSY_POLL
-static int enic_busy_poll(struct napi_struct *napi)
-{
- struct net_device *netdev = napi->dev;
- struct enic *enic = netdev_priv(netdev);
- unsigned int rq = (napi - &enic->napi[0]);
- unsigned int cq = enic_cq_rq(enic, rq);
- unsigned int intr = enic_msix_rq_intr(enic, rq);
- unsigned int work_to_do = -1; /* clean all pkts possible */
- unsigned int work_done;
-
- if (!enic_poll_lock_poll(&enic->rq[rq]))
- return LL_FLUSH_BUSY;
- work_done = vnic_cq_service(&enic->cq[cq], work_to_do,
- enic_rq_service, NULL);
-
- if (work_done > 0)
- vnic_intr_return_credits(&enic->intr[intr],
- work_done, 0, 0);
- vnic_rq_fill(&enic->rq[rq], enic_rq_alloc_buf);
- if (enic->rx_coalesce_setting.use_adaptive_rx_coalesce)
- enic_calc_int_moderation(enic, &enic->rq[rq]);
- enic_poll_unlock_poll(&enic->rq[rq]);
-
- return work_done;
-}
-#endif /* CONFIG_NET_RX_BUSY_POLL */
-
static int enic_poll_msix_wq(struct napi_struct *napi, int budget)
{
struct net_device *netdev = napi->dev;
unsigned int work_done = 0;
int err;
- if (!enic_poll_lock_napi(&enic->rq[rq]))
- return budget;
/* Service RQ
*/
*/
enic_calc_int_moderation(enic, &enic->rq[rq]);
- enic_poll_unlock_napi(&enic->rq[rq], napi);
if (work_done < work_to_do) {
/* Some work done, but not enough to stay in polling,
netif_tx_wake_all_queues(netdev);
- for (i = 0; i < enic->rq_count; i++) {
- enic_busy_poll_init_lock(&enic->rq[i]);
+ for (i = 0; i < enic->rq_count; i++)
napi_enable(&enic->napi[i]);
- }
+
if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX)
for (i = 0; i < enic->wq_count; i++)
napi_enable(&enic->napi[enic_cq_wq(enic, i)]);
enic_dev_disable(enic);
- for (i = 0; i < enic->rq_count; i++) {
+ for (i = 0; i < enic->rq_count; i++)
napi_disable(&enic->napi[i]);
- local_bh_disable();
- while (!enic_poll_lock_napi(&enic->rq[i]))
- mdelay(1);
- local_bh_enable();
- }
netif_carrier_off(netdev);
netif_tx_disable(netdev);
#ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = enic_rx_flow_steer,
#endif
-#ifdef CONFIG_NET_RX_BUSY_POLL
- .ndo_busy_poll = enic_busy_poll,
-#endif
};
static const struct net_device_ops enic_netdev_ops = {
#ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = enic_rx_flow_steer,
#endif
-#ifdef CONFIG_NET_RX_BUSY_POLL
- .ndo_busy_poll = enic_busy_poll,
-#endif
};
static void enic_dev_deinit(struct enic *enic)
struct vnic_rq_buf *to_clean;
void *os_buf_head;
unsigned int pkts_outstanding;
-#ifdef CONFIG_NET_RX_BUSY_POLL
- atomic_t bpoll_state;
-#endif /* CONFIG_NET_RX_BUSY_POLL */
};
static inline unsigned int vnic_rq_desc_avail(struct vnic_rq *rq)
return 0;
}
-#ifdef CONFIG_NET_RX_BUSY_POLL
-static inline void enic_busy_poll_init_lock(struct vnic_rq *rq)
-{
- atomic_set(&rq->bpoll_state, ENIC_POLL_STATE_IDLE);
-}
-
-static inline bool enic_poll_lock_napi(struct vnic_rq *rq)
-{
- int rc = atomic_cmpxchg(&rq->bpoll_state, ENIC_POLL_STATE_IDLE,
- ENIC_POLL_STATE_NAPI);
-
- return (rc == ENIC_POLL_STATE_IDLE);
-}
-
-static inline void enic_poll_unlock_napi(struct vnic_rq *rq,
- struct napi_struct *napi)
-{
- WARN_ON(atomic_read(&rq->bpoll_state) != ENIC_POLL_STATE_NAPI);
- napi_gro_flush(napi, false);
- atomic_set(&rq->bpoll_state, ENIC_POLL_STATE_IDLE);
-}
-
-static inline bool enic_poll_lock_poll(struct vnic_rq *rq)
-{
- int rc = atomic_cmpxchg(&rq->bpoll_state, ENIC_POLL_STATE_IDLE,
- ENIC_POLL_STATE_POLL);
-
- return (rc == ENIC_POLL_STATE_IDLE);
-}
-
-
-static inline void enic_poll_unlock_poll(struct vnic_rq *rq)
-{
- WARN_ON(atomic_read(&rq->bpoll_state) != ENIC_POLL_STATE_POLL);
- atomic_set(&rq->bpoll_state, ENIC_POLL_STATE_IDLE);
-}
-
-static inline bool enic_poll_busy_polling(struct vnic_rq *rq)
-{
- return atomic_read(&rq->bpoll_state) & ENIC_POLL_STATE_POLL;
-}
-
-#else
-
-static inline void enic_busy_poll_init_lock(struct vnic_rq *rq)
-{
-}
-
-static inline bool enic_poll_lock_napi(struct vnic_rq *rq)
-{
- return true;
-}
-
-static inline bool enic_poll_unlock_napi(struct vnic_rq *rq,
- struct napi_struct *napi)
-{
- return false;
-}
-
-static inline bool enic_poll_lock_poll(struct vnic_rq *rq)
-{
- return false;
-}
-
-static inline bool enic_poll_unlock_poll(struct vnic_rq *rq)
-{
- return false;
-}
-
-static inline bool enic_poll_ll_polling(struct vnic_rq *rq)
-{
- return false;
-}
-#endif /* CONFIG_NET_RX_BUSY_POLL */
-
void vnic_rq_free(struct vnic_rq *rq);
int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
unsigned int desc_count, unsigned int desc_size);