linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
@ 2025-06-10 14:54 Jun Miao
  2025-06-13  1:51 ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Jun Miao @ 2025-06-10 14:54 UTC (permalink / raw)
  To: oneukum, sbhatta, kuba, netdev; +Cc: linux-usb, linux-kernel, jun.miao

Migrate tasklet APIs to the new bottom half workqueue mechanism. It
replaces all occurrences of tasklet usage with the appropriate workqueue
APIs throughout the usbnet driver. This transition ensures compatibility
with the latest design and enhances performance.

As suggested by Oliver and Sundeep, the usbnet_bh() function only be
called by usbnet_bh_workqueue(). It can be waited on in usbnet_stop(), which
in turn can be called for a device reset. Hence this must be GFP_NOIO
instead of GFP_ATOMIC in the rx_alloc_submit().

Suggested-by: Subbaraya Sundeep <sbhatta@marvell.com>
Suggested-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Jun Miao <jun.miao@intel.com>
---
 drivers/net/usb/usbnet.c   | 38 +++++++++++++++++++-------------------
 include/linux/usb/usbnet.h |  2 +-
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index c04e715a4c2a..c2750fd5eb59 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -461,7 +461,7 @@ static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,
 
 	__skb_queue_tail(&dev->done, skb);
 	if (dev->done.qlen == 1)
-		tasklet_schedule(&dev->bh);
+		queue_work(system_bh_wq, &dev->bh_work);
 	spin_unlock(&dev->done.lock);
 	spin_unlock_irqrestore(&list->lock, flags);
 	return old_state;
@@ -549,7 +549,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
 		default:
 			netif_dbg(dev, rx_err, dev->net,
 				  "rx submit, %d\n", retval);
-			tasklet_schedule (&dev->bh);
+			queue_work(system_bh_wq, &dev->bh_work);
 			break;
 		case 0:
 			__usbnet_queue_skb(&dev->rxq, skb, rx_start);
@@ -709,7 +709,7 @@ void usbnet_resume_rx(struct usbnet *dev)
 		num++;
 	}
 
-	tasklet_schedule(&dev->bh);
+	queue_work(system_bh_wq, &dev->bh_work);
 
 	netif_dbg(dev, rx_status, dev->net,
 		  "paused rx queue disabled, %d skbs requeued\n", num);
@@ -778,7 +778,7 @@ void usbnet_unlink_rx_urbs(struct usbnet *dev)
 {
 	if (netif_running(dev->net)) {
 		(void) unlink_urbs (dev, &dev->rxq);
-		tasklet_schedule(&dev->bh);
+		queue_work(system_bh_wq, &dev->bh_work);
 	}
 }
 EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
@@ -861,14 +861,14 @@ int usbnet_stop (struct net_device *net)
 	/* deferred work (timer, softirq, task) must also stop */
 	dev->flags = 0;
 	timer_delete_sync(&dev->delay);
-	tasklet_kill(&dev->bh);
+	disable_work_sync(&dev->bh_work);
 	cancel_work_sync(&dev->kevent);
 
 	/* We have cyclic dependencies. Those calls are needed
 	 * to break a cycle. We cannot fall into the gaps because
 	 * we have a flag
 	 */
-	tasklet_kill(&dev->bh);
+	disable_work_sync(&dev->bh_work);
 	timer_delete_sync(&dev->delay);
 	cancel_work_sync(&dev->kevent);
 
@@ -955,7 +955,7 @@ int usbnet_open (struct net_device *net)
 	clear_bit(EVENT_RX_KILL, &dev->flags);
 
 	// delay posting reads until we're fully open
-	tasklet_schedule (&dev->bh);
+	queue_work(system_bh_wq, &dev->bh_work);
 	if (info->manage_power) {
 		retval = info->manage_power(dev, 1);
 		if (retval < 0) {
@@ -1123,7 +1123,7 @@ static void __handle_link_change(struct usbnet *dev)
 		 */
 	} else {
 		/* submitting URBs for reading packets */
-		tasklet_schedule(&dev->bh);
+		queue_work(system_bh_wq, &dev->bh_work);
 	}
 
 	/* hard_mtu or rx_urb_size may change during link change */
@@ -1198,11 +1198,11 @@ usbnet_deferred_kevent (struct work_struct *work)
 		} else {
 			clear_bit (EVENT_RX_HALT, &dev->flags);
 			if (!usbnet_going_away(dev))
-				tasklet_schedule(&dev->bh);
+				queue_work(system_bh_wq, &dev->bh_work);
 		}
 	}
 
