Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp695667ybl; Fri, 16 Aug 2019 02:30:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt66izLkcXu73McPC+yjP9ff4jSsiyDTehJz6K3cQmLftCU7Bl+W46Nf0oJTJY5UWsNWsZ X-Received: by 2002:a17:90a:3646:: with SMTP id s64mr6344293pjb.44.1565947804706; Fri, 16 Aug 2019 02:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565947804; cv=none; d=google.com; s=arc-20160816; b=cKma5rcZ9WqqNLnWk2w1ctbEyPqLUNy4jWD6d4u9cNVizt404i0mK0Dkum+sGrQnRY 1ZkgHpd191koI+b/VhykRpaNzqiAk1CS1y7FX7R9WJ4oOqzKoznnWbiR6Oy5d4jzr9Jg /GnpZrl5MrgB9jDopjBCxN9ZqIxEryFgOVVKPCtlQ/nd+nO11so8NSfFlJoDoaqYrd5/ cpSrowwHPUSqpQm9UngYP2G5fAdxtTyRF7BXQk3bhjHCvsziVxuGlEp480Cu2xl+1DoV g0YI4p70erJ+HV9dTUjgFXy2xVkEyxXph6XFeSYds1QLX8NnxcjxlluQ2qp87dvT3CJY m8kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=oYkbotweVRb4ftV2/uVHHZIFS0AoWMqkCv8uwUS+oiE=; b=oc0CiRkemnFj/YRnbxQZ+UuppaaMWL8AZFYshRn+omgWfEVYzu/oOA75vRS3WbeWS9 dBMMwd4qUNt4p3G2v1repF4IhdiGOmaOuEINt/kdj+rjxPZRgFuA9OCFNWl0LSVCX9hS Lw7hnZ+z1EHF8lcwc3Xpku99CP9y3PAVTsv8O8cEnELu/xBVeaAjBeJxjUqzdFSEZTi6 ywXHP8mpWUu98agJIfs2fqTiIWRBgRiTOeXx6WKimXJ1adI8RWGSz6HSMPrgY5yHkRDn 7DRFxhiAgQRtZ+OasAX20rUPaX7WIppJ63KqHsc14gnr0WlpWRwpIE8t/V146SnI7PpV 6Uzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FfyHhKNN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si3766262plw.379.2019.08.16.02.29.47; Fri, 16 Aug 2019 02:30:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FfyHhKNN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbfHPJ1Q (ORCPT + 99 others); Fri, 16 Aug 2019 05:27:16 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38145 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbfHPJ1P (ORCPT ); Fri, 16 Aug 2019 05:27:15 -0400 Received: by mail-wr1-f68.google.com with SMTP id g17so904045wrr.5; Fri, 16 Aug 2019 02:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oYkbotweVRb4ftV2/uVHHZIFS0AoWMqkCv8uwUS+oiE=; b=FfyHhKNNxm1mI2D+JurEucOuQV6fl3XUDy/copih67qITK5WZoaDNfy7tTGTwIyXdN tmy0wK7NlDtAX14x2LTN2Q/rjsZZ6bq+loYe8gB+x4UHD4QVCVL39Ky8n5ptAV/GYclT 3BCnvxW3Z/o3N0XvzN093O/VAjRHPSGW7Hhp2rLB0DRRAMWGkeIntEdiNOIKUucHEEjb ohDCqgCdjBHnNOB6hOzGibQh70o3cYkX0DZRJ+DXK5HAHnvmkwF43Y9iKtjSrpTKtUtl FVJxpnGIVHXVF9LjODRtO0koMfDsJFLFjl3hWOWuU6BpqBNhQAcxzr8t2Ust40iZ56qd pK4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oYkbotweVRb4ftV2/uVHHZIFS0AoWMqkCv8uwUS+oiE=; b=iRpniliuz+Tmq5hZaTzpnpXN7b1vMJ0Uqfu+kqE/L9H2wNBAeB4CyPVRNUjPIdk455 htyZLLzCY0a775X1WVTxiy1PRLAAhiTiws6I/d+dr88rBZdGVEKLy4PWQbqiOdwFXOKD ZJuajVZB7Xdnkx4P64jI1mxZqFdEZKxJJrOpF1olgtEua8/2F7Pgjt9lFqyviN4fSY4f ycQvJrOUDyxeB2GxlkqMmHr4gffs3HUDYxQ86qXtBsbMM4cmnDw14AFUek3B+kQFOe5g WWnPTJ/DBVZM17/vZkBkthAUAcc4bjSox/mKdiRwUWSbKxaWrOSJgWOrPZPuRJITsgjl JZxg== X-Gm-Message-State: APjAAAXwjTmsyxdUnP6eZMW+nsohjZhwx9v5EIhyR7RS0D0LzKPTz0ni CqCBjlZk/ZbHxLfzxGZzKZv893ec X-Received: by 2002:adf:dcc6:: with SMTP id x6mr9719759wrm.322.1565947633523; Fri, 16 Aug 2019 02:27:13 -0700 (PDT) Received: from [192.168.8.147] (187.170.185.81.rev.sfr.net. [81.185.170.187]) by smtp.gmail.com with ESMTPSA id t19sm3826386wmi.29.2019.08.16.02.27.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:27:12 -0700 (PDT) Subject: Re: [PATCH net-next] r8152: divide the tx and rx bottom functions To: Hayes Wang , Eric Dumazet , "netdev@vger.kernel.org" Cc: nic_swsd , "linux-kernel@vger.kernel.org" References: <1394712342-15778-301-Taiwan-albertk@realtek.com> <9749764d-7815-b673-0fc4-22475601efec@gmail.com> <0835B3720019904CB8F7AA43166CEEB2F18D470D@RTITMBSVM03.realtek.com.tw> <68015004-fb60-f6c6-05b0-610466223cf5@gmail.com> <0835B3720019904CB8F7AA43166CEEB2F18D47C8@RTITMBSVM03.realtek.com.tw> From: Eric Dumazet Message-ID: Date: Fri, 16 Aug 2019 11:27:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <0835B3720019904CB8F7AA43166CEEB2F18D47C8@RTITMBSVM03.realtek.com.tw> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/16/19 11:08 AM, Hayes Wang wrote: > Eric Dumazet [mailto:eric.dumazet@gmail.com] >> Sent: Friday, August 16, 2019 4:20 PM > [...] >> Which callback ? > > The USB device has two endpoints for Tx and Rx. > If I submit tx or rx URB to the USB host controller, > the relative callback functions would be called, when > they are finished. For rx, it is read_bulk_callback. > For tx, it is write_bulk_callback. > >> After an idle period (no activity, no prior packets being tx-completed ...), >> a packet is sent by the upper stack, enters the ndo_start_xmit() of a network >> driver. >> >> This driver ndo_start_xmit() simply adds an skb to a local list, and returns. > > Base on the current method (without tasklet), when > ndo_start_xmit() is called, napi_schedule is called only > if there is at least one free buffer (!list_empty(&tp->tx_free)) > to transmit the packet. Then, the flow would be as following. Very uncommon naming conventions really :/ Maybe you would avoid messing with a tasklet (we really try to get rid of tasklets in general) using two NAPI, one for TX, one for RX. Some drivers already use two NAPI, it is fine. This might avoid the ugly dance in r8152_poll(), calling napi_schedule(napi) after napi_complete_done() !