@@ -226,6 +226,11 @@ struct enic {
u32 rx_copybreak;
u8 rss_key[ENIC_RSS_LEN];
struct vnic_gen_stats gen_stats;
+ void (*rq_buf_service)(struct vnic_rq *rq, struct cq_desc *cq_desc,
+ struct vnic_rq_buf *buf, int skipped,
+ void *opaque);
+ int (*rq_alloc_buf)(struct vnic_rq *rq);
+ void (*rq_free_buf)(struct vnic_rq *rq, struct vnic_rq_buf *buf);
};
static inline struct net_device *vnic_get_netdev(struct vnic_dev *vdev)
@@ -1519,7 +1519,7 @@ static int enic_poll(struct napi_struct *napi, int budget)
0 /* don't unmask intr */,
0 /* don't reset intr timer */);
- err = vnic_rq_fill(&enic->rq[0].vrq, enic_rq_alloc_buf);
+ err = vnic_rq_fill(&enic->rq[0].vrq, enic->rq_alloc_buf);
/* Buffer allocation failed. Stay in polling
* mode so we can try to fill the ring again.
@@ -1647,7 +1647,7 @@ static int enic_poll_msix_rq(struct napi_struct *napi, int budget)
0 /* don't unmask intr */,
0 /* don't reset intr timer */);
- err = vnic_rq_fill(&enic->rq[rq].vrq, enic_rq_alloc_buf);
+ err = vnic_rq_fill(&enic->rq[rq].vrq, enic->rq_alloc_buf);
/* Buffer allocation failed. Stay in polling mode
* so we can try to fill the ring again.
@@ -1882,6 +1882,10 @@ static int enic_open(struct net_device *netdev)
unsigned int i;
int err, ret;
+ enic->rq_buf_service = enic_rq_indicate_buf;
+ enic->rq_alloc_buf = enic_rq_alloc_buf;
+ enic->rq_free_buf = enic_free_rq_buf;
+
err = enic_request_intr(enic);
if (err) {
netdev_err(netdev, "Unable to request irq.\n");
@@ -1900,7 +1904,7 @@ static int enic_open(struct net_device *netdev)
for (i = 0; i < enic->rq_count; i++) {
/* enable rq before updating rq desc */
vnic_rq_enable(&enic->rq[i].vrq);
- vnic_rq_fill(&enic->rq[i].vrq, enic_rq_alloc_buf);
+ vnic_rq_fill(&enic->rq[i].vrq, enic->rq_alloc_buf);
/* Need at least one buffer on ring to get going */
if (vnic_rq_desc_used(&enic->rq[i].vrq) == 0) {
netdev_err(netdev, "Unable to alloc receive buffers\n");
@@ -1939,7 +1943,7 @@ static int enic_open(struct net_device *netdev)
for (i = 0; i < enic->rq_count; i++) {
ret = vnic_rq_disable(&enic->rq[i].vrq);
if (!ret)
- vnic_rq_clean(&enic->rq[i].vrq, enic_free_rq_buf);
+ vnic_rq_clean(&enic->rq[i].vrq, enic->rq_free_buf);
}
enic_dev_notify_unset(enic);
err_out_free_intr:
@@ -1998,7 +2002,7 @@ static int enic_stop(struct net_device *netdev)
for (i = 0; i < enic->wq_count; i++)
vnic_wq_clean(&enic->wq[i].vwq, enic_free_wq_buf);
for (i = 0; i < enic->rq_count; i++)
- vnic_rq_clean(&enic->rq[i].vrq, enic_free_rq_buf);
+ vnic_rq_clean(&enic->rq[i].vrq, enic->rq_free_buf);
for (i = 0; i < enic->cq_count; i++)
vnic_cq_clean(&enic->cq[i]);
for (i = 0; i < enic->intr_count; i++)
@@ -114,7 +114,7 @@ int enic_rq_service(struct vnic_dev *vdev, struct cq_desc *cq_desc,
struct enic *enic = vnic_dev_priv(vdev);
vnic_rq_service(&enic->rq[q_number].vrq, cq_desc, completed_index,
- VNIC_RQ_RETURN_DESC, enic_rq_indicate_buf, opaque);
+ VNIC_RQ_RETURN_DESC, enic->rq_buf_service, opaque);
return 0;
}