-	/* tasklet could resubmit itself forever if memory is tight */
+	/* workqueue could resubmit itself forever if memory is tight */
 	if (test_bit (EVENT_RX_MEMORY, &dev->flags)) {
 		struct urb	*urb = NULL;
 		int resched = 1;
@@ -1224,7 +1224,7 @@ usbnet_deferred_kevent (struct work_struct *work)
 fail_lowmem:
 			if (resched)
 				if (!usbnet_going_away(dev))
-					tasklet_schedule(&dev->bh);
+					queue_work(system_bh_wq, &dev->bh_work);
 		}
 	}
 
@@ -1325,7 +1325,7 @@ void usbnet_tx_timeout (struct net_device *net, unsigned int txqueue)
 	struct usbnet		*dev = netdev_priv(net);
 
 	unlink_urbs (dev, &dev->txq);
-	tasklet_schedule (&dev->bh);
+	queue_work(system_bh_wq, &dev->bh_work);
 	/* this needs to be handled individually because the generic layer
 	 * doesn't know what is sufficient and could not restore private
 	 * information if a remedy of an unconditional reset were used.
@@ -1547,7 +1547,7 @@ static inline void usb_free_skb(struct sk_buff *skb)
 
 /*-------------------------------------------------------------------------*/
 
-// tasklet (work deferred from completions, in_irq) or timer
+// workqueue (work deferred from completions, in_irq) or timer
 
 static void usbnet_bh (struct timer_list *t)
 {
@@ -1594,23 +1594,23 @@ static void usbnet_bh (struct timer_list *t)
 		int	temp = dev->rxq.qlen;
 
 		if (temp < RX_QLEN(dev)) {
-			if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK)
+			if (rx_alloc_submit(dev, GFP_NOIO) == -ENOLINK)
 				return;
 			if (temp != dev->rxq.qlen)
 				netif_dbg(dev, link, dev->net,
 					  "rxqlen %d --> %d\n",
 					  temp, dev->rxq.qlen);
 			if (dev->rxq.qlen < RX_QLEN(dev))
-				tasklet_schedule (&dev->bh);
+				queue_work(system_bh_wq, &dev->bh_work);
 		}
 		if (dev->txq.qlen < TX_QLEN (dev))
 			netif_wake_queue (dev->net);
 	}
 }
 
-static void usbnet_bh_tasklet(struct tasklet_struct *t)
+static void usbnet_bh_workqueue(struct work_struct *work)
 {
-	struct usbnet *dev = from_tasklet(dev, t, bh);
+	struct usbnet *dev = from_work(dev, work, bh_work);
 
 	usbnet_bh(&dev->delay);
 }
@@ -1742,7 +1742,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	skb_queue_head_init (&dev->txq);
 	skb_queue_head_init (&dev->done);
 	skb_queue_head_init(&dev->rxq_pause);
-	tasklet_setup(&dev->bh, usbnet_bh_tasklet);
+	INIT_WORK (&dev->bh_work, usbnet_bh_workqueue);
 	INIT_WORK (&dev->kevent, usbnet_deferred_kevent);
 	init_usb_anchor(&dev->deferred);
 	timer_setup(&dev->delay, usbnet_bh, 0);
@@ -1971,7 +1971,7 @@ int usbnet_resume (struct usb_interface *intf)
 
 			if (!(dev->txq.qlen >= TX_QLEN(dev)))
 				netif_tx_wake_all_queues(dev->net);
