lkml.org 
[lkml]   [2004]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 12/14 linux-2.6.7-rc1] prism54: Start using likely/unlikely

2004-04-26 Margit Schubert-While <margitsw@t-online.de>

* islpci_mgt.h : Replace init_wds with a define. The compiler does not
optimize it out (and also generates the field in the ro section of every module)

* prismcompat(24).h : Include linux/compiler.h Now we can play
with the likely/unlikely macros

* islpci_eth.c, islpci_dev.c : Align skb->data unconditonally after
allocation. This would appear to improve RX rate. Do a little bit of
likely/unlikely.
--
GnuPG Key fingerprint = 113F B290 C6D2 0251 4D84 A34A 6ADD 4937 E20A 525E
2004-04-26 Margit Schubert-While <margitsw@t-online.de>

* islpci_mgt.h : Replace init_wds with a define.
The compiler does not optimize it out (and also generates the
field in the ro section of every module)

* prismcompat(24).h : Include linux/compiler.h
Now we can play with the likely/unlikely macros

* islpci_eth.c, islpci_dev.c : Align skb->data unconditonally
after allocation. This would appear to improve RX rate.
Do a little bit of likely/unlikely.

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/isl_ioctl.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/isl_ioctl.c 17 Apr 2004 08:46:04 -0000 1.152
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/isl_ioctl.c 22 Apr 2004 12:20:39 -0000 1.153
@@ -1,4 +1,4 @@
-/* $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.152 2004/04/17 08:46:04 ajfa Exp $
+/* $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.153 2004/04/22 12:20:39 ajfa Exp $
*
* Copyright (C) 2002 Intersil Americas Inc.
* (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
@@ -2146,7 +2146,7 @@
{PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
"dbg_oid"},
{PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
- {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_get_oid"},
+ {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_set_oid"},
/* --- sub-ioctls handlers --- */
{PRISM54_GET_OID,
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_dev.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_dev.c 19 Apr 2004 18:33:45 -0000 1.76
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_dev.c 26 Apr 2004 10:09:58 -0000 1.77
@@ -1,4 +1,4 @@
-/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.76 2004/04/19 18:33:45 ajfa Exp $
+/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.77 2004/04/26 10:09:58 msw Exp $
*
* Copyright (C) 2002 Intersil Americas Inc.
* Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -560,6 +560,7 @@
skb = NULL;
goto out_free;
}
+ skb_reserve(skb, (4 - (long) skb->data) & 0x03);
/* add the new allocated sk_buff to the buffer array */
priv->data_low_rx[counter] = skb;

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 20 Mar 2004 16:58:36 -0000 1.35
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 26 Apr 2004 10:09:58 -0000 1.36
@@ -1,4 +1,4 @@
-/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.35 2004/03/20 16:58:36 mcgrof Exp $
+/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.36 2004/04/26 10:09:58 msw Exp $
*
* Copyright (C) 2002 Intersil Americas Inc.
* Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
@@ -105,7 +105,7 @@

