aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys
diff options
context:
space:
mode:
authorDavid Kershner <david.kershner@unisys.com>2016-01-15 11:19:05 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-07 17:34:58 -0800
commit61dd330a284b7164eda3549ea3ec1bb53598a21e (patch)
treebc53e4fda9614fd83b383942ac0337891e4738b3 /drivers/staging/unisys
parentstaging: unisys: fix parenthesis in toolaction_show() (diff)
downloadlinux-dev-61dd330a284b7164eda3549ea3ec1bb53598a21e.tar.xz
linux-dev-61dd330a284b7164eda3549ea3ec1bb53598a21e.zip
staging: unisys: Only process up to budget amount of responses
>From napi documentation you should only process the amount your budget allows, if you go over it just wait for the next napi poll to continue. Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys')
-rw-r--r--drivers/staging/unisys/visornic/visornic_main.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 05194707278a..2d51299825cf 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -36,6 +36,7 @@
* = 163840 bytes
*/
#define MAX_BUF 163840
+#define NAPI_WEIGHT 64
static int visornic_probe(struct visor_device *dev);
static void visornic_remove(struct visor_device *dev);
@@ -1613,14 +1614,12 @@ drain_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata)
*/
static void
service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata,
- int *rx_work_done)
+ int *rx_work_done, int budget)
{
unsigned long flags;
struct net_device *netdev;
- /* TODO: CLIENT ACQUIRE -- Don't really need this at the
- * moment */
- for (;;) {
+ while (*rx_work_done < budget) {
if (!visorchannel_signalremove(devdata->dev->visorchannel,
IOCHAN_FROM_IOPART,
cmdrsp))
@@ -1709,7 +1708,7 @@ static int visornic_poll(struct napi_struct *napi, int budget)
int rx_count = 0;
send_rcv_posts_if_needed(devdata);
- service_resp_queue(devdata->cmdrsp, devdata, &rx_count);
+ service_resp_queue(devdata->cmdrsp, devdata, &rx_count, budget);
/*
* If there aren't any more packets to receive
@@ -1893,6 +1892,16 @@ static int visornic_probe(struct visor_device *dev)
goto cleanup_napi_add;
}
+ /* Let's start our threads to get responses */
+ netif_napi_add(netdev, &devdata->napi, visornic_poll, NAPI_WEIGHT);
+
+ /*
+ * Note: Interupts have to be enable before the while
+ * loop below because the napi routine is responsible for
+ * setting enab_dis_acked
+ */
+ visorbus_enable_channel_interrupts(dev);
+
err = register_netdev(netdev);
if (err) {
dev_err(&dev->device,