-			tasklet_schedule (&dev->bh);
+			queue_work(system_bh_wq, &dev->bh_work);
 		}
 	}
 
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0b9f1e598e3a..208682f77179 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -58,7 +58,7 @@ struct usbnet {
 	unsigned		interrupt_count;
 	struct mutex		interrupt_mutex;
 	struct usb_anchor	deferred;
-	struct tasklet_struct	bh;
+	struct work_struct	bh_work;
 
 	struct work_struct	kevent;
 	unsigned long		flags;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
  2025-06-10 14:54 [PATCH V2] net: usb: Convert tasklet API to new bottom half workqueue mechanism Jun Miao
@ 2025-06-13  1:51 ` Jakub Kicinski
  2025-06-13  9:16   ` Subbaraya Sundeep
  2025-06-13 12:33   ` Miao, Jun
  0 siblings, 2 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-06-13  1:51 UTC (permalink / raw)
  To: Jun Miao; +Cc: oneukum, sbhatta, netdev, linux-usb, linux-kernel

On Tue, 10 Jun 2025 22:54:03 +0800 Jun Miao wrote:
> -			if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK)
> +			if (rx_alloc_submit(dev, GFP_NOIO) == -ENOLINK)

Sorry, I think Subbaraya mislead you. v1 was fine.
If we want to change the flags (which Im not sure is correct) it should
be a separate commit. Could you repost v1? There is no need to attribute
reviewers with Suggested-by tags. They can send their review tags if
they so wish.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
  2025-06-13  1:51 ` Jakub Kicinski
@ 2025-06-13  9:16   ` Subbaraya Sundeep
  2025-06-13 12:33   ` Miao, Jun
  1 sibling, 0 replies; 6+ messages in thread
From: Subbaraya Sundeep @ 2025-06-13  9:16 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Jun Miao, oneukum, netdev, linux-usb, linux-kernel

On 2025-06-13 at 01:51:31, Jakub Kicinski (kuba@kernel.org) wrote:
> On Tue, 10 Jun 2025 22:54:03 +0800 Jun Miao wrote:
> > -			if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK)
> > +			if (rx_alloc_submit(dev, GFP_NOIO) == -ENOLINK)
> 
> Sorry, I think Subbaraya mislead you. v1 was fine.
> If we want to change the flags (which Im not sure is correct) it should
> be a separate commit. Could you repost v1? There is no need to attribute
Yeah hence asked to correct me if wrong.
GFP_ATOMIC has to be there - "this patchset implements BH workqueues
which are like regular workqueues but executes work items in the BH
(softirq) context" from:
https://lwn.net/Articles/960020/

Thanks,
Sundeep
> reviewers with Suggested-by tags. They can send their review tags if
> they so wish.
> -- 
> pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH V2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
  2025-06-13  1:51 ` Jakub Kicinski
  2025-06-13  9:16   ` Subbaraya Sundeep
@ 2025-06-13 12:33   ` Miao, Jun
  1 sibling, 0 replies; 6+ messages in thread
From: Miao, Jun @ 2025-06-13 12:33 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: oneukum@suse.com, sbhatta@marvell.com, netdev@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org

>
>On Tue, 10 Jun 2025 22:54:03 +0800 Jun Miao wrote:
>> -			if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK)
>> +			if (rx_alloc_submit(dev, GFP_NOIO) == -ENOLINK)
>
>Sorry, I think Subbaraya mislead you. v1 was fine.
>If we want to change the flags (which Im not sure is correct) it should be a
>separate commit. Could you repost v1? There is no need to attribute reviewers
No problem, repost v1 again without Suggested-by tags.
Separate commit can be in other patch when changing the flags.

Thanks
Jun Miao

>with Suggested-by tags. They can send their review tags if they so wish.
>--
>pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
@ 2025-06-14 11:14 Jun Miao
  2025-06-14 14:15 ` kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: Jun Miao @ 2025-06-14 11:14 UTC (permalink / raw)
  To: sbhatta, kuba, oneukum
  Cc: netdev, linux-usb, linux-kernel, qiang.zhang, jun.miao

Migrate tasklet APIs to the new bottom half workqueue mechanism. It
replaces all occurrences of tasklet usage with the appropriate workqueue
APIs throughout the usbnet driver. This transition ensures compatibility
with the latest design and enhances performance.

Signed-off-by: Jun Miao <jun.miao@intel.com>
---
v1->v2:
	Check patch warning, delete the more spaces.
---
 drivers/net/usb/usbnet.c   | 36 ++++++++++++++++++------------------
 include/linux/usb/usbnet.h |  2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index c04e715a4c2a..566127b4e0ba 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -461,7 +461,7 @@ static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,

 	__skb_queue_tail(&dev->done, skb);
 	if (dev->done.qlen == 1)
-		tasklet_schedule(&dev->bh);
+		queue_work(system_bh_wq, &dev->bh_work);
 	spin_unlock(&dev->done.lock);
 	spin_unlock_irqrestore(&list->lock, flags);
 	return old_state;