/* check whether the destination queue has enough fragments for the frame */
curr_frag = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ]);
- if (curr_frag - priv->free_data_tx >= ISL38XX_CB_TX_QSIZE) {
+ if (unlikely(curr_frag - priv->free_data_tx >= ISL38XX_CB_TX_QSIZE)) {
printk(KERN_ERR "%s: transmit device queue full when awake\n",
ndev->name);
netif_stop_queue(ndev);
@@ -121,7 +121,7 @@
/* Check alignment and WDS frame formatting. The start of the packet should
* be aligned on a 4-byte boundary. If WDS is enabled add another 6 bytes
* and add WDS address information */
- if (((long) skb->data & 0x03) | init_wds) {
+ if (unlikely(((long) skb->data & 0x03) | init_wds)) {
/* get the number of bytes to add and re-allign */
offset = (4 - (long) skb->data) & 0x03;
offset += init_wds ? 6 : 0;
@@ -192,7 +192,7 @@
pci_map_address = pci_map_single(priv->pdev,
(void *) skb->data, skb->len,
PCI_DMA_TODEVICE);
- if (pci_map_address == 0) {
+ if (unlikely(pci_map_address == 0)) {
printk(KERN_WARNING "%s: cannot map buffer to PCI\n",
ndev->name);

@@ -382,10 +382,10 @@
skb->dev = ndev;

/* take care of monitor mode and spy monitoring. */
- if (priv->iw_mode == IW_MODE_MONITOR)
+ if (unlikely(priv->iw_mode == IW_MODE_MONITOR))
discard = islpci_monitor_rx(priv, &skb);
else {
- if (skb->data[2 * ETH_ALEN] == 0) {
+ if (unlikely(skb->data[2 * ETH_ALEN] == 0)) {
/* The packet has a rx_annex. Read it for spy monitoring, Then
* remove it, while keeping the 2 leading MAC addr.
*/
@@ -418,7 +418,7 @@
skb->data[0], skb->data[1], skb->data[2], skb->data[3],
skb->data[4], skb->data[5]);
#endif
- if (discard) {
+ if (unlikely(discard)) {
dev_kfree_skb(skb);
skb = NULL;
} else
@@ -434,11 +434,13 @@
index - priv->free_data_rx < ISL38XX_CB_RX_QSIZE) {
/* allocate an sk_buff for received data frames storage
* include any required allignment operations */
- if (skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2), skb == NULL) {
+ skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2);
+ if (unlikely(skb == NULL)) {
/* error allocating an sk_buff structure elements */
DEBUG(SHOW_ERROR_MESSAGES, "Error allocating skb \n");
break;
}
+ skb_reserve(skb, (4 - (long) skb->data) & 0x03);
/* store the new skb structure pointer */
index = index % ISL38XX_CB_RX_QSIZE;
priv->data_low_rx[index] = skb;
@@ -454,7 +456,7 @@
pci_map_single(priv->pdev, (void *) skb->data,
MAX_FRAGMENT_SIZE_RX + 2,
PCI_DMA_FROMDEVICE);
- if (priv->pci_map_rx_address[index] == (dma_addr_t) NULL) {
+ if (unlikely(priv->pci_map_rx_address[index] == (dma_addr_t) NULL)) {
/* error mapping the buffer to device accessable memory address */
DEBUG(SHOW_ERROR_MESSAGES,
"Error mapping DMA address\n");
Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_mgt.h
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_mgt.h 20 Mar 2004 16:58:37 -0000 1.25
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_mgt.h 26 Apr 2004 10:09:58 -0000 1.26
@@ -1,4 +1,4 @@
-/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.h,v 1.25 2004/03/20 16:58:37 mcgrof Exp $
+/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.h,v 1.26 2004/04/26 10:09:58 msw Exp $
*
* Copyright (C) 2002 Intersil Americas Inc.
* Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
@@ -34,7 +34,7 @@
#define TRACE(devname) K_DEBUG(SHOW_TRACING, VERBOSE, "%s: -> " __FUNCTION__ "()\n", devname)

extern int pc_debug;
-static const int init_wds = 0; /* help compiler optimize away dead code */
+#define init_wds 0 /* help compiler optimize away dead code */


/* General driver definitions */
Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat.h
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/prismcompat.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat.h 19 Apr 2004 18:33:45 -0000 1.3
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat.h 26 Apr 2004 10:09:58 -0000 1.4
@@ -32,6 +32,7 @@
#include <linux/config.h>
#include <linux/moduleparam.h>
#include <linux/workqueue.h>
+#include <linux/compiler.h>

#if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE)
#error Firmware Loading is not configured in the kernel !
Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat24.h
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/prismcompat24.h,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat24.h 19 Apr 2004 18:33:45 -0000 1.3
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat24.h 26 Apr 2004 10:09:58 -0000 1.5
@@ -26,6 +26,8 @@
#include <linux/firmware.h>
#include <linux/config.h>
#include <linux/tqueue.h>
+#include <linux/version.h>
+#include <linux/compiler.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25)
#define module_param(x, y, z) MODULE_PARM(x, "i")[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.310 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site