From patchwork Tue Oct 12 12:49:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Yariv X-Patchwork-Id: 247551 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9CCnQLZ013869 for ; Tue, 12 Oct 2010 12:49:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932326Ab0JLMtY (ORCPT ); Tue, 12 Oct 2010 08:49:24 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:48274 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932169Ab0JLMtX (ORCPT ); Tue, 12 Oct 2010 08:49:23 -0400 Received: by mail-wy0-f174.google.com with SMTP id 20so1342536wye.19 for ; Tue, 12 Oct 2010 05:49:23 -0700 (PDT) Received: by 10.227.20.16 with SMTP id d16mr1596430wbb.156.1286887763034; Tue, 12 Oct 2010 05:49:23 -0700 (PDT) Received: from localhost.localdomain (93-172-238-74.bb.netvision.net.il [93.172.238.74]) by mx.google.com with ESMTPS id o43sm2235113weq.47.2010.10.12.05.49.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 12 Oct 2010 05:49:22 -0700 (PDT) From: Ido Yariv To: Luciano Coelho , linux-wireless@vger.kernel.org Cc: Ido Yariv Subject: [PATCH v3 1/4] wl1271: TX aggregation optimization Date: Tue, 12 Oct 2010 14:49:09 +0200 Message-Id: <1286887752-19321-2-git-send-email-ido@wizery.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1286887752-19321-1-git-send-email-ido@wizery.com> References: <1286887752-19321-1-git-send-email-ido@wizery.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Oct 2010 12:49:26 +0000 (UTC) diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c index e3dc13c..b13b373 100644 --- a/drivers/net/wireless/wl12xx/wl1271_tx.c +++ b/drivers/net/wireless/wl12xx/wl1271_tx.c @@ -52,7 +52,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, int id, ret = -EBUSY; if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE) - return -EBUSY; + return -EAGAIN; /* allocate free identifier for the packet */ id = wl1271_tx_id(wl, skb); @@ -210,7 +210,8 @@ void wl1271_tx_work(struct work_struct *work) struct sk_buff *skb; bool woken_up = false; u32 sta_rates = 0; - u32 buf_offset; + u32 buf_offset = 0; + bool sent_packets = false; int ret; /* check if the rates supported by the AP have changed */ @@ -233,9 +234,6 @@ void wl1271_tx_work(struct work_struct *work) wl1271_acx_rate_policies(wl); } - /* Prepare the transfer buffer, by aggregating all - * available packets */ - buf_offset = 0; while ((skb = skb_dequeue(&wl->tx_queue))) { if (!woken_up) { ret = wl1271_ps_elp_wakeup(wl, false); @@ -245,10 +243,20 @@ void wl1271_tx_work(struct work_struct *work) } ret = wl1271_prepare_tx_frame(wl, skb, buf_offset); - if (ret == -EBUSY) { + if (ret == -EAGAIN) { /* - * Either the firmware buffer is full, or the - * aggregation buffer is. + * Aggregation buffer is full. + * Flush buffer and try again. + */ + skb_queue_head(&wl->tx_queue, skb); + wl1271_write(wl, WL1271_SLV_MEM_DATA, wl->aggr_buf, + buf_offset, true); + sent_packets = true; + buf_offset = 0; + continue; + } else if (ret == -EBUSY) { + /* + * Firmware buffer is full. * Queue back last skb, and stop aggregating. */ skb_queue_head(&wl->tx_queue, skb); @@ -265,6 +273,9 @@ out_ack: if (buf_offset) { wl1271_write(wl, WL1271_SLV_MEM_DATA, wl->aggr_buf, buf_offset, true); + sent_packets = true; + } + if (sent_packets) { /* interrupt the firmware with the new packets */ wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); }