@@ -549,7 +549,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
 		default:
 			netif_dbg(dev, rx_err, dev->net,
 				  "rx submit, %d\n", retval);
-			tasklet_schedule (&dev->bh);
+			queue_work(system_bh_wq, &dev->bh_work);
 			break;
 		case 0:
 			__usbnet_queue_skb(&dev->rxq, skb, rx_start);
@@ -709,7 +709,7 @@ void usbnet_resume_rx(struct usbnet *dev)
 		num++;
 	}

-	tasklet_schedule(&dev->bh);
+	queue_work(system_bh_wq, &dev->bh_work);

 	netif_dbg(dev, rx_status, dev->net,
 		  "paused rx queue disabled, %d skbs requeued\n", num);
@@ -778,7 +778,7 @@ void usbnet_unlink_rx_urbs(struct usbnet *dev)
 {
 	if (netif_running(dev->net)) {
 		(void) unlink_urbs (dev, &dev->rxq);
-		tasklet_schedule(&dev->bh);
+		queue_work(system_bh_wq, &dev->bh_work);
 	}
 }
 EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
@@ -861,14 +861,14 @@ int usbnet_stop (struct net_device *net)
 	/* deferred work (timer, softirq, task) must also stop */
 	dev->flags = 0;
 	timer_delete_sync(&dev->delay);
-	tasklet_kill(&dev->bh);
+	disable_work_sync(&dev->bh_work);
 	cancel_work_sync(&dev->kevent);

 	/* We have cyclic dependencies. Those calls are needed
 	 * to break a cycle. We cannot fall into the gaps because
 	 * we have a flag
 	 */
-	tasklet_kill(&dev->bh);
+	disable_work_sync(&dev->bh_work);
 	timer_delete_sync(&dev->delay);
 	cancel_work_sync(&dev->kevent);

@@ -955,7 +955,7 @@ int usbnet_open (struct net_device *net)
 	clear_bit(EVENT_RX_KILL, &dev->flags);

 	// delay posting reads until we're fully open
-	tasklet_schedule (&dev->bh);
+	queue_work(system_bh_wq, &dev->bh_work);
 	if (info->manage_power) {
 		retval = info->manage_power(dev, 1);
 		if (retval < 0) {
@@ -1123,7 +1123,7 @@ static void __handle_link_change(struct usbnet *dev)
 		 */
 	} else {
 		/* submitting URBs for reading packets */
-		tasklet_schedule(&dev->bh);
+		queue_work(system_bh_wq, &dev->bh_work);
 	}

 	/* hard_mtu or rx_urb_size may change during link change */
@@ -1198,11 +1198,11 @@ usbnet_deferred_kevent (struct work_struct *work)
 		} else {
 			clear_bit (EVENT_RX_HALT, &dev->flags);
 			if (!usbnet_going_away(dev))
-				tasklet_schedule(&dev->bh);
+				queue_work(system_bh_wq, &dev->bh_work);
 		}
 	}

-	/* tasklet could resubmit itself forever if memory is tight */
+	/* workqueue could resubmit itself forever if memory is tight */
 	if (test_bit (EVENT_RX_MEMORY, &dev->flags)) {
 		struct urb	*urb = NULL;
 		int resched = 1;
@@ -1224,7 +1224,7 @@ usbnet_deferred_kevent (struct work_struct *work)
 fail_lowmem:
 			if (resched)
 				if (!usbnet_going_away(dev))
-					tasklet_schedule(&dev->bh);
+					queue_work(system_bh_wq, &dev->bh_work);
 		}
 	}

@@ -1325,7 +1325,7 @@ void usbnet_tx_timeout (struct net_device *net, unsigned int txqueue)
 	struct usbnet		*dev = netdev_priv(net);

 	unlink_urbs (dev, &dev->txq);
-	tasklet_schedule (&dev->bh);
+	queue_work(system_bh_wq, &dev->bh_work);
 	/* this needs to be handled individually because the generic layer
 	 * doesn't know what is sufficient and could not restore private
 	 * information if a remedy of an unconditional reset were used.
@@ -1547,7 +1547,7 @@ static inline void usb_free_skb(struct sk_buff *skb)

 /*-------------------------------------------------------------------------*/

-// tasklet (work deferred from completions, in_irq) or timer
+// workqueue (work deferred from completions, in_irq) or timer

 static void usbnet_bh (struct timer_list *t)
 {
@@ -1601,16 +1601,16 @@ static void usbnet_bh (struct timer_list *t)
 					  "rxqlen %d --> %d\n",
 					  temp, dev->rxq.qlen);
 			if (dev->rxq.qlen < RX_QLEN(dev))
-				tasklet_schedule (&dev->bh);
+				queue_work(system_bh_wq, &dev->bh_work);
 		}
 		if (dev->txq.qlen < TX_QLEN (dev))
 			netif_wake_queue (dev->net);
 	}
 }

-static void usbnet_bh_tasklet(struct tasklet_struct *t)
+static void usbnet_bh_workqueue(struct work_struct *work)
 {
-	struct usbnet *dev = from_tasklet(dev, t, bh);
+	struct usbnet *dev = from_work(dev, work, bh_work);

 	usbnet_bh(&dev->delay);
 }
@@ -1742,7 +1742,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	skb_queue_head_init (&dev->txq);
 	skb_queue_head_init (&dev->done);
 	skb_queue_head_init(&dev->rxq_pause);
-	tasklet_setup(&dev->bh, usbnet_bh_tasklet);
+	INIT_WORK(&dev->bh_work, usbnet_bh_workqueue);
 	INIT_WORK (&dev->kevent, usbnet_deferred_kevent);
 	init_usb_anchor(&dev->deferred);
 	timer_setup(&dev->delay, usbnet_bh, 0);
a@@ -1971,7 +1971,7 @@ int usbnet_resume (struct usb_interface *intf)

 			if (!(dev->txq.qlen >= TX_QLEN(dev)))
 				netif_tx_wake_all_queues(dev->net);
-			tasklet_schedule (&dev->bh);
+			queue_work(system_bh_wq, &dev->bh_work);
 		}
 	}

diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0b9f1e598e3a..208682f77179 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -58,7 +58,7 @@ struct usbnet {
 	unsigned		interrupt_count;
 	struct mutex		interrupt_mutex;
 	struct usb_anchor	deferred;
-	struct tasklet_struct	bh;
+	struct work_struct	bh_work;

 	struct work_struct	kevent;
 	unsigned long		flags;
--
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
  2025-06-14 11:14 [PATCH v2] " Jun Miao
@ 2025-06-14 14:15 ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-06-14 14:15 UTC (permalink / raw)
  To: Jun Miao, sbhatta, kuba, oneukum
  Cc: oe-kbuild-all, netdev, linux-usb, linux-kernel, qiang.zhang,
	jun.miao

Hi Jun,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus net/main net-next/main linus/master v6.16-rc1 next-20250613]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jun-Miao/net-usb-Convert-tasklet-API-to-new-bottom-half-workqueue-mechanism/20250614-191339
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20250614111414.2502195-1-jun.miao%40intel.com
patch subject: [PATCH v2] net: usb: Convert tasklet API to new bottom half workqueue mechanism
config: nios2-randconfig-001-20250614 (https://download.01.org/0day-ci/archive/20250614/202506142111.KG4EupOI-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250614/202506142111.KG4EupOI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506142111.KG4EupOI-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/usb/usbnet.c: In function 'usbnet_resume':
>> drivers/net/usb/usbnet.c:1974:47: error: 'struct usbnet' has no member named 'bh'
    1974 |                         tasklet_schedule (&dev->bh);
         |                                               ^~


vim +1974 drivers/net/usb/usbnet.c

^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1931  
38bde1d4699af4 drivers/usb/net/usbnet.c David Brownell   2005-08-31  1932  int usbnet_resume (struct usb_interface *intf)
^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1933  {
^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1934  	struct usbnet		*dev = usb_get_intfdata(intf);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1935  	struct sk_buff          *skb;
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1936  	struct urb              *res;
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1937  	int                     retval;
^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1938  
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1939  	if (!--dev->suspend_count) {
6eecdc5f95a393 drivers/net/usb/usbnet.c Dan Williams     2013-05-06  1940  		/* resume interrupt URB if it was previously submitted */
6eecdc5f95a393 drivers/net/usb/usbnet.c Dan Williams     2013-05-06  1941  		__usbnet_status_start_force(dev, GFP_NOIO);
68972efa657040 drivers/net/usb/usbnet.c Paul Stewart     2011-04-28  1942  
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1943  		spin_lock_irq(&dev->txq.lock);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1944  		while ((res = usb_get_from_anchor(&dev->deferred))) {
a11a6544c0bf6c drivers/net/usb/usbnet.c Oliver Neukum    2007-08-03  1945  
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1946  			skb = (struct sk_buff *)res->context;
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1947  			retval = usb_submit_urb(res, GFP_ATOMIC);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1948  			if (retval < 0) {
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1949  				dev_kfree_skb_any(skb);
638c5115a79498 drivers/net/usb/usbnet.c Ming Lei         2013-08-08  1950  				kfree(res->sg);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1951  				usb_free_urb(res);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1952  				usb_autopm_put_interface_async(dev->intf);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1953  			} else {
860e9538a9482b drivers/net/usb/usbnet.c Florian Westphal 2016-05-03  1954  				netif_trans_update(dev->net);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1955  				__skb_queue_tail(&dev->txq, skb);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1956  			}
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1957  		}
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1958  
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1959  		smp_mb();
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1960  		clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1961  		spin_unlock_irq(&dev->txq.lock);
75bd0cbdc21d80 drivers/net/usb/usbnet.c Ming Lei         2011-04-28  1962  
75bd0cbdc21d80 drivers/net/usb/usbnet.c Ming Lei         2011-04-28  1963  		if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
14a0d635d18d0f drivers/net/usb/usbnet.c Oliver Neukum    2014-03-26  1964  			/* handle remote wakeup ASAP
14a0d635d18d0f drivers/net/usb/usbnet.c Oliver Neukum    2014-03-26  1965  			 * we cannot race against stop
14a0d635d18d0f drivers/net/usb/usbnet.c Oliver Neukum    2014-03-26  1966  			 */
14a0d635d18d0f drivers/net/usb/usbnet.c Oliver Neukum    2014-03-26  1967  			if (netif_device_present(dev->net) &&
65841fd5132c39 drivers/net/usb/usbnet.c Ming Lei         2012-06-19  1968  				!timer_pending(&dev->delay) &&
65841fd5132c39 drivers/net/usb/usbnet.c Ming Lei         2012-06-19  1969  				!test_bit(EVENT_RX_HALT, &dev->flags))
ab6f148de28261 drivers/net/usb/usbnet.c Oliver Neukum    2012-08-26  1970  					rx_alloc_submit(dev, GFP_NOIO);
65841fd5132c39 drivers/net/usb/usbnet.c Ming Lei         2012-06-19  1971  
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1972  			if (!(dev->txq.qlen >= TX_QLEN(dev)))
1aa9bc5b2f4cf8 drivers/net/usb/usbnet.c Alexey Orishko   2012-03-14  1973  				netif_tx_wake_all_queues(dev->net);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03 @1974  			tasklet_schedule (&dev->bh);
69ee472f270637 drivers/net/usb/usbnet.c Oliver Neukum    2009-12-03  1975  		}
75bd0cbdc21d80 drivers/net/usb/usbnet.c Ming Lei         2011-04-28  1976  	}
5d9d01a30204c9 drivers/net/usb/usbnet.c Oliver Neukum    2012-10-11  1977  
5d9d01a30204c9 drivers/net/usb/usbnet.c Oliver Neukum    2012-10-11  1978  	if (test_and_clear_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags))
5d9d01a30204c9 drivers/net/usb/usbnet.c Oliver Neukum    2012-10-11  1979  		usb_autopm_get_interface_no_resume(intf);
5d9d01a30204c9 drivers/net/usb/usbnet.c Oliver Neukum    2012-10-11  1980  
^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1981  	return 0;
^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1982  }
38bde1d4699af4 drivers/usb/net/usbnet.c David Brownell   2005-08-31  1983  EXPORT_SYMBOL_GPL(usbnet_resume);
^1da177e4c3f41 drivers/usb/net/usbnet.c Linus Torvalds   2005-04-16  1984  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-14 14:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 14:54 [PATCH V2] net: usb: Convert tasklet API to new bottom half workqueue mechanism Jun Miao
2025-06-13  1:51 ` Jakub Kicinski
2025-06-13  9:16   ` Subbaraya Sundeep
2025-06-13 12:33   ` Miao, Jun
  -- strict thread matches above, loose matches on Subject: below --
2025-06-14 11:14 [PATCH v2] " Jun Miao
2025-06-14 14:15 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).