eHEA: Fix bonding support

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f9e29228e6f2058e7b086115ecb7008630ebd832
Commit: f9e29228e6f2058e7b086115ecb7008630ebd832
Parent: e190d6b140079c104ba57e5130a9b4ebea618e92
Author: Thomas Klein <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 17:34:09 2007 +0200
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:38:25 2007 -0400

eHEA: Fix bonding support

The driver didn't allow an interface's MAC address to be modified if the
respective interface wasn't setup - a failing Hcall was the result. Thus
bonding wasn't usable. The fix moves the failing Hcall which was registering
a MAC address for the reception of BC packets in firmware from the port up
and down functions to the port resources setup functions. Additionally the
missing update of the last_rx member of the netdev structure was added.

Signed-off-by: Thomas Klein <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/ehea/ehea.h  |2 +-
 drivers/net/ehea/ehea_main.c |   37 +++--
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 6628fa6..489c8b2 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
 #include 
 
 #define DRV_NAME   "ehea"
-#define DRV_VERSION"EHEA_0070"
+#define DRV_VERSION"EHEA_0071"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 1d1571c..4c70a93 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -466,6 +466,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device 
*dev,
 cqe->vlan_tag);
else
netif_receive_skb(skb);
+
+   dev->last_rx = jiffies;
} else {
pr->p_stats.poll_receive_errors++;
port_reset = ehea_treat_poll_error(pr, rq, cqe,
@@ -1433,7 +1435,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port 
*port, u32 hcallid)
 port->logical_port_id,
 reg_type, port->mac_addr, 0, hcallid);
if (hret != H_SUCCESS) {
-   ehea_error("reg_dereg_bcmc failed (tagged)");
+   ehea_error("%sregistering bc address failed (tagged)",
+   hcallid == H_REG_BCMC ? "" : "de");
ret = -EIO;
goto out_herr;
}
@@ -1444,7 +1447,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port 
*port, u32 hcallid)
 port->logical_port_id,
 reg_type, port->mac_addr, 0, hcallid);
if (hret != H_SUCCESS) {
-   ehea_error("reg_dereg_bcmc failed (vlan)");
+   ehea_error("%sregistering bc address failed (vlan)",
+  hcallid == H_REG_BCMC ? "" : "de");
ret = -EIO;
}
 out_herr:
@@ -2170,7 +2174,6 @@ static int ehea_up(struct net_device *dev)
 {
int ret, i;
struct ehea_port *port = netdev_priv(dev);
-   u64 mac_addr = 0;
 
if (port->state == EHEA_PORT_UP)
return 0;
@@ -2189,18 +2192,10 @@ static int ehea_up(struct net_device *dev)
goto out_clean_pr;
}
 
-   ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
-   if (ret) {
-   ret = -EIO;
-   ehea_error("out_clean_pr");
-   goto out_clean_pr;
-   }
-   mac_addr = (*(u64*)dev->dev_addr) >> 16;
-
ret = ehea_reg_interrupts(dev);
if (ret) {
-   ehea_error("out_dereg_bc");
-   goto out_dereg_bc;
+   ehea_error("reg_interrupts failed. ret:%d", ret);
+   goto out_clean_pr;
}
 
for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
@@ -2226,9 +2221,6 @@ static int ehea_up(struct net_device *dev)
 out_free_irqs:
ehea_free_interrupts(dev);
 
-out_dereg_bc:
-   ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
-
 out_clean_pr:
ehea_clean_all_portres(port);
 out:
@@ -2273,7 +2265,6 @@ static int ehea_down(struct net_device *dev)
&port->port_res[i].d_netdev->state))
msleep(1);
 
-   ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
port->state = EHEA_PORT_DOWN;
 
ret = ehea_clean_all_portres(port);
@@ -2655,12 +2646,18 @@ struct ehea_port *ehea_setup_single_port(struct 
ehea_adapter *adapter,
 
INIT_WORK(&port->reset_task, ehea_reset_port);
 
+   ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
+   if (ret) {
+   ret = -EIO;
+   goto out_unreg_port;
+   }
+
  

ISDN HiSax: uninitialized return in hisax_cs_setup

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9ee0be05dc69b61e5a869bffebd638b31898dae2
Commit: 9ee0be05dc69b61e5a869bffebd638b31898dae2
Parent: 5bae7ac9feba925fd0099057f6b23d7be80b7b41
Author: Florin Malita <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 18:04:46 2007 -0400
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:17:23 2007 -0400

ISDN HiSax: uninitialized return in hisax_cs_setup

Coverity (1792) spotted a possibly uninitialized return value in case of
kmalloc() failure:

1116 static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
1117   struct IsdnCardState *cs)
1119 int ret;
1120
1121 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
1122 printk(KERN_WARNING "HiSax: No memory for isac 
rcvbuf\n");
1123 ll_unload(cs);
1124 goto outf_cs;
...
1165 outf_cs:
1166 kfree(cs);
1167 card->cs = NULL;
1168 return ret;

The straightforward solution would be to just add the missing
initialization but hardcoding the return value in the out_cs branch
(only taken on failure) seems to work just as well and it allows killing
a couple of other lines too.

Signed-off-by: Florin Malita <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/isdn/hisax/config.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 5f7907e..97097ef 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1146,14 +1146,12 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard 
*card,
}
if (ret) {
closecard(cardnr);
-   ret = 0;
goto outf_cs;
}
init_tei(cs, cs->protocol);
ret = CallcNewChan(cs);
if (ret) {
closecard(cardnr);
-   ret = 0;
goto outf_cs;
}
/* ISAR needs firmware download first */
@@ -1165,7 +1163,7 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard 
*card,
 outf_cs:
kfree(cs);
card->cs = NULL;
-   return ret;
+   return 0;
 }
 
 static int checkcard(int cardnr, char *id, int *busy_flag, struct module 
*lockowner)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Blackfin ethernet driver: on chip ethernet MAC controller driver

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e190d6b140079c104ba57e5130a9b4ebea618e92
Commit: e190d6b140079c104ba57e5130a9b4ebea618e92
Parent: 308a90683da9a3e3da1023a88496f76f95c5dcd8
Author: Bryan Wu <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 14:43:44 2007 +0800
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:38:25 2007 -0400

Blackfin ethernet driver: on chip ethernet MAC controller driver

This patch implements the driver necessary use the Analog Devices
Blackfin processor's on-chip ethernet MAC controller.

[try#2]
 - add timeout control
 - kill dma_config_reg bitfields
 - some trivial cleanup

[try#3]
 - add endianess check
 - add DRV_NAME, DRV_VERSION... driver information string
 - add some comments for silicon anomaly and dma API confusion
 - some code trivial cleanup

[try#4]
 - add Blackfin latest GPIO pin mux opertion with Michael Hennerich's
  help and Dan's review
 - rewrite the DMA descriptor list operation in a more readable way
  by Joe's review

[try#5]
 - cleanup some coding style by Joe's review.

[try#6]
 - 1.1 version fix a bug when set up multicast list pointed by Mr. yoshfuji
 - rearrange the desc_list_free function.

Signed-off-by: Michael Hennerich <[EMAIL PROTECTED]>
Signed-off-by: Bryan Wu <[EMAIL PROTECTED]>
Cc: Michael Buesch <[EMAIL PROTECTED]>
Cc: Mike Frysinger <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>
Cc: Dan Williams <[EMAIL PROTECTED]>
Cc: Joe Perches <[EMAIL PROTECTED]>
Cc: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 MAINTAINERS|7 +
 drivers/net/Kconfig|   44 +++
 drivers/net/Makefile   |1 +
 drivers/net/bfin_mac.c | 1009 
 drivers/net/bfin_mac.h |  132 +++
 5 files changed, 1193 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e78f62f..f6b2665 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -732,6 +732,13 @@ L: [EMAIL PROTECTED] (subscribers-only)
 W: http://blackfin.uclinux.org
 S: Supported
 
+BLACKFIN EMAC DRIVER
+P: Bryan Wu
+M: [EMAIL PROTECTED]
+L: [EMAIL PROTECTED] (subscribers-only)
+W: http://blackfin.uclinux.org
+S: Supported
+
 BLACKFIN RTC DRIVER
 P: Mike Frysinger
 M: [EMAIL PROTECTED]
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 5fb659f..3073f67 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -838,6 +838,50 @@ config ULTRA32
  . The module
  will be called smc-ultra32.
 
+config BFIN_MAC
+   tristate "Blackfin 536/537 on-chip mac support"
+   depends on NET_ETHERNET && (BF537 || BF536) && (!BF537_PORT_H)
+   select CRC32
+   select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE
+   help
+ This is the driver for blackfin on-chip mac device. Say Y if you want 
it
+ compiled into the kernel. This driver is also available as a module
+ ( = code which can be inserted in and removed from the running kernel
+ whenever you want). The module will be called bfin_mac.
+
+config BFIN_MAC_USE_L1
+   bool "Use L1 memory for rx/tx packets"
+   depends on BFIN_MAC && BF537
+   default y
+   help
+ To get maximum network performace, you should use L1 memory as rx/tx 
buffers.
+ Say N here if you want to reserve L1 memory for other uses.
+
+config BFIN_TX_DESC_NUM
+   int "Number of transmit buffer packets"
+   depends on BFIN_MAC
+   range 6 10 if BFIN_MAC_USE_L1
+   range 10 100
+   default "10"
+   help
+ Set the number of buffer packets used in driver.
+
+config BFIN_RX_DESC_NUM
+   int "Number of receive buffer packets"
+   depends on BFIN_MAC
+   range 20 100 if BFIN_MAC_USE_L1
+   range 20 800
+   default "20"
+   help
+ Set the number of buffer packets used in driver.
+
+config BFIN_MAC_RMII
+   bool "RMII PHY Interface (EXPERIMENTAL)"
+   depends on BFIN_MAC && EXPERIMENTAL
+   default n
+   help
+ Use Reduced PHY MII Interface
+
 config SMC9194
tristate "SMC 9194 support"
depends on NET_VENDOR_SMC && (ISA || MAC && BROKEN)
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 0e286ab..0a0 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -200,6 +200,7 @@ obj-$(CONFIG_S2IO) += s2io.o
 obj-$(CONFIG_MYRI10GE) += myri10ge/
 obj-$(CONFIG_SMC91X) += smc91x.o
 obj-$(CONFIG_SMC911X) += smc911x.o
+obj-$(CONFIG_BFIN_MAC) += bfin_mac.o
 obj-$(CONFIG_DM9000) += dm9000.o
 obj-$(CONFIG_FEC_8XX) += fec_8xx/
 obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
new 

fix wrong argument of tc35815_read_plat_dev_addr()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=308a90683da9a3e3da1023a88496f76f95c5dcd8
Commit: 308a90683da9a3e3da1023a88496f76f95c5dcd8
Parent: 5e1751f8396544df3b334afd2e67557757d47fb0
Author: Yoichi Yuasa <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 11:13:42 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:38:25 2007 -0400

fix wrong argument of tc35815_read_plat_dev_addr()

Fix wrong argument of tc35815_read_plat_dev_addr()

Signed-off-by: Yoichi Yuasa <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/tc35815.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 75655ad..7f94ca9 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -626,7 +626,7 @@ static int __devinit tc35815_read_plat_dev_addr(struct 
net_device *dev)
return -ENODEV;
 }
 #else
-static int __devinit tc35815_read_plat_dev_addr(struct device *dev)
+static int __devinit tc35815_read_plat_dev_addr(struct net_device *dev)
 {
return -ENODEV;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] zd1211rw: Add ID for Siemens Gigaset USB Stick 54

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=25343469e77bd6f5694bb6b641a8ea1bd2173782
Commit: 25343469e77bd6f5694bb6b641a8ea1bd2173782
Parent: 6eb07250626c1b51801c2ef9210dc2f321112018
Author: Daniel Drake <[EMAIL PROTECTED]>
AuthorDate: Sat Jul 14 01:40:54 2007 +0100
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:18 2007 -0400

[PATCH] zd1211rw: Add ID for Siemens Gigaset USB Stick 54

Tested by David Santinoli
zd1211b chip 129b:1667 v4810 high 00-01-e3 AL2230S_RF pa0 ---N-

Signed-off-by: Daniel Drake <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/zd1211rw/zd_usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c 
b/drivers/net/wireless/zd1211rw/zd_usb.c
index 12115e6..a9c339e 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -73,6 +73,7 @@ static struct usb_device_id usb_ids[] = {
{ USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B },
+   { USB_DEVICE(0x129b, 0x1667), .driver_info = DEVICE_ZD1211B },
/* "Driverless" devices that need ejecting */
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
{ USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] zd1211rw: Add ID for Planex GW-US54GXS

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6eb07250626c1b51801c2ef9210dc2f321112018
Commit: 6eb07250626c1b51801c2ef9210dc2f321112018
Parent: ee2c4add43a3977ccb0263bdb460ed63a1b03c02
Author: Masakazu Mokuno <[EMAIL PROTECTED]>
AuthorDate: Sat Jul 14 01:40:11 2007 +0100
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:18 2007 -0400

[PATCH] zd1211rw: Add ID for Planex GW-US54GXS

This patch adds the ID for Planex GW-US54GXS USB wireless adapter sold in
Japan.
Since this device returns the regulatory region as 0x49,
the patch 'Allow channels 1-11 for unrecognised regulatory domains' is
required.

Tested by Masakazu Mokuno
zd1211b chip 2019:5303 v4810 high 00-90-cc AL2230_RF pa0 ---N-

Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]>
Signed-off-by: Daniel Drake <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/zd1211rw/zd_usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c 
b/drivers/net/wireless/zd1211rw/zd_usb.c
index 28d41a2..12115e6 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -72,6 +72,7 @@ static struct usb_device_id usb_ids[] = {
{ USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B },
+   { USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B },
/* "Driverless" devices that need ejecting */
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
{ USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Update version ipw2200 stamp to 1.2.2

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ee2c4add43a3977ccb0263bdb460ed63a1b03c02
Commit: ee2c4add43a3977ccb0263bdb460ed63a1b03c02
Parent: d00d012134864ed48a4f21898c043c262a0c1a31
Author: Zhu Yi <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 16:09:47 2007 +0800
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:18 2007 -0400

[PATCH] Update version ipw2200 stamp to 1.2.2

Signed-off-by: Zhu Yi <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/ipw2200.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index dac5e12..61497c4 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -70,7 +70,7 @@
 #define VQ
 #endif
 
-#define IPW2200_VERSION "1.2.0" VK VD VM VP VR VQ
+#define IPW2200_VERSION "1.2.2" VK VD VM VP VR VQ
 #define DRV_DESCRIPTION"Intel(R) PRO/Wireless 2200/2915 Network Driver"
 #define DRV_COPYRIGHT  "Copyright(c) 2003-2006 Intel Corporation"
 #define DRV_VERSION IPW2200_VERSION
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ipw2200: Fix ipw_isr() comments error on shared IRQ

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d00d012134864ed48a4f21898c043c262a0c1a31
Commit: d00d012134864ed48a4f21898c043c262a0c1a31
Parent: 4e157f08a01f6395a43d10630fb3a629d90a02bc
Author: Zhu Yi <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 16:09:40 2007 +0800
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:17 2007 -0400

[PATCH] ipw2200: Fix ipw_isr() comments error on shared IRQ

Signed-off-by: Tom De Man <[EMAIL PROTECTED]>
Signed-off-by: Zhu Yi <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/ipw2200.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 4b5ec36..dac5e12 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -10553,7 +10553,7 @@ static irqreturn_t ipw_isr(int irq, void *data)
spin_lock(&priv->irq_lock);
 
if (!(priv->status & STATUS_INT_ENABLED)) {
-   /* Shared IRQ */
+   /* IRQ is disabled */
goto none;
}
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Fix ipw2200 set wrong power parameter causing firmware error

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e157f08a01f6395a43d10630fb3a629d90a02bc
Commit: 4e157f08a01f6395a43d10630fb3a629d90a02bc
Parent: 9f3b2416fec56de34408eafbef19bf8ec9a81493
Author: Zhu Yi <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 16:09:32 2007 +0800
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:17 2007 -0400

[PATCH] Fix ipw2200 set wrong power parameter causing firmware error

The power mode can only be set 0~5 to firmware. Otherwise there will be a
firmware error generated. This patch fixed the invalid power mode requested
by driver.

Signed-off-by: Zhu Yi <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/ipw2200.c |   14 ++
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index aa32a97..4b5ec36 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -2506,7 +2506,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 
mode)
break;
}
 
-   param = cpu_to_le32(mode);
+   param = cpu_to_le32(param);
return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
¶m);
 }
@@ -9568,6 +9568,7 @@ static int ipw_wx_set_power(struct net_device *dev,
priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY;
else
priv->power_mode = IPW_POWER_ENABLED | priv->power_mode;
+
err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
if (err) {
IPW_DEBUG_WX("failed setting power mode.\n");
@@ -9604,22 +9605,19 @@ static int ipw_wx_set_powermode(struct net_device *dev,
struct ipw_priv *priv = ieee80211_priv(dev);
int mode = *(int *)extra;
int err;
+
mutex_lock(&priv->mutex);
-   if ((mode < 1) || (mode > IPW_POWER_LIMIT)) {
+   if ((mode < 1) || (mode > IPW_POWER_LIMIT))
mode = IPW_POWER_AC;
-   priv->power_mode = mode;
-   } else {
-   priv->power_mode = IPW_POWER_ENABLED | mode;
-   }
 
-   if (priv->power_mode != mode) {
+   if (IPW_POWER_LEVEL(priv->power_mode) != mode) {
err = ipw_send_power_mode(priv, mode);
-
if (err) {
IPW_DEBUG_WX("failed setting power mode.\n");
mutex_unlock(&priv->mutex);
return err;
}
+   priv->power_mode = IPW_POWER_ENABLED | mode;
}
mutex_unlock(&priv->mutex);
return 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ipw2100: Fix `iwpriv set_power` error

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9f3b2416fec56de34408eafbef19bf8ec9a81493
Commit: 9f3b2416fec56de34408eafbef19bf8ec9a81493
Parent: 90869b249b4621d60920d5d1d53403fe86d8ecb5
Author: Zhu Yi <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 16:09:24 2007 +0800
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:17 2007 -0400

[PATCH] ipw2100: Fix `iwpriv set_power` error

iwpriv  set_power [0~6] can be used for ipw2100. '0' indicates
off and '6' indicates auto. 1~5 are the actual power levels.

Signed-off-by: Zhu Yi <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/ipw2100.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 072ede7..8990585 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -7868,10 +7868,10 @@ static int ipw2100_wx_set_powermode(struct net_device 
*dev,
goto done;
}
 
-   if ((mode < 1) || (mode > POWER_MODES))
+   if ((mode < 0) || (mode > POWER_MODES))
mode = IPW_POWER_AUTO;
 
-   if (priv->power_mode != mode)
+   if (IPW_POWER_LEVEL(priv->power_mode) != mode)
err = ipw2100_set_power_mode(priv, mode);
   done:
mutex_unlock(&priv->action_mutex);
@@ -7902,7 +7902,7 @@ static int ipw2100_wx_get_powermode(struct net_device 
*dev,
break;
case IPW_POWER_AUTO:
snprintf(extra, MAX_POWER_STRING,
-"Power save level: %d (Auto)", 0);
+"Power save level: %d (Auto)", level);
break;
default:
timeout = timeout_duration[level - 1] / 1000;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ARM/ETHER3: Handle multicast frames.

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dbf812d6ae6da1bfd01ea6abc5af60b358e4f9ba
Commit: dbf812d6ae6da1bfd01ea6abc5af60b358e4f9ba
Parent: 82a0244df8165b0345cde5258afe176c12dd1e99
Author: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 13:45:43 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:38 2007 -0400

ARM/ETHER3: Handle multicast frames.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/arm/ether3.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index da71350..a7cac69 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -464,7 +464,7 @@ static void ether3_setmulticastlist(struct net_device *dev)
if (dev->flags & IFF_PROMISC) {
/* promiscuous mode */
priv(dev)->regs.config1 |= CFG1_RECVPROMISC;
-   } else if (dev->flags & IFF_ALLMULTI) {
+   } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) {
priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI;
} else
priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] softmac: Channel is listed twice in scan output

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=90869b249b4621d60920d5d1d53403fe86d8ecb5
Commit: 90869b249b4621d60920d5d1d53403fe86d8ecb5
Parent: 4ad1366376bfef32ec0ffa12d1faa483d6f330bd
Author: Jean Tourrilhes <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 10 15:51:14 2007 -0500
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 21:56:17 2007 -0400

[PATCH] softmac: Channel is listed twice in scan output

SoftMAC outputs the channel twice in the scan output. It should
display frequency and channel, but only once for each.

Signed-off-by: Jean Tourrilhes <[EMAIL PROTECTED]>
Signed-off-by: Larry Finger <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 net/ieee80211/ieee80211_wx.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 523a137..465b73d 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -90,14 +90,11 @@ static char *ieee80211_translate_scan(struct 
ieee80211_device *ieee,
}
 
/* Add channel and frequency */
+   /* Note : userspace automatically computes channel using iwrange */
iwe.cmd = SIOCGIWFREQ;
-   iwe.u.freq.m = network->channel;
-   iwe.u.freq.e = 0;
-   iwe.u.freq.i = 0;
-   start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
-
iwe.u.freq.m = ieee80211_channel_to_freq(ieee, network->channel);
iwe.u.freq.e = 6;
+   iwe.u.freq.i = 0;
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
 
/* Add encryption capability */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


SAA9730: Handle multicast frames.

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=82a0244df8165b0345cde5258afe176c12dd1e99
Commit: 82a0244df8165b0345cde5258afe176c12dd1e99
Parent: b947dd4b62a6adfd78292319a9d2e6396c1fb064
Author: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 13:46:00 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:38 2007 -0400

SAA9730: Handle multicast frames.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/saa9730.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c
index 451486b..7dae4d4 100644
--- a/drivers/net/saa9730.c
+++ b/drivers/net/saa9730.c
@@ -940,15 +940,14 @@ static void lan_saa9730_set_multicast(struct net_device 
*dev)
   CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC,
   &lp->lan_saa9730_regs->CamCtl);
} else {
-   if (dev->flags & IFF_ALLMULTI) {
+   if (dev->flags & IFF_ALLMULTI || dev->mc_count) {
/* accept all multicast packets */
-   writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
-  CAM_CONTROL_BROAD_ACC,
-  &lp->lan_saa9730_regs->CamCtl);
-   } else {
/*
 * Will handle the multicast stuff later. -carstenl
 */
+   writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
+  CAM_CONTROL_BROAD_ACC,
+  &lp->lan_saa9730_regs->CamCtl);
}
}
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


NI5010: Handle multicast frames.

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b947dd4b62a6adfd78292319a9d2e6396c1fb064
Commit: b947dd4b62a6adfd78292319a9d2e6396c1fb064
Parent: e78af36623b8eeead1c8590b43616eab159526fa
Author: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 13:45:50 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:38 2007 -0400

NI5010: Handle multicast frames.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/ni5010.c |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index 3d5b423..22a3b3d 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -670,14 +670,10 @@ static void ni5010_set_multicast_list(struct net_device 
*dev)
 
PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name));
 
-   if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI) {
+   if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI || dev->mc_list) {
dev->flags |= IFF_PROMISC;
outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */
PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", 
dev->name));
-   } else if (dev->mc_list) {
-   /* Sorry, multicast not supported */
-   PRINTK((KERN_DEBUG "%s: No multicast, entering broadcast 
mode\n", dev->name));
-   outb(RMD_BROADCAST, EDLC_RMODE);
} else {
PRINTK((KERN_DEBUG "%s: Entering broadcast mode\n", dev->name));
outb(RMD_BROADCAST, EDLC_RMODE);  /* Disable promiscuous mode, 
use normal mode */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


NS83820: Handle multicast frames.

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e78af36623b8eeead1c8590b43616eab159526fa
Commit: e78af36623b8eeead1c8590b43616eab159526fa
Parent: 7132ab7f6e0309bb8e0424e395ba149aee0c750e
Author: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 13:45:54 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:37 2007 -0400

NS83820: Handle multicast frames.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/ns83820.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 104aab3..ea80e6c 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1582,7 +1582,7 @@ static void ns83820_set_multicast(struct net_device *ndev)
else
and_mask &= ~(RFCR_AAU | RFCR_AAM);
 
-   if (ndev->flags & IFF_ALLMULTI)
+   if (ndev->flags & IFF_ALLMULTI || ndev->mc_count)
or_mask |= RFCR_AAM;
else
and_mask &= ~RFCR_AAM;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fix RGMII-ID handling in gianfar

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7132ab7f6e0309bb8e0424e395ba149aee0c750e
Commit: 7132ab7f6e0309bb8e0424e395ba149aee0c750e
Parent: af2d940df2b60b15c271033d381c2f3ead655562
Author: Andy Fleming <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 11 11:43:07 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:37 2007 -0400

Fix RGMII-ID handling in gianfar

The TSEC/eTSEC can detect the interface to the PHY automatically,
but it isn't able to detect whether the RGMII connection needs internal
delay.  So we need to detect that change in the device tree, propagate
it to the platform data, and then check it if we're in RGMII.  This fixes
a bug on the 8641D HPCN board where the Vitesse PHY doesn't use the delay
for RGMII.

Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/fsl_soc.c |9 +
 drivers/net/gianfar.c |   12 +++-
 include/linux/fsl_devices.h   |1 +
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index c0ddc80..3289fab 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -197,6 +197,7 @@ static int __init gfar_of_init(void)
struct gianfar_platform_data gfar_data;
const unsigned int *id;
const char *model;
+   const char *ctype;
const void *mac_addr;
const phandle *ph;
int n_res = 2;
@@ -254,6 +255,14 @@ static int __init gfar_of_init(void)
FSL_GIANFAR_DEV_HAS_VLAN |
FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
 
+   ctype = of_get_property(np, "phy-connection-type", NULL);
+
+   /* We only care about rgmii-id.  The rest are autodetected */
+   if (ctype && !strcmp(ctype, "rgmii-id"))
+   gfar_data.interface = PHY_INTERFACE_MODE_RGMII_ID;
+   else
+   gfar_data.interface = PHY_INTERFACE_MODE_MII;
+
ph = of_get_property(np, "phy-handle", NULL);
phy = of_find_node_by_phandle(*ph);
 
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index d7a1a58..f926905 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -420,8 +420,18 @@ static phy_interface_t gfar_get_interface(struct 
net_device *dev)
if (ecntrl & ECNTRL_REDUCED_MODE) {
if (ecntrl & ECNTRL_REDUCED_MII_MODE)
return PHY_INTERFACE_MODE_RMII;
-   else
+   else {
+   phy_interface_t interface = priv->einfo->interface;
+
+   /*
+* This isn't autodetected right now, so it must
+* be set by the device tree or platform code.
+*/
+   if (interface == PHY_INTERFACE_MODE_RGMII_ID)
+   return PHY_INTERFACE_MODE_RGMII_ID;
+
return PHY_INTERFACE_MODE_RGMII;
+   }
}
 
if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT)
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 695741b..1831b19 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -53,6 +53,7 @@ struct gianfar_platform_data {
u32 bus_id;
u32 phy_id;
u8  mac_addr[6];
+   phy_interface_t interface;
 };
 
 struct gianfar_mdio_data {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fix Vitesse RGMII-ID support

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=af2d940df2b60b15c271033d381c2f3ead655562
Commit: af2d940df2b60b15c271033d381c2f3ead655562
Parent: cc65185d400c4e8698ff1c1b59f90bd491e9bda5
Author: Andy Fleming <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 11 11:42:35 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:37 2007 -0400

Fix Vitesse RGMII-ID support

The Vitesse PHY on the 8641D needs to be set up with internal delay to
work in RGMII mode.  So we add skew when it is set to RGMII_ID mode.

Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
Signed-off-by: Haruki Dai <[EMAIL PROTECTED]>
Signed-off-by: Haiying Wang <[EMAIL PROTECTED]>
---
 drivers/net/phy/vitesse.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index f39ab76..6a53856 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -21,6 +21,10 @@
 /* Vitesse Extended Control Register 1 */
 #define MII_VSC8244_EXT_CON1   0x17
 #define MII_VSC8244_EXTCON1_INIT   0x
+#define MII_VSC8244_EXTCON1_TX_SKEW_MASK   0x0c00
+#define MII_VSC8244_EXTCON1_RX_SKEW_MASK   0x0300
+#define MII_VSC8244_EXTCON1_TX_SKEW0x0800
+#define MII_VSC8244_EXTCON1_RX_SKEW0x0200
 
 /* Vitesse Interrupt Mask Register */
 #define MII_VSC8244_IMASK  0x19
@@ -39,7 +43,7 @@
 
 /* Vitesse Auxiliary Control/Status Register */
 #define MII_VSC8244_AUX_CONSTAT0x1c
-#define MII_VSC8244_AUXCONSTAT_INIT0x0004
+#define MII_VSC8244_AUXCONSTAT_INIT0x
 #define MII_VSC8244_AUXCONSTAT_DUPLEX  0x0020
 #define MII_VSC8244_AUXCONSTAT_SPEED   0x0018
 #define MII_VSC8244_AUXCONSTAT_GBIT0x0010
@@ -51,6 +55,7 @@ MODULE_LICENSE("GPL");
 
 static int vsc824x_config_init(struct phy_device *phydev)
 {
+   int extcon;
int err;
 
err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
@@ -58,8 +63,20 @@ static int vsc824x_config_init(struct phy_device *phydev)
if (err < 0)
return err;
 
-   err = phy_write(phydev, MII_VSC8244_EXT_CON1,
-   MII_VSC8244_EXTCON1_INIT);
+   extcon = phy_read(phydev, MII_VSC8244_EXT_CON1);
+
+   if (extcon < 0)
+   return err;
+
+   extcon &= ~(MII_VSC8244_EXTCON1_TX_SKEW_MASK |
+   MII_VSC8244_EXTCON1_RX_SKEW_MASK);
+
+   if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+   extcon |= (MII_VSC8244_EXTCON1_TX_SKEW |
+   MII_VSC8244_EXTCON1_RX_SKEW);
+
+   err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon);
+
return err;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fix Vitesse 824x PHY interrupt acking

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1d5e83aac54b64b71b225fd5cf2e82491ad145f6
Commit: 1d5e83aac54b64b71b225fd5cf2e82491ad145f6
Parent: 5bae7ac9feba925fd0099057f6b23d7be80b7b41
Author: Andy Fleming <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 10 16:42:04 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:37 2007 -0400

Fix Vitesse 824x PHY interrupt acking

The Vitesse 824x PHY doesn't allow an interrupt to be cleared if
the mask bit for that interrupt isn't set.  This means that the PHY
Lib's order of handling interrupts (disable, then clear) breaks on this
PHY.  However, clearing then disabling the interrupt opens up the code
for a silly race condition.  So rather than change the PHY Lib, we change
the Vitesse driver so it always clears interrupts before disabling them.
Further, the ack function only clears the interrupt if interrupts are
enabled.

Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
Signed-off-by: York Sun <[EMAIL PROTECTED]>
Acked-by: Haiying Wang <[EMAIL PROTECTED]>
---
 drivers/net/phy/vitesse.c |   23 +--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 596222b..f39ab76 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -65,7 +65,15 @@ static int vsc824x_config_init(struct phy_device *phydev)
 
 static int vsc824x_ack_interrupt(struct phy_device *phydev)
 {
-   int err = phy_read(phydev, MII_VSC8244_ISTAT);
+   int err = 0;
+   
+   /*
+* Don't bother to ACK the interrupts if interrupts
+* are disabled.  The 824x cannot clear the interrupts
+* if they are disabled.
+*/
+   if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+   err = phy_read(phydev, MII_VSC8244_ISTAT);
 
return (err < 0) ? err : 0;
 }
@@ -77,8 +85,19 @@ static int vsc824x_config_intr(struct phy_device *phydev)
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
err = phy_write(phydev, MII_VSC8244_IMASK,
MII_VSC8244_IMASK_MASK);
-   else
+   else {
+   /*
+* The Vitesse PHY cannot clear the interrupt
+* once it has disabled them, so we clear them first
+*/
+   err = phy_read(phydev, MII_VSC8244_ISTAT);
+
+   if (err)
+   return err;
+
err = phy_write(phydev, MII_VSC8244_IMASK, 0);
+   }
+
return err;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Add phy-connection-type to gianfar nodes

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cc65185d400c4e8698ff1c1b59f90bd491e9bda5
Commit: cc65185d400c4e8698ff1c1b59f90bd491e9bda5
Parent: 1d5e83aac54b64b71b225fd5cf2e82491ad145f6
Author: Andy Fleming <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 10 17:28:49 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:37 2007 -0400

Add phy-connection-type to gianfar nodes

The TSEC/eTSEC automatically detect their PHY interface type, unless
the type is RGMII-ID (RGMII with internal delay).  In that situation,
it just detects RGMII.  In order to fix this, we need to pass in rgmii-id
if that is the connection type.

Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |6 ++
 arch/powerpc/boot/dts/mpc8641_hpcn.dts   |4 
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 0c24348..76733a3 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1250,6 +1250,12 @@ platforms are moved over to use the 
flattened-device-tree model.
   network device.  This is used by the bootwrapper to interpret
   MAC addresses passed by the firmware when no information other
   than indices is available to associate an address with a device.
+- phy-connection-type : a string naming the controller/PHY interface type,
+  i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii",
+  "tbi", or "rtbi".  This property is only really needed if the connection
+  is of type "rgmii-id", as all other connection types are detected by
+  hardware.
+
 
   Example:
 
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts 
b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index db56a02..6a78a2b 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -131,6 +131,7 @@
interrupts = <1d 2 1e 2 22 2>;
interrupt-parent = <&mpic>;
phy-handle = <&phy0>;
+   phy-connection-type = "rgmii-id";
};
 
[EMAIL PROTECTED] {
@@ -150,6 +151,7 @@
interrupts = <23 2 24 2 28 2>;
interrupt-parent = <&mpic>;
phy-handle = <&phy1>;
+   phy-connection-type = "rgmii-id";
};

[EMAIL PROTECTED] {
@@ -169,6 +171,7 @@
interrupts = <1F 2 20 2 21 2>;
interrupt-parent = <&mpic>;
phy-handle = <&phy2>;
+   phy-connection-type = "rgmii-id";
};
 
[EMAIL PROTECTED] {
@@ -188,6 +191,7 @@
interrupts = <25 2 26 2 27 2>;
interrupt-parent = <&mpic>;
phy-handle = <&phy3>;
+   phy-connection-type = "rgmii-id";
};
[EMAIL PROTECTED] {
device_type = "serial";
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] Allow disabling CIFS Unix Extensions as mount option

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c18c842b1fdf527717303a4e173cbece7ab2deb8
Commit: c18c842b1fdf527717303a4e173cbece7ab2deb8
Parent: 63135e088a604b955746c51964c195c8d3ebac11
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 23:21:09 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 23:21:09 2007 +

[CIFS] Allow disabling CIFS Unix Extensions as mount option

Previously the only way to do this was to umount all mounts to that server,
turn off a proc setting (/proc/fs/cifs/LinuxExtensionsEnabled).

Fixes Samba bugzilla bug number: 4582 (and also 2008)

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifsfs.c   |4 ++--
 fs/cifs/cifsglob.h |4 +++-
 fs/cifs/cifssmb.c  |   21 ++---
 fs/cifs/connect.c  |   31 ---
 fs/cifs/dir.c  |   11 +--
 fs/cifs/file.c |6 +++---
 fs/cifs/inode.c|   13 +++--
 fs/cifs/link.c |   17 -
 fs/cifs/readdir.c  |4 +++-
 9 files changed, 65 insertions(+), 46 deletions(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index a0a2f31..1cebb7e 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -316,10 +316,10 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
seq_printf(s, ",posixpaths");
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) ||
-  !(cifs_sb->tcon->ses->capabilities & CAP_UNIX))
+  !(cifs_sb->tcon->unix_ext))
seq_printf(s, ",uid=%d", cifs_sb->mnt_uid);
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) ||
-  !(cifs_sb->tcon->ses->capabilities & CAP_UNIX))
+  !(cifs_sb->tcon->unix_ext))
seq_printf(s, ",gid=%d", cifs_sb->mnt_gid);
seq_printf(s, ",rsize=%d", cifs_sb->rsize);
seq_printf(s, ",wsize=%d", cifs_sb->wsize);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 0a78131..b98742f 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -281,7 +281,9 @@ struct cifsTconInfo {
FILE_SYSTEM_UNIX_INFO fsUnixInfo;
unsigned retry:1;
unsigned nocase:1;
-   /* BB add field for back pointer to sb struct? */
+   unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol
+   for this mount even if server would support */
+   /* BB add field for back pointer to sb struct(s)? */
 };
 
 /*
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a6ff406..8eb102f 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -132,10 +132,10 @@ small_smb_init(int smb_command, int wct, struct 
cifsTconInfo *tcon,
/* Give Demultiplex thread up to 10 seconds to
   reconnect, should be greater than cifs socket
   timeout which is 7 seconds */
-   while(tcon->ses->server->tcpStatus ==
+   while (tcon->ses->server->tcpStatus ==
 CifsNeedReconnect) {

wait_event_interruptible_timeout(tcon->ses->server->response_q,
-   (tcon->ses->server->tcpStatus == 
+   (tcon->ses->server->tcpStatus ==
CifsGood), 10 * HZ);
if (tcon->ses->server->tcpStatus ==
CifsNeedReconnect) {
@@ -213,7 +213,7 @@ small_smb_init(int smb_command, int wct, struct 
cifsTconInfo *tcon,
}
 
header_assemble((struct smb_hdr *) *request_buf, smb_command,
-   tcon,wct);
+   tcon, wct);
 
if (tcon != NULL)
cifs_stats_inc(&tcon->num_smbs_sent);
@@ -387,7 +387,7 @@ static int validate_t2(struct smb_t2_rsp *pSMB)
/* check that bcc is less than negotiated smb buffer */
total_size = le16_to_cpu(pSMB->t2_rsp.ParameterCount);
if (total_size < 512) {
-   total_size += 
+   total_size +=
le16_to_cpu(pSMB->t2_rsp.DataCount);
/* BCC le converted in SendReceive */
pBCC = (pSMB->hdr.WordCount * 2) +
@@ -2758,7 +2758,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const 
char *pACL,
return 0;
 
count = posix_acl_xattr_count((size_t)buflen);
-   cFYI(1,("setting acl with %d entries from buf of length %d and "
+   cFYI(1, ("setting acl with %d entrie

[CIFS] merge conflict in fs/cifs/export.c

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=70b315b0dd3879cb3ab8aadffb14f10b2d19b9c3
Commit: 70b315b0dd3879cb3ab8aadffb14f10b2d19b9c3
Parent: c18c842b1fdf527717303a4e173cbece7ab2deb8
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 19 00:32:25 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Thu Jul 19 00:32:25 2007 +

[CIFS] merge conflict in fs/cifs/export.c

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/export.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/export.c b/fs/cifs/export.c
index 1570cc6..c21d3d0 100644
--- a/fs/cifs/export.c
+++ b/fs/cifs/export.c
@@ -40,6 +40,7 @@
   */
 
 #include 
+#include 
 #include "cifsglob.h"
 #include "cifs_debug.h"
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] More whitespace/formatting fixes (noticed by checkpatch)

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=63135e088a604b955746c51964c195c8d3ebac11
Commit: 63135e088a604b955746c51964c195c8d3ebac11
Parent: 7e42ca886b0282679c2721dc4853163cc89b8a34
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 17:34:02 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 17:34:02 2007 +

[CIFS] More whitespace/formatting fixes (noticed by checkpatch)

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifsencrypt.c |3 ++-
 fs/cifs/cifsfs.c  |   20 +---
 fs/cifs/cifssmb.c |   33 ++---
 fs/cifs/connect.c |   43 ---
 fs/cifs/file.c|5 +++--
 fs/cifs/link.c|3 ++-
 fs/cifs/misc.c|   15 ++-
 fs/cifs/netmisc.c |6 --
 fs/cifs/sess.c|3 ++-
 fs/cifs/xattr.c   |3 ++-
 10 files changed, 88 insertions(+), 46 deletions(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index be012a1..3627229 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -109,7 +109,8 @@ static int cifs_calc_signature2(const struct kvec *iov, int 
n_vec,
if (i == 0) {
if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */
break; /* nothing to sign or corrupt header */
-   MD5Update(&context,iov[0].iov_base+4, iov[0].iov_len-4);
+   MD5Update(&context, iov[0].iov_base+4,
+ iov[0].iov_len-4);
} else
MD5Update(&context, iov[i].iov_base, iov[i].iov_len);
}
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 8ebd887..a0a2f31 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -71,16 +71,20 @@ static struct task_struct *dnotifyThread = NULL;
 static const struct super_operations cifs_super_ops;
 unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
 module_param(CIFSMaxBufSize, int, 0);
-MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). 
Default: 16384 Range: 8192 to 130048");
+MODULE_PARM_DESC(CIFSMaxBufSize, "Network buffer size (not including header). "
+"Default: 16384 Range: 8192 to 130048");
 unsigned int cifs_min_rcv = CIFS_MIN_RCV_POOL;
 module_param(cifs_min_rcv, int, 0);
-MODULE_PARM_DESC(cifs_min_rcv,"Network buffers in pool. Default: 4 Range: 1 to 
64");
+MODULE_PARM_DESC(cifs_min_rcv, "Network buffers in pool. Default: 4 Range: "
+   "1 to 64");
 unsigned int cifs_min_small = 30;
 module_param(cifs_min_small, int, 0);
-MODULE_PARM_DESC(cifs_min_small,"Small network buffers in pool. Default: 30 
Range: 2 to 256");
+MODULE_PARM_DESC(cifs_min_small, "Small network buffers in pool. Default: 30 "
+"Range: 2 to 256");
 unsigned int cifs_max_pending = CIFS_MAX_REQ;
 module_param(cifs_max_pending, int, 0);
-MODULE_PARM_DESC(cifs_max_pending,"Simultaneous requests to server. Default: 
50 Range: 2 to 256");
+MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. "
+  "Default: 50 Range: 2 to 256");
 
 extern mempool_t *cifs_sm_req_poolp;
 extern mempool_t *cifs_req_poolp;
@@ -902,7 +906,8 @@ static int cifs_oplock_thread(void *dummyarg)
0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE,
0 /* wait flag */);
-   cFYI(1,("Oplock release rc = %d ", rc));
+   cFYI(1, 
+ ("Oplock release rc = %d ", rc));
}
} else
spin_unlock(&GlobalMid_Lock);
@@ -1040,7 +1045,7 @@ init_cifs(void)
 static void __exit
 exit_cifs(void)
 {
-   cFYI(0, ("In unregister ie exit_cifs"));
+   cFYI(0, ("exit_cifs"));
 #ifdef CONFIG_PROC_FS
cifs_proc_clean();
 #endif
@@ -1055,7 +1060,8 @@ exit_cifs(void)
 MODULE_AUTHOR("Steve French <[EMAIL PROTECTED]>");
 MODULE_LICENSE("GPL"); /* combination of LGPL + GPL source behaves as GPL */
 MODULE_DESCRIPTION
-("VFS to access servers complying with the SNIA CIFS Specification e.g. 
Samba and Windows");
+("VFS to access servers complying with the SNIA CIFS Specification "
+ "e.g. Samba and Windows");
 MODULE_VERSION(CIFS_VERSION);
 module_init(init_cifs)
 module_exit(exit_cifs)
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index b339f5f..a6ff406 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -132,10 +132,13 @@ small_smb_init(int smb_command, int wct, struct 
cifsTconInfo *tcon,
/* Give Demultiplex thread up to 10 seconds to
   

[CIFS] Typo in previous patch

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7e42ca886b0282679c2721dc4853163cc89b8a34
Commit: 7e42ca886b0282679c2721dc4853163cc89b8a34
Parent: 6fa20d4fb58cb342638bc14658083aadcad8fb74
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 16 17:40:02 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 17:40:02 2007 +

[CIFS] Typo in previous patch

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/inode.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 9ae901e..3482879 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1346,14 +1346,13 @@ static int cifs_truncate_page(struct address_space 
*mapping, loff_t from)
pgoff_t index = from >> PAGE_CACHE_SHIFT;
unsigned offset = from & (PAGE_CACHE_SIZE - 1);
struct page *page;
-   char *kaddr;
int rc = 0;
 
page = grab_cache_page(mapping, index);
if (!page)
return -ENOMEM;
 
-   zero_user_page(page, offset, PAGE_CACHE_SIZE - offset), KM_USER0);
+   zero_user_page(page, offset, PAGE_CACHE_SIZE - offset, KM_USER0);
unlock_page(page);
page_cache_release(page);
return rc;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] zero_user_page() conversions

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6fa20d4fb58cb342638bc14658083aadcad8fb74
Commit: 6fa20d4fb58cb342638bc14658083aadcad8fb74
Parent: 8803863a9051582081fb2bcca3a6dc8fddaed93c
Author: Eric <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 16 16:23:19 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 16:23:19 2007 +

[CIFS] zero_user_page() conversions

Signed-off-by: Eric Sandeen <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/inode.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index cfa5b36..9ae901e 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1353,10 +1353,7 @@ static int cifs_truncate_page(struct address_space 
*mapping, loff_t from)
if (!page)
return -ENOMEM;
 
-   kaddr = kmap_atomic(page, KM_USER0);
-   memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
-   flush_dcache_page(page);
-   kunmap_atomic(kaddr, KM_USER0);
+   zero_user_page(page, offset, PAGE_CACHE_SIZE - offset), KM_USER0);
unlock_page(page);
page_cache_release(page);
return rc;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] Fix build break - inet.h not included when experimental ifdef off

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4a379e6657ae2dd910f9f06d46bd7c05fbe9ed5c
Commit: 4a379e6657ae2dd910f9f06d46bd7c05fbe9ed5c
Parent: 2d785a50a8aa404c19f56d2c22445e48e418112b
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 21:58:28 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Sun Jul 15 21:58:28 2007 +

[CIFS] Fix build break - inet.h not included when experimental ifdef off

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/netmisc.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index ef9c981..fe3d910 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -29,9 +29,7 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_CIFS_EXPERIMENTAL
 #include 
-#endif
 #include "cifsfs.h"
 #include "cifspdu.h"
 #include "cifsglob.h"
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] use simple_prepare_write to zero page data

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8803863a9051582081fb2bcca3a6dc8fddaed93c
Commit: 8803863a9051582081fb2bcca3a6dc8fddaed93c
Parent: 4a379e6657ae2dd910f9f06d46bd7c05fbe9ed5c
Author: Nate <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 16 15:45:13 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 15:45:13 2007 +

[CIFS] use simple_prepare_write to zero page data

It's common for file systems to need to zero data on either side of a
write, if a page is not Uptodate during prepare_write.  It just so happens
that simple_prepare_write() in libfs.c does exactly that, so we can avoid
duplication and just call that function to zero page data.

Signed-off-by: Nate Diller <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/file.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index b67f1da..0620fea 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1966,14 +1966,7 @@ static int cifs_prepare_write(struct file *file, struct 
page *page,
 * We don't need to read data beyond the end of the file.
 * zero it, and set the page uptodate
 */
-   void *kaddr = kmap_atomic(page, KM_USER0);
-
-   if (from)
-   memset(kaddr, 0, from);
-   if (to < PAGE_CACHE_SIZE)
-   memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
-   flush_dcache_page(page);
-   kunmap_atomic(kaddr, KM_USER0);
+   simple_prepare_write(file, page, from, to);
SetPageUptodate(page);
} else if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
/* might as well read a page, it is fast enough */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] Add support for new POSIX unlink

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d785a50a8aa404c19f56d2c22445e48e418112b
Commit: 2d785a50a8aa404c19f56d2c22445e48e418112b
Parent: 50c2f75388727018c3c357454a247072915a9e3f
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 01:48:57 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Sun Jul 15 01:48:57 2007 +

[CIFS] Add support for new POSIX unlink

In the cleanup phase of the dbench test, we were noticing sharing
violation followed by failed directory removals when dbench
did not close the test files before the cleanup phase started.
Using the new POSIX unlink, which Samba has supported for a few
months, avoids this.

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/CHANGES |4 ++-
 fs/cifs/cifspdu.h   |6 +++
 fs/cifs/cifsproto.h |5 ++-
 fs/cifs/cifssmb.c   |   85 ++-
 fs/cifs/inode.c |   14 -
 5 files changed, 103 insertions(+), 11 deletions(-)

diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index f92e0ee..6d84ca2 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,7 +1,9 @@
 Version 1.50
 
 Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
-done with "serverino" mount option).
+done with "serverino" mount option).  Add support for POSIX Unlink
+(helps with certain sharing violation cases when server such as
+Samba supports newer POSIX CIFS Protocol Extensions).
 
 Version 1.49
 
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 9044d98..6a2056e 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -2155,6 +2155,12 @@ typedef struct {
/* struct following varies based on requested level */
 } __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */
 
+#define SMB_POSIX_UNLINK_FILE_TARGET   0
+#define SMB_POSIX_UNLINK_DIRECTORY_TARGET  1
+
+struct unlink_psx_rq { /* level 0x20a SetPathInfo */
+   __le16 type;
+} __attribute__((packed));
 
 struct file_internal_info {
__u64  UniqueId; /* inode number */
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 3a76c72..04a69da 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -196,7 +196,10 @@ extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo 
*tcon,
 extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
const char *name, const struct nls_table *nls_codepage,
int remap_special_chars);
-
+extern int CIFSPOSIXDelFile(const int xid, struct cifsTconInfo *tcon,
+   const char *name, __u16 type,
+   const struct nls_table *nls_codepage,
+   int remap_special_chars);
 extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
const char *name,
const struct nls_table *nls_codepage,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 3ab78b7..b339f5f 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -789,6 +789,82 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
 }
 
 int
+CIFSPOSIXDelFile(const int xid, struct cifsTconInfo *tcon, const char 
*fileName,
+__u16 type, const struct nls_table *nls_codepage, int remap)
+{
+   TRANSACTION2_SPI_REQ *pSMB = NULL;
+   TRANSACTION2_SPI_RSP *pSMBr = NULL;
+   struct unlink_psx_rq *pRqD;
+   int name_len;
+   int rc = 0;
+   int bytes_returned = 0;
+   __u16 params, param_offset, offset, byte_count;
+
+   cFYI(1, ("In POSIX delete"));
+PsxDelete:
+   rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
+ (void **) &pSMBr);
+   if (rc)
+   return rc;
+
+   if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
+   name_len =
+   cifsConvertToUCS((__le16 *) pSMB->FileName, fileName,
+PATH_MAX, nls_codepage, remap);
+   name_len++; /* trailing null */
+   name_len *= 2;
+   } else { /* BB add path length overrun check */
+   name_len = strnlen(fileName, PATH_MAX);
+   name_len++; /* trailing null */
+   strncpy(pSMB->FileName, fileName, name_len);
+   }
+
+   params = 6 + name_len;
+   pSMB->MaxParameterCount = cpu_to_le16(2);
+   pSMB->MaxDataCount = 0; /* BB double check this with jra */
+   pSMB->MaxSetupCount = 0;
+   pSMB->Reserved = 0;
+   pSMB->Flags = 0;
+   pSMB->Timeout = 0;
+   pSMB->Reserved2 = 0;
+   param_offset = offsetof(struct smb_com_transaction2_spi_req,
+   InformationLevel) - 4;
+   offset = param_offset + params;
+
+   /* Setup pointer to Request Data (inode type) */
+   pRqD = (struct unlink_psx_rq *)(((char *)&pSMB->hdr.Protocol) + offset);
+   pRqD->ty

[CIFS] Fix oops in cifs_create when nfsd server exports cifs mount

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7521a3c566dda7bb09576975324fc0a08a79ad14
Commit: 7521a3c566dda7bb09576975324fc0a08a79ad14
Parent: fb8c4b14d9259ba467241a7aaeb712caedce7ee8
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 11 18:30:34 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Wed Jul 11 18:30:34 2007 +

[CIFS] Fix oops in cifs_create when nfsd server exports cifs mount

nfsd is passing null nameidata (probably the only one doing that)
on call to create - cifs was missing one check for this.

Note that running nfsd over a cifs mount requires specifying fsid on
the nfs exports entry and requires mounting cifs with serverino mount
option.

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/CHANGES  |3 ++-
 fs/cifs/README   |   13 ++---
 fs/cifs/cifsfs.c |   11 +++
 fs/cifs/dir.c|3 ++-
 fs/cifs/export.c |   15 +++
 fs/cifs/file.c   |2 +-
 6 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index ee276f6..f92e0ee 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,6 +1,7 @@
 Version 1.50
 
-Fix NTLMv2 signing
+Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
+done with "serverino" mount option).
 
 Version 1.49
 
diff --git a/fs/cifs/README b/fs/cifs/README
index eb3efd5..85f1eb1 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -370,7 +370,7 @@ A partial list of the supported mount options follows:
Note that this does not affect the normal ACL check on the
target machine done by the server software (of the server
ACL against the user name provided at mount time).
-  serverinoUse servers inode numbers instead of generating automatically
+  serverinoUse server's inode numbers instead of generating automatically
incrementing inode numbers on the client.  Although this will
make it easier to spot hardlinked files (as they will have
the same inode numbers) and inode numbers may be persistent,
@@ -378,12 +378,11 @@ A partial list of the supported mount options follows:
are unique if multiple server side mounts are exported under a
single share (since inode numbers on the servers might not
be unique if multiple filesystems are mounted under the same
-   shared higher level directory).  Note that this requires that
-   the server support the CIFS Unix Extensions as other servers
-   do not return a unique IndexNumber on SMB FindFirst (most
-   servers return zero as the IndexNumber).  Parameter has no
-   effect to Windows servers and others which do not support the
-   CIFS Unix Extensions.
+   shared higher level directory).  Note that some older
+   (e.g. pre-Windows 2000) do not support returning UniqueIDs
+   or the CIFS Unix Extensions equivalent and for those
+   this mount option will have no effect.  Exporting cifs mounts
+   under nfsd requires this mount option on the cifs mount.
   noserverino   Client generates inode numbers (rather than using the actual 
one
from the server) by default.
   setuids   If the CIFS Unix extensions are negotiated with the server
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 17ed7cf..40f35f0 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -114,10 +114,6 @@ cifs_read_super(struct super_block *sb, void *data,
 
sb->s_magic = CIFS_MAGIC_NUMBER;
sb->s_op = &cifs_super_ops;
-#ifdef CONFIG_CIFS_EXPERIMENTAL
-   if (experimEnabled != 0)
-   sb->s_export_op = &cifs_export_ops;
-#endif /* EXPERIMENTAL */
 /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize =
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
@@ -139,6 +135,13 @@ cifs_read_super(struct super_block *sb, void *data,
rc = -ENOMEM;
goto out_no_root;
}
+   
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+   if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
+   cFYI(1, ("export ops supported"));
+   sb->s_export_op = &cifs_export_ops;
+   }
+#endif /* EXPERIMENTAL */
 
return 0;
 
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 38706e8..def89f2 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -264,7 +264,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, 
int mode,
direntry->d_op = &cifs_dentry_ops;
d_instantiate(direntry, newinode);
}
-   if ((nd->flags & LOOKUP_OPEN) == FALSE) {
+   if ((nd == NULL /* nfsd case - nfs srv 

[CIFS] Fix packet signatures for NTLMv2 case

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b609f06ac4ac77433035366e9aa4dcd7a0f743a0
Commit: b609f06ac4ac77433035366e9aa4dcd7a0f743a0
Parent: 3870253efb65e1960421ca74f5d336218c28fc5b
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 9 07:55:14 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Mon Jul 9 07:55:14 2007 +

[CIFS] Fix packet signatures for NTLMv2 case

Signed-off-by: Yehuda Sadeh Weinraub <[EMAIL PROTECTED]>
Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/CHANGES   |4 +++
 fs/cifs/TODO  |6 ++--
 fs/cifs/cifsencrypt.c |   63 +++--
 fs/cifs/cifsglob.h|   14 ++-
 fs/cifs/cifsproto.h   |8 --
 fs/cifs/connect.c |4 +-
 fs/cifs/sess.c|2 +-
 fs/cifs/transport.c   |6 ++--
 8 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 258130e..ee276f6 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,3 +1,7 @@
+Version 1.50
+
+Fix NTLMv2 signing
+
 Version 1.49
 
 IPv6 support.  Enable ipv6 addresses to be passed on mount (put the ipv6
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index d57dc29..d7bd515 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -18,9 +18,9 @@ better)
 
 d) Kerberos/SPNEGO session setup support - (started)
 
-e) More testing of NTLMv2 authentication (mostly implemented - double check
-that NTLMv2 signing works, also need to cleanup now unneeded SessSetup code in
-fs/cifs/connect.c)
+e) Cleanup now unneeded SessSetup code in
+fs/cifs/connect.c and add back in NTLMSSP code if any servers
+need it
 
 f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup 
 used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 8422df8..860dc49 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -41,16 +41,17 @@ extern void SMBencrypt(unsigned char *passwd, unsigned char 
*c8,
   unsigned char *p24);

 static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
-   const char *key, char *signature)
+   const struct mac_key *key, char *signature)
 {
struct  MD5Context context;
 
-   if ((cifs_pdu == NULL) || (signature == NULL))
+   if ((cifs_pdu == NULL) || (signature == NULL) || (key == NULL))
return -EINVAL;
 
MD5Init(&context);
-   MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16);
+   MD5Update(&context, (char *)&key->data, key->len);
MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
+
MD5Final(signature, &context);
return 0;
 }
@@ -76,7 +77,7 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct 
TCP_Server_Info *server,
server->sequence_number++;
spin_unlock(&GlobalMid_Lock);
 
-   rc = cifs_calculate_signature(cifs_pdu, server->mac_signing_key,
+   rc = cifs_calculate_signature(cifs_pdu, &server->mac_signing_key,
  smb_signature);
if (rc)
memset(cifs_pdu->Signature.SecuritySignature, 0, 8);
@@ -87,16 +88,16 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct 
TCP_Server_Info *server,
 }
 
 static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
-   const char *key, char *signature)
+   const struct mac_key *key, char *signature)
 {
struct  MD5Context context;
int i;
 
-   if ((iov == NULL) || (signature == NULL))
+   if ((iov == NULL) || (signature == NULL) || (key == NULL))
return -EINVAL;
 
MD5Init(&context);
-   MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16);
+   MD5Update(&context, (char *)&key->data, key->len);
for (i=0;isequence_number++;
spin_unlock(&GlobalMid_Lock);
 
-   rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key,
+   rc = cifs_calc_signature2(iov, n_vec, &server->mac_signing_key,
  smb_signature);
if (rc)
memset(cifs_pdu->Signature.SecuritySignature, 0, 8);
@@ -151,7 +152,8 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct 
TCP_Server_Info *server,
return rc;
 }
 
-int cifs_verify_signature(struct smb_hdr *cifs_pdu, const char *mac_key,
+int cifs_verify_signature(struct smb_hdr *cifs_pdu,
+ const struct mac_key *mac_key,
  __u32 expected_sequence_number)
 {
unsigned int rc;
@@ -202,15 +204,17 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, const 
char *mac_key,
 }
 
 /* We fill in key by putting in 40 byte array which was allocated by caller */
-int cifs_calculate_mac_key(char * key, const char * rn, const char * password)
+int cifs_

[CIFS] more whitespace fixes

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3870253efb65e1960421ca74f5d336218c28fc5b
Commit: 3870253efb65e1960421ca74f5d336218c28fc5b
Parent: 790fe579f5006b72dfd2814f9263a73b0b455e81
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 8 15:40:40 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Sun Jul 8 15:40:40 2007 +

[CIFS] more whitespace fixes

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/netmisc.c |   82 ++-
 fs/cifs/readdir.c |  163 +++--
 fs/cifs/sess.c|9 ++-
 fs/cifs/smbdes.c  |   24 
 4 files changed, 141 insertions(+), 137 deletions(-)

diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 20a3fe7..96c3432 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -3,23 +3,22 @@
  *
  *   Copyright (c) International Business Machines  Corp., 2002
  *   Author(s): Steve French ([EMAIL PROTECTED])
- * 
+ *
  *   Error mapping routines from Samba libsmb/errormap.c
  *   Copyright (C) Andrew Tridgell 2001
  *
- *
  *   This program is free software;  you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or 
+ *   the Free Software Foundation; either version 2 of the License, or
  *   (at your option) any later version.
- * 
+ *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  *   the GNU General Public License for more details.
  *
  *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software 
+ *   along with this program;  if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
@@ -67,22 +66,22 @@ static const struct smb_to_posix_error 
mapping_table_ERRDOS[] = {
{ERRbadshare, -ETXTBSY},
{ERRlock, -EACCES},
{ERRunsup, -EINVAL},
-   {ERRnosuchshare,-ENXIO},
+   {ERRnosuchshare, -ENXIO},
{ERRfilexists, -EEXIST},
{ERRinvparm, -EINVAL},
{ERRdiskfull, -ENOSPC},
{ERRinvname, -ENOENT},
-   {ERRinvlevel,-EOPNOTSUPP},
+   {ERRinvlevel, -EOPNOTSUPP},
{ERRdirnotempty, -ENOTEMPTY},
{ERRnotlocked, -ENOLCK},
{ERRcancelviolation, -ENOLCK},
{ERRalreadyexists, -EEXIST},
{ERRmoredata, -EOVERFLOW},
-   {ERReasnotsupported,-EOPNOTSUPP},
+   {ERReasnotsupported, -EOPNOTSUPP},
{ErrQuota, -EDQUOT},
{ErrNotALink, -ENOLINK},
-   {ERRnetlogonNotStarted,-ENOPROTOOPT},
-   {ErrTooManyLinks,-EMLINK},
+   {ERRnetlogonNotStarted, -ENOPROTOOPT},
+   {ErrTooManyLinks, -EMLINK},
{0, 0}
 };
 
@@ -133,15 +132,15 @@ static const struct smb_to_posix_error 
mapping_table_ERRHRD[] = {
 /* returns 0 if invalid address */
 
 int
-cifs_inet_pton(int address_family, char *cp,void *dst)
+cifs_inet_pton(int address_family, char *cp, void *dst)
 {
int ret = 0;
 
/* calculate length by finding first slash or NULL */
-   /* BB Should we convert '/' slash to '\' here since it seems already 
done
-  before this */
+   /* BB Should we convert '/' slash to '\' here since it seems already
+* done before this */
if ( address_family == AF_INET ) {
-   ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL); 
+   ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
} else if ( address_family == AF_INET6 ) {
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
}
@@ -185,7 +184,7 @@ static const struct {
ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, {
ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR},
 /* { This NT error code was 'sqashed'
-from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK 
+from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
 during the session setup } */
{
ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, {
@@ -200,7 +199,7 @@ static const struct {
ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, {
ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED},
 /* { This NT error code was 'sqashed'
-from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 
+from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
 during the session setup }   */
{
ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, {
@@ -270,7 +269,7 @@ static const struct {
ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, {
ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS},
 /* { This NT error code was 'sqashed'
-from NT_STATUS_NO_SUCH_U

[CIFS] whitespace cleanup

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6dc0f87e351142e224b396f29b59527c4b2d834c
Commit: 6dc0f87e351142e224b396f29b59527c4b2d834c
Parent: 79a58d1f6075bc0029c38836be9790917a69a342
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 6 23:13:06 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Fri Jul 6 23:13:06 2007 +

[CIFS] whitespace cleanup

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifsfs.c  |   63 +++--
 fs/cifs/nterr.c   |8 +++---
 fs/cifs/nterr.h   |2 +-
 fs/cifs/ntlmssp.h |2 +-
 fs/cifs/readdir.c |   17 +++--
 fs/cifs/smberr.h  |2 +-
 6 files changed, 48 insertions(+), 46 deletions(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 7c04752..9122ef5 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -64,10 +64,10 @@ unsigned int multiuser_mount = 0;
 unsigned int extended_security = CIFSSEC_DEF;
 /* unsigned int ntlmv2_support = 0; */
 unsigned int sign_CIFS_PDUs = 1;
-extern struct task_struct * oplockThread; /* remove sparse warning */
-struct task_struct * oplockThread = NULL;
+extern struct task_struct *oplockThread; /* remove sparse warning */
+struct task_struct *oplockThread = NULL;
 /* extern struct task_struct * dnotifyThread; remove sparse warning */
-static struct task_struct * dnotifyThread = NULL;
+static struct task_struct *dnotifyThread = NULL;
 static const struct super_operations cifs_super_ops;
 unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
 module_param(CIFSMaxBufSize, int, 0);
@@ -765,22 +765,22 @@ cifs_init_request_bufs(void)
been more efficient (compacting multiple slab items on one 4k page) 
for the case in which debug was on, but this larger size allows
more SMBs to use small buffer alloc and is still much more
-   efficient to alloc 1 per page off the slab compared to 17K (5page) 
+   efficient to alloc 1 per page off the slab compared to 17K (5page)
alloc of large cifs buffers even when page debugging is on */
cifs_sm_req_cachep = kmem_cache_create("cifs_small_rq",
-   MAX_CIFS_SMALL_BUFFER_SIZE, 0, SLAB_HWCACHE_ALIGN, 
+   MAX_CIFS_SMALL_BUFFER_SIZE, 0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (cifs_sm_req_cachep == NULL) {
mempool_destroy(cifs_req_poolp);
kmem_cache_destroy(cifs_req_cachep);
-   return -ENOMEM;  
+   return -ENOMEM;
}
 
if (cifs_min_small < 2)
cifs_min_small = 2;
else if (cifs_min_small > 256) {
cifs_min_small = 256;
-   cFYI(1,("cifs_min_small set to maximum (256)"));
+   cFYI(1, ("cifs_min_small set to maximum (256)"));
}
 
cifs_sm_req_poolp = mempool_create_slab_pool(cifs_min_small,
@@ -843,14 +843,14 @@ cifs_destroy_mids(void)
 
 static int cifs_oplock_thread(void * dummyarg)
 {
-   struct oplock_q_entry * oplock_item;
+   struct oplock_q_entry *oplock_item;
struct cifsTconInfo *pTcon;
-   struct inode * inode;
+   struct inode *inode;
__u16  netfid;
int rc;
 
do {
-   if (try_to_freeze()) 
+   if (try_to_freeze())
continue;

spin_lock(&GlobalMid_Lock);
@@ -859,17 +859,17 @@ static int cifs_oplock_thread(void * dummyarg)
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(39*HZ);
} else {
-   oplock_item = list_entry(GlobalOplock_Q.next, 
+   oplock_item = list_entry(GlobalOplock_Q.next,
struct oplock_q_entry, qhead);
if (oplock_item) {
-   cFYI(1,("found oplock item to write out")); 
+   cFYI(1,("found oplock item to write out"));
pTcon = oplock_item->tcon;
inode = oplock_item->pinode;
netfid = oplock_item->netfid;
spin_unlock(&GlobalMid_Lock);
DeleteOplockQEntry(oplock_item);
/* can not grab inode sem here since it would
-   deadlock when oplock received on delete 
+   deadlock when oplock received on delete
since vfs_unlink holds the i_mutex across
the call */
/* mutex_lock(&inode->i_mutex);*/
@@ -884,20 +884,21 @@ static int cifs_oplock_thread(void * dummyarg)
/* mutex_unlock(&inode->i_mutex);*/
if (rc)

[CIFS] whitespace cleanup

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=79a58d1f6075bc0029c38836be9790917a69a342
Commit: 79a58d1f6075bc0029c38836be9790917a69a342
Parent: d20acd09e3bf89aa23af034b8c2d0f5653577ea9
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 6 22:44:50 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Fri Jul 6 22:44:50 2007 +

[CIFS] whitespace cleanup

checkpatch.pl redux

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/smberr.h|8 +-
 fs/cifs/transport.c |  226 +-
 fs/cifs/xattr.c |  226 ++-
 3 files changed, 232 insertions(+), 228 deletions(-)

diff --git a/fs/cifs/smberr.h b/fs/cifs/smberr.h
index 212c3c2..23a7860 100644
--- a/fs/cifs/smberr.h
+++ b/fs/cifs/smberr.h
@@ -4,8 +4,8 @@
  *   Copyright (c) International Business Machines  Corp., 2002,2004
  *   Author(s): Steve French ([EMAIL PROTECTED])
  *
- *   See Error Codes section of the SNIA CIFS Specification 
- *   for more information 
+ *   See Error Codes section of the SNIA CIFS Specification
+ *   for more information
  *
  *   This library is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published
@@ -19,7 +19,7 @@
  *
  *   You should have received a copy of the GNU Lesser General Public License
  *   along with this library; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #define SUCCESS0x00/* The request was successful. */
@@ -110,7 +110,7 @@
 
 /* Below errors are used internally (do not come over the wire) for passthrough
from STATUS codes to POSIX only  */
-#define ErrTooManyLinks 0xFFFE   
+#define ErrTooManyLinks 0xFFFE 
 
 /* Following error codes may be generated with the ERRSRV error class.*/
 
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 5f46845..01b5891 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1,10 +1,10 @@
 /*
  *   fs/cifs/transport.c
  *
- *   Copyright (C) International Business Machines  Corp., 2002,2005
+ *   Copyright (C) International Business Machines  Corp., 2002,2007
  *   Author(s): Steve French ([EMAIL PROTECTED])
  *   Jeremy Allison ([EMAIL PROTECTED]) 2006.
- *
+ *
  *   This library is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published
  *   by the Free Software Foundation; either version 2.1 of the License, or
@@ -17,7 +17,7 @@
  *
  *   You should have received a copy of the GNU Lesser General Public License
  *   along with this library; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include 
@@ -86,7 +86,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
list_del(&midEntry->qhead);
atomic_dec(&midCount);
spin_unlock(&GlobalMid_Lock);
-   if(midEntry->largeBuf)
+   if (midEntry->largeBuf)
cifs_buf_release(midEntry->resp_buf);
else
cifs_small_buf_release(midEntry->resp_buf);
@@ -94,8 +94,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
now = jiffies;
/* commands taking longer than one second are indications that
   something is wrong, unless it is quite a slow link or server */
-   if((now - midEntry->when_alloc) > HZ) {
-   if((cifsFYI & CIFS_TIMER) && 
+   if ((now - midEntry->when_alloc) > HZ) {
+   if ((cifsFYI & CIFS_TIMER) &&
   (midEntry->command != SMB_COM_LOCKING_ANDX)) {
printk(KERN_DEBUG " CIFS slow rsp: cmd %d mid %d",
   midEntry->command, midEntry->mid);
@@ -110,10 +110,10 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
 }
 
 struct oplock_q_entry *
-AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
+AllocOplockQEntry(struct inode *pinode, __u16 fid, struct cifsTconInfo *tcon)
 {
struct oplock_q_entry *temp;
-   if ((pinode== NULL) || (tcon == NULL)) {
+   if ((pinode == NULL) || (tcon == NULL)) {
cERROR(1, ("Null parms passed to AllocOplockQEntry"));
return NULL;
}
@@ -133,9 +133,9 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct 
cifsTconInfo * tcon)
 
 }
 
-void DeleteOplockQEntry(struct oplock_q_entry * oplockEntry)
+void DeleteOplockQEntry(struct oplock_q_entry *oplockEntry)
 {
-   spin_lock(&GlobalMid_Lock); 
+   spin_lock(&GlobalMid_Lock);
 /* should we check if list empty first? */
list_del(&oplockEntry->qhead);
spin_unl

[CIFS] ipv6 support no longer experimental

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d20acd09e3bf89aa23af034b8c2d0f5653577ea9
Commit: d20acd09e3bf89aa23af034b8c2d0f5653577ea9
Parent: 38c10a1ddb24b9fa9f25b6c21d0390a9723ae6d6
Author: Jeff <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 6 21:13:08 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Fri Jul 6 21:13:08 2007 +

[CIFS] ipv6 support no longer experimental

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifsfs.h  |2 +-
 fs/cifs/netmisc.c |   61 -
 2 files changed, 1 insertions(+), 62 deletions(-)

diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index af3689b..ee8ab87 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -101,5 +101,5 @@ extern ssize_t  cifs_getxattr(struct dentry *, const 
char *, void *, size_t);
 extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
 extern int cifs_ioctl (struct inode *inode, struct file *filep,
   unsigned int command, unsigned long arg);
-#define CIFS_VERSION   "1.49"
+#define CIFS_VERSION   "1.50"
 #endif /* _CIFSFS_H */
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 53e304d..b388c35 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -135,7 +135,6 @@ static const struct smb_to_posix_error 
mapping_table_ERRHRD[] = {
 int
 cifs_inet_pton(int address_family, char *cp,void *dst)
 {
-#ifdef CONFIG_CIFS_EXPERIMENTAL
int ret = 0;
 
/* calculate length by finding first slash or NULL */
@@ -152,66 +151,6 @@ cifs_inet_pton(int address_family, char *cp,void *dst)
if (ret > 0)
ret = 1;
return ret;
-#else
-   int value;
-   int digit;
-   int i;
-   char temp;
-   char bytes[4];
-   char *end = bytes;
-   static const int addr_class_max[4] =
-   { 0x, 0xff, 0x, 0xff };
-
-   if(address_family != AF_INET)
-   return -EAFNOSUPPORT;
-
-   for (i = 0; i < 4; i++) {
-   bytes[i] = 0;
-   }
-
-   temp = *cp;
-
-   while (TRUE) {
-   if (!isdigit(temp))
-   return 0;
-
-   value = 0;
-   digit = 0;
-   for (;;) {
-   if (isascii(temp) && isdigit(temp)) {
-   value = (value * 10) + temp - '0';
-   temp = *++cp;
-   digit = 1;
-   } else
-   break;
-   }
-
-   if (temp == '.') {
-   if ((end > bytes + 2) || (value > 255))
-   return 0;
-   *end++ = value;
-   temp = *++cp;
-   } else if (temp == ':') {
-   cFYI(1,("IPv6 addresses not supported for CIFS mounts 
yet"));
-   return -1;
-   } else
-   break;
-   }
-
-   /* check for last characters */
-   if (temp != '\0' && (!isascii(temp) || !isspace(temp)))
-   if (temp != '\\') {
-   if (temp != '/')
-   return 0;
-   else
-   (*cp = '\\');   /* switch the slash the 
expected way */
-   }
-   if (value > addr_class_max[end - bytes])
-   return 0;
-
-   *((__be32 *)dst) = *((__be32 *) bytes) | htonl(value);
-   return 1; /* success */
-#endif /* EXPERIMENTAL */  
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] Mount should fail if server signing off but client mount option requires it

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=38c10a1ddb24b9fa9f25b6c21d0390a9723ae6d6
Commit: 38c10a1ddb24b9fa9f25b6c21d0390a9723ae6d6
Parent: d38d8c74c7cdfae910f9cd0ac5e1b7ba2d8a2fb2
Author: Jeff <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 6 21:10:07 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Fri Jul 6 21:10:07 2007 +

[CIFS] Mount should fail if server signing off but client mount option 
requires it

Currently, if mount with a signing-enabled sec= option (e.g.
sec=ntlmi), the kernel does a warning printk if the server doesn't
support signing, and then proceeds without signatures.

This is probably OK for people that think to look at the ring buffer,
but seems wrong to me. If someone explicitly requests signing, we
should error out if that request can't be satisfied. They can then
reattempt the mount without signing if that's ok.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>
Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/CHANGES   |1 +
 fs/cifs/cifssmb.c |3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index b4d388d..258130e 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -12,6 +12,7 @@ to match what documentation said. Support for very large 
reads, over 127K,
 available to some newer servers (such as Samba 3.0.26 and later but
 note that it also requires setting CIFSMaxBufSize at module install
 time to a larger value which may hurt performance in some cases).
+Make sign option force signing (or fail if server does not support it).
 
 Version 1.48
 
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 4a2458e..b4916eb 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -645,11 +645,12 @@ signing_check:
~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED);
} else if ((secFlags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) {
/* signing required */
-   cFYI(1, ("Must sign - segFlags 0x%x", secFlags));
+   cFYI(1, ("Must sign - secFlags 0x%x", secFlags));
if ((server->secMode &
(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED)) == 0) {
cERROR(1,
("signing required but server lacks support"));
+   rc = -EOPNOTSUPP;
} else
server->secMode |= SECMODE_SIGN_REQUIRED;
} else {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] whitespace fixes

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d38d8c74c7cdfae910f9cd0ac5e1b7ba2d8a2fb2
Commit: d38d8c74c7cdfae910f9cd0ac5e1b7ba2d8a2fb2
Parent: 762e5ab77c803c819e45d054518a98efb70b0f60
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 28 19:44:13 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Thu Jun 28 19:44:13 2007 +

[CIFS] whitespace fixes

This changeset brought to you ... by patchcheck.pl

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifs_unicode.h |   11 +++--
 fs/cifs/cifs_uniupr.h  |2 +-
 fs/cifs/cifsfs.h   |   15 ---
 fs/cifs/cifsglob.h |   60 +-
 fs/cifs/cifsproto.h|  106 
 fs/cifs/ntlmssp.h  |   20 +-
 6 files changed, 108 insertions(+), 106 deletions(-)

diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h
index 39e5b97..274e412 100644
--- a/fs/cifs/cifs_unicode.h
+++ b/fs/cifs/cifs_unicode.h
@@ -5,20 +5,20 @@
  * Convert a unicode character to upper or lower case using
  * compressed tables.
  *
- *   Copyright (c) International Business Machines  Corp., 
2000,200555
+ *   Copyright (c) International Business Machines  Corp., 2000,2007
  *
  *   This program is free software;  you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or 
+ *   the Free Software Foundation; either version 2 of the License, or
  *   (at your option) any later version.
- * 
+ *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  *   the GNU General Public License for more details.
  *
  *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software 
+ *   along with this program;  if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  *
@@ -142,7 +142,8 @@ UniStrlen(const wchar_t * ucs1)
 }
 
 /*
- * UniStrnlen:  Return the length (in 16 bit Unicode chars not bytes) of a 
string (length limited)
+ * UniStrnlen:  Return the length (in 16 bit Unicode chars not bytes) of a
+ * string (length limited)
  */
 static inline size_t
 UniStrnlen(const wchar_t * ucs1, int maxlen)
diff --git a/fs/cifs/cifs_uniupr.h b/fs/cifs/cifs_uniupr.h
index da2ad5b..ac622e7 100644
--- a/fs/cifs/cifs_uniupr.h
+++ b/fs/cifs/cifs_uniupr.h
@@ -3,7 +3,7 @@
  *
  *   This program is free software;  you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or 
+ *   the Free Software Foundation; either version 2 of the License, or
  *   (at your option) any later version.
  * 
  *   This program is distributed in the hope that it will be useful,
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index c235d32..af3689b 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -16,7 +16,7 @@
  *
  *   You should have received a copy of the GNU Lesser General Public License
  *   along with this library; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #ifndef _CIFSFS_H
@@ -43,7 +43,7 @@ extern void cifs_read_inode(struct inode *);
 
 /* Functions related to inodes */
 extern const struct inode_operations cifs_dir_inode_ops;
-extern int cifs_create(struct inode *, struct dentry *, int, 
+extern int cifs_create(struct inode *, struct dentry *, int,
   struct nameidata *);
 extern struct dentry * cifs_lookup(struct inode *, struct dentry *,
  struct nameidata *);
@@ -63,9 +63,9 @@ extern const struct inode_operations cifs_symlink_inode_ops;
 
 /* Functions related to files and directories */
 extern const struct file_operations cifs_file_ops;
-extern const struct file_operations cifs_file_direct_ops; /* if directio mount 
*/
+extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */
 extern const struct file_operations cifs_file_nobrl_ops;
-extern const struct file_operations cifs_file_direct_nobrl_ops; /* if directio 
mount */
+extern const struct file_operations cifs_file_direct_nobrl_ops; /* no brlocks 
*/
 extern int cifs_open(struct inode *inode, struct file *file);
 extern int cifs_close(struct inode *inode, struct file *file);
 extern int cifs_closedir(struct inode *inode, struct file *file);
@@ -88,8 +88,9 @@ extern struct dentry_operations cifs_ci_dentry_ops;
 
 /* Functions related t

[CIFS] Fix sign mount option and sign proc config setting

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=762e5ab77c803c819e45d054518a98efb70b0f60
Commit: 762e5ab77c803c819e45d054518a98efb70b0f60
Parent: 467a8f8d480190a98cec3e4362c51c2a27157115
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 28 18:41:42 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Thu Jun 28 18:41:42 2007 +

[CIFS] Fix sign mount option and sign proc config setting

We were checking the wrong (old) global variable to determine
whether to override server and force signing on the SMB
connection.

Acked-by: Dave Kleikamp <[EMAIL PROTECTED]>
Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifs_debug.c |   92 -
 fs/cifs/cifssmb.c|   32 +++--
 2 files changed, 29 insertions(+), 95 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index ebd1335..42fafa1 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -901,90 +901,14 @@ security_flags_write(struct file *file, const char __user 
*buffer,
}
/* flags look ok - update the global security flags for cifs module */
extended_security = flags;
+   if (extended_security & CIFSSEC_MUST_SIGN) {
+   /* requiring signing implies signing is allowed */
+   extended_security |= CIFSSEC_MAY_SIGN;
+   cFYI(1, ("packet signing now required"));
+   } else if ((extended_security & CIFSSEC_MAY_SIGN) == 0) {
+   cFYI(1, ("packet signing disabled"));
+   }
+   /* BB should we turn on MAY flags for other MUST options? */
return count;
 }
-
-/* static int
-ntlmv2_enabled_read(char *page, char **start, off_t off,
-  int count, int *eof, void *data)
-{
-   int len;
-
-   len = sprintf(page, "%d\n", ntlmv2_support);
-
-   len -= off;
-   *start = page + off;
-
-   if (len > count)
-   len = count;
-   else
-   *eof = 1;
-
-   if (len < 0)
-   len = 0;
-
-   return len;
-}
-static int
-ntlmv2_enabled_write(struct file *file, const char __user *buffer,
-   unsigned long count, void *data)
-{
-   char c;
-   int rc;
-
-   rc = get_user(c, buffer);
-   if (rc)
-   return rc;
-   if (c == '0' || c == 'n' || c == 'N')
-   ntlmv2_support = 0;
-   else if (c == '1' || c == 'y' || c == 'Y')
-   ntlmv2_support = 1;
-   else if (c == '2')
-   ntlmv2_support = 2;
-
-   return count;
-}
-
-static int
-packet_signing_enabled_read(char *page, char **start, off_t off,
-  int count, int *eof, void *data)
-{
-   int len;
-
-   len = sprintf(page, "%d\n", sign_CIFS_PDUs);
-
-   len -= off;
-   *start = page + off;
-
-   if (len > count)
-   len = count;
-   else
-   *eof = 1;
-
-   if (len < 0)
-   len = 0;
-
-   return len;
-}
-static int
-packet_signing_enabled_write(struct file *file, const char __user *buffer,
-   unsigned long count, void *data)
-{
-   char c;
-   int rc;
-
-   rc = get_user(c, buffer);
-   if (rc)
-   return rc;
-   if (c == '0' || c == 'n' || c == 'N')
-   sign_CIFS_PDUs = 0;
-   else if (c == '1' || c == 'y' || c == 'Y')
-   sign_CIFS_PDUs = 1;
-   else if (c == '2')
-   sign_CIFS_PDUs = 2;
-
-   return count;
-} */
-
-
 #endif
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 57419a1..4a2458e 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -426,11 +426,11 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo 
*ses)
 
/* if any of auth flags (ie not sign or seal) are overriden use them */
if(ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL)))
-   secFlags = ses->overrideSecFlg;
+   secFlags = ses->overrideSecFlg;  /* BB FIXME fix sign flags? */
else /* if override flags set only sign/seal OR them with global auth */
secFlags = extended_security | ses->overrideSecFlg;
 
-   cFYI(1,("secFlags 0x%x",secFlags));
+   cFYI(1, ("secFlags 0x%x", secFlags));
 
pSMB->hdr.Mid = GetNextMid(server);
pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
@@ -633,22 +633,32 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo 
*ses)
 #ifdef CONFIG_CIFS_WEAK_PW_HASH
 signing_check:
 #endif
-   if(sign_CIFS_PDUs == FALSE) {
+   if ((secFlags & CIFSSEC_MAY_SIGN) == 0) {
+   /* MUST_SIGN already includes the MAY_SIGN FLAG
+  so if this is zero it means that signing is disabled */
+   cFYI(1, ("Signing disabled"));
if(server->secMode & SECMODE_SIGN_REQUIRED)
-   cERROR(1,("Serv

[CIFS] Do not allow signals in cifs_demultiplex_thread

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5d9c720678f9b4ed3db86466223dc61cbf78361d
Commit: 5d9c720678f9b4ed3db86466223dc61cbf78361d
Parent: ffdd6e4d1685779a413e4a8d753b1862259ed42a
Author: Jeff <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 25 22:16:35 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Mon Jun 25 22:16:35 2007 +

[CIFS] Do not allow signals in cifs_demultiplex_thread

Switch from send_sig to force_sig and do not allow signal for this
background thread (the signal is needed to wakeup the thread when
blocked in the network stack).

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>
Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/connect.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4a2af78..cf60691 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -348,7 +348,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
int isMultiRsp;
int reconnect;
 
-   allow_signal(SIGKILL);
current->flags |= PF_MEMALLOC;
server->tsk = current;  /* save process info to wake at shutdown */
cFYI(1, ("Demultiplex PID: %d", current->pid));
@@ -2089,7 +2088,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info 
*cifs_sb,
   always wake up processes blocked in
   tcp in recv_mesg then we could remove the
   send_sig call */
-   send_sig(SIGKILL,srvTcp->tsk,1);
+   force_sig(SIGKILL,srvTcp->tsk);
tsk = srvTcp->tsk;
if(tsk)
kthread_stop(tsk);
@@ -2106,9 +2105,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info 
*cifs_sb,
temp_rc = CIFSSMBLogoff(xid, pSesInfo);
/* if the socketUseCount is now zero */
if ((temp_rc == -ESHUTDOWN) &&
-  (pSesInfo->server) && 
(pSesInfo->server->tsk)) {
+   (pSesInfo->server) && 
+   (pSesInfo->server->tsk)) {
struct task_struct *tsk;
-   
send_sig(SIGKILL,pSesInfo->server->tsk,1);
+   force_sig(SIGKILL,
+   pSesInfo->server->tsk);
tsk = pSesInfo->server->tsk;
if (tsk)
kthread_stop(tsk);
@@ -3364,9 +3365,9 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info 
*cifs_sb)
FreeXid(xid);
return 0;
} else if (rc == -ESHUTDOWN) {
-   cFYI(1,("Waking up socket by sending it 
signal"));
+   cFYI(1,("Waking up socket by sending signal"));
if (cifsd_task) {
-   send_sig(SIGKILL,cifsd_task,1);
+   force_sig(SIGKILL,cifsd_task);
kthread_stop(cifsd_task);
}
rc = 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] whitespace cleanup

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=467a8f8d480190a98cec3e4362c51c2a27157115
Commit: 467a8f8d480190a98cec3e4362c51c2a27157115
Parent: 5d9c720678f9b4ed3db86466223dc61cbf78361d
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Wed Jun 27 22:41:32 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Wed Jun 27 22:41:32 2007 +

[CIFS] whitespace cleanup

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/connect.c |   53 +++--
 1 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index cf60691..8f436ef 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -158,10 +158,11 @@ cifs_reconnect(struct TCP_Server_Info *server)
/* do not want to be sending data on a socket we are freeing */
down(&server->tcpSem); 
if(server->ssocket) {
-   cFYI(1,("State: 0x%x Flags: 0x%lx", server->ssocket->state,
+   cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state,
server->ssocket->flags));
server->ssocket->ops->shutdown(server->ssocket,SEND_SHUTDOWN);
-   cFYI(1,("Post shutdown state: 0x%x Flags: 0x%lx", 
server->ssocket->state,
+   cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx", 
+   server->ssocket->state,
server->ssocket->flags));
sock_release(server->ssocket);
server->ssocket = NULL;
@@ -197,7 +198,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
server->server_RFC1001_name);
}
if(rc) {
-   cFYI(1,("reconnect error %d",rc));
+   cFYI(1, ("reconnect error %d",rc));
msleep(3000);
} else {
atomic_inc(&tcpSesReconnectCount);
@@ -233,7 +234,7 @@ static int check2ndT2(struct smb_hdr * pSMB, unsigned int 
maxBufSize)
 /* check for plausible wct, bcc and t2 data and parm sizes */
 /* check for parm and data offset going beyond end of smb */
if(pSMB->WordCount != 10) { /* coalesce_t2 depends on this */
-   cFYI(1,("invalid transact2 word count"));
+   cFYI(1, ("invalid transact2 word count"));
return -EINVAL;
}
 
@@ -247,11 +248,11 @@ static int check2ndT2(struct smb_hdr * pSMB, unsigned int 
maxBufSize)
if(remaining == 0)
return 0;
else if(remaining < 0) {
-   cFYI(1,("total data %d smaller than data in frame %d",
+   cFYI(1, ("total data %d smaller than data in frame %d",
total_data_size, data_in_this_rsp));
return -EINVAL;
} else {
-   cFYI(1,("missing %d bytes from transact2, check next response",
+   cFYI(1, ("missing %d bytes from transact2, check next response",
remaining));
if(total_data_size > maxBufSize) {
cERROR(1,("TotalDataSize %d is over maximum buffer %d",
@@ -292,7 +293,7 @@ static int coalesce_t2(struct smb_hdr * psecond, struct 
smb_hdr *pTargetSMB)

total_in_buf2 = le16_to_cpu(pSMB2->t2_rsp.DataCount);
if(remaining < total_in_buf2) {
-   cFYI(1,("transact2 2nd response contains too much data"));
+   cFYI(1, ("transact2 2nd response contains too much data"));
}
 
/* find end of first SMB data area */
@@ -321,7 +322,7 @@ static int coalesce_t2(struct smb_hdr * psecond, struct 
smb_hdr *pTargetSMB)
pTargetSMB->smb_buf_length = byte_count;
 
if(remaining == total_in_buf2) {
-   cFYI(1,("found the last secondary response"));
+   cFYI(1, ("found the last secondary response"));
return 0; /* we are done */
} else /* more responses to go */
return 1;
@@ -424,10 +425,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
break;
}
if (!try_to_freeze() && (length == -EINTR)) {
-   cFYI(1,("cifsd thread killed"));
+   cFYI(1, ("cifsd thread killed"));
break;
}
-   cFYI(1,("Reconnect after unexpected peek error %d",
+   cFYI(1, ("Reconnect after unexpected peek error %d",
length));
cifs_reconnect(server);
csocket = server->ssocket;
@@ -457,12 +458,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
pdu_length = ntohl(smb_buffer->smb_buf_length);
smb_buffer->smb_buf_length = pdu_length;
 
-   

[CIFS] fix whitespace

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ffdd6e4d1685779a413e4a8d753b1862259ed42a
Commit: ffdd6e4d1685779a413e4a8d753b1862259ed42a
Parent: 75865f8cc8b38c30c3923b74de4b29a00cc4c0e4
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Sun Jun 24 21:15:44 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Sun Jun 24 21:15:44 2007 +

[CIFS] fix whitespace

More whitespace problems found by checkpatch

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifs_debug.c  |   10 ++--
 fs/cifs/cifsencrypt.c |  104 +
 2 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 07838b2..ebd1335 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -58,7 +58,7 @@ cifs_dump_mem(char *label, void *data, int length)
 }
 
 #ifdef CONFIG_CIFS_DEBUG2
-void cifs_dump_detail(struct smb_hdr * smb)
+void cifs_dump_detail(struct smb_hdr *smb)
 {
cERROR(1, ("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
  smb->Command, smb->Status.CifsError,
@@ -67,10 +67,10 @@ void cifs_dump_detail(struct smb_hdr * smb)
 }
 
 
-void cifs_dump_mids(struct TCP_Server_Info * server)
+void cifs_dump_mids(struct TCP_Server_Info *server)
 {
struct list_head *tmp;
-   struct mid_q_entry * mid_entry;
+   struct mid_q_entry *mid_entry;
 
if (server == NULL)
return;
@@ -114,12 +114,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t 
offset,
 {
struct list_head *tmp;
struct list_head *tmp1;
-   struct mid_q_entry * mid_entry;
+   struct mid_q_entry *mid_entry;
struct cifsSesInfo *ses;
struct cifsTconInfo *tcon;
int i;
int length = 0;
-   char * original_buf = buf;
+   char *original_buf = buf;
 
*beginBuffer = buf + offset;
 
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index fdeda51..8422df8 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -21,7 +21,7 @@
 
 #include 
 #include "cifspdu.h"
-#include "cifsglob.h" 
+#include "cifsglob.h"
 #include "cifs_debug.h"
 #include "md5.h"
 #include "cifs_unicode.h"
@@ -29,54 +29,56 @@
 #include 
 #include 
 
-/* Calculate and return the CIFS signature based on the mac key and the smb 
pdu */
+/* Calculate and return the CIFS signature based on the mac key and SMB PDU */
 /* the 16 byte signature must be allocated by the caller  */
 /* Note we only use the 1st eight bytes */
-/* Note that the smb header signature field on input contains the  
+/* Note that the smb header signature field on input contains the
sequence number before this function is called */
 
 extern void mdfour(unsigned char *out, unsigned char *in, int n);
 extern void E_md4hash(const unsigned char *passwd, unsigned char *p16);
 extern void SMBencrypt(unsigned char *passwd, unsigned char *c8,
-   unsigned char *p24);
+  unsigned char *p24);

-static int cifs_calculate_signature(const struct smb_hdr * cifs_pdu, 
-   const char * key, char * signature)
+static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
+   const char *key, char *signature)
 {
struct  MD5Context context;
 
-   if((cifs_pdu == NULL) || (signature == NULL))
+   if ((cifs_pdu == NULL) || (signature == NULL))
return -EINVAL;
 
MD5Init(&context);
-   MD5Update(&context,key,CIFS_SESS_KEY_SIZE+16);
-   MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length);
-   MD5Final(signature,&context);
+   MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16);
+   MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
+   MD5Final(signature, &context);
return 0;
 }
 
-int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server,
-   __u32 * pexpected_response_sequence_number)
+int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server,
+ __u32 *pexpected_response_sequence_number)
 {
int rc = 0;
char smb_signature[20];
 
-   if((cifs_pdu == NULL) || (server == NULL))
+   if ((cifs_pdu == NULL) || (server == NULL))
return -EINVAL;
 
-   if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) 
+   if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0)
return rc;
 
spin_lock(&GlobalMid_Lock);
-   cifs_pdu->Signature.Sequence.SequenceNumber = 
cpu_to_le32(server->sequence_number);
+   cifs_pdu->Signature.Sequence.SequenceNumber = 
+   cpu_to_le32(server->sequence_number);
cifs_pdu->Signature.Sequence.Reserved = 0;

*pexpected_response_sequence_number = server->sequence_number++;
server->sequence_numbe

zh_CN/HOWTO: update URLs of git trees

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ede178e216b5dd9200cf2c483c746e0672fbe503
Commit: ede178e216b5dd9200cf2c483c746e0672fbe503
Parent: 29a68ee73ec6a5510cbf9d803cbf6190b615e276
Author: Li Yang <[EMAIL PROTECTED]>
AuthorDate: Tue Jun 26 11:15:27 2007 +0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 16:02:12 2007 -0700

zh_CN/HOWTO: update URLs of git trees

Addressing patch from Stefan Richter:
HOWTO: update URLs of git trees
(It will be better if we update this to commit-id later)

Signed-off-by: Li Yang <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/zh_CN/HOWTO |   26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Documentation/zh_CN/HOWTO b/Documentation/zh_CN/HOWTO
index 239f454..48fc67b 100644
--- a/Documentation/zh_CN/HOWTO
+++ b/Documentation/zh_CN/HOWTO
@@ -281,39 +281,37 @@ linux-kernel邮件列表中提供反馈,告诉大家你遇到了问题还是��
 下面是目前可用的一些内核源码树的列表:
   通过git管理的源码树:
 - Kbuild开发源码树, Sam Ravnborg <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
+   git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
 
 - ACPI开发源码树, Len Brown <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
+   git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
 
 - 块设备开发源码树, Jens Axboe <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
+   git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
 
 - DRM开发源码树, Dave Airlie <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
+   git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
 
 - ia64开发源码树, Tony Luck <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
+   git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
 
 - ieee1394开发源码树, Jody McIntyre <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git
+   git.kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git
 
 - infiniband开发源码树, Roland Dreier <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
+   git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
 
 - libata开发源码树, Jeff Garzik <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
+   git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
 
 - 网络驱动程序开发源码树, Jeff Garzik <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
+   git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
 
 - pcmcia开发源码树, Dominik Brodowski <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
+   git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
 
 - SCSI开发源码树, James Bottomley <[EMAIL PROTECTED]>
-   kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
-
-  其他git管理的内核源码树可以在http://kernel.org/git的列表中找到
+   git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
 
   使用quilt管理的补丁集:
 - USB, PCI, 驱动程序核心和I2C, Greg Kroah-Hartman <[EMAIL PROTECTED]>
@@ -321,6 +319,8 @@ linux-kernel邮件列表中提供反馈,告诉大家你遇到了问题还是��
 - x86-64, 部分i386, Andi Kleen <[EMAIL PROTECTED]>
ftp.firstfloor.org:/pub/ak/x86_64/quilt/
 
+  其他内核源码树可以在http://git.kernel.org的列表中和MAINTAINERS文件里
+  找到。
 
 报告bug
 ---
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CIFS] Add in some missing flags and cifs README and TODO corrections

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75865f8cc8b38c30c3923b74de4b29a00cc4c0e4
Commit: 75865f8cc8b38c30c3923b74de4b29a00cc4c0e4
Parent: 75154f402ef18e459ff97ddece25656b6c2b329c
Author: Steve French <[EMAIL PROTECTED]>
AuthorDate: Sun Jun 24 18:30:48 2007 +
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Sun Jun 24 18:30:48 2007 +

[CIFS] Add in some missing flags and cifs README and TODO corrections

Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/CHANGES   |5 -
 fs/cifs/README|   25 ++---
 fs/cifs/TODO  |6 ++
 fs/cifs/cifspdu.h |   11 ---
 fs/cifs/connect.c |   53 +
 fs/cifs/file.c|9 +++--
 6 files changed, 80 insertions(+), 29 deletions(-)

diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index a9b6bc5..b4d388d 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -8,7 +8,10 @@ when Unix Extensions were ignored).  This allows users to 
override the
 default uid and gid for files when they are certain that the uids or
 gids on the server do not match those of the client.  Make "sec=none"
 mount override username (so that null user connection is attempted)
-to match what documentation said.
+to match what documentation said. Support for very large reads, over 127K,
+available to some newer servers (such as Samba 3.0.26 and later but
+note that it also requires setting CIFSMaxBufSize at module install
+time to a larger value which may hurt performance in some cases).
 
 Version 1.48
 
diff --git a/fs/cifs/README b/fs/cifs/README
index 4d01697..eb3efd5 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -301,10 +301,21 @@ A partial list of the supported mount options follows:
during the local client kernel build will be used.
If server does not support Unicode, this parameter is
unused.
-  rsizedefault read size (usually 16K)
-  wsizedefault write size (usually 16K, 32K is often better 
over GigE)
-   maximum wsize currently allowed by CIFS is 57344 (14 4096 byte
-   pages)
+  rsizedefault read size (usually 16K). The client currently
+   can not use rsize larger than CIFSMaxBufSize. CIFSMaxBufSize
+   defaults to 16K and may be changed (from 8K to the maximum
+   kmalloc size allowed by your kernel) at module install time
+   for cifs.ko. Setting CIFSMaxBufSize to a very large value
+   will cause cifs to use more memory and may reduce performance
+   in some cases.  To use rsize greater than 127K (the original
+   cifs protocol maximum) also requires that the server support
+   a new Unix Capability flag (for very large read) which some
+   newer servers (e.g. Samba 3.0.26 or later) do. rsize can be
+   set from a minimum of 2048 to a maximum of 130048 (127K or
+   CIFSMaxBufSize, whichever is smaller)
+  wsizedefault write size (default 57344)
+   maximum wsize currently allowed by CIFS is 57344 (fourteen
+   4096 byte pages)
   rw   mount the network share read-write (note that the
server may still consider the share read-only)
   ro   mount network share read-only
@@ -582,10 +593,10 @@ the start of smb requests and responses can be enabled 
via:
 
echo 1 > /proc/fs/cifs/traceSMB
 
-Two other experimental features are under development and to test 
-require enabling CONFIG_CIFS_EXPERIMENTAL
+Two other experimental features are under development. To test these
+requires enabling CONFIG_CIFS_EXPERIMENTAL
 
-   More efficient write operations
+   ipv6 enablement
 
DNOTIFY fcntl: needed for support of directory change 
notification and perhaps later for file leases)
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index 78b620e..d57dc29 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -106,6 +106,12 @@ but recognizes them
 succeed but still return access denied (appears to be Windows 
 server not cifs client problem) and has not been reproduced recently.
 NTFS partitions do not have this problem.
+4) Unix/POSIX capabilities are reset after reconnection, and affect
+a few fields in the tree connection but we do do not know which
+superblocks to apply these changes to.  We should probably walk
+the list of superblocks to set these.  Also need to check the
+flags on the second mount to the same share, and see if we
+can do the same trick that NFS does to remount duplicate shares.
 
 Misc testing to do
 ==
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index d619ca7..802d27d 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -712,6 +712,7 @@ typedef struct smb_com_findclose_req {
 #define REQ_OP

Chinese translation of Documentation/stable_api_nonsense.txt

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=29a68ee73ec6a5510cbf9d803cbf6190b615e276
Commit: 29a68ee73ec6a5510cbf9d803cbf6190b615e276
Parent: 0da1fa0aa2b438aaee6764742d45766d6a9283bc
Author: TripleX <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 22 01:20:36 2007 +0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 16:02:12 2007 -0700

Chinese translation of Documentation/stable_api_nonsense.txt

This is a Chinese translated version of
Documentation/stable_api_nonsense.txt.

From: TripleX <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/zh_CN/stable_api_nonsense.txt |  157 +++
 1 files changed, 157 insertions(+), 0 deletions(-)

diff --git a/Documentation/zh_CN/stable_api_nonsense.txt 
b/Documentation/zh_CN/stable_api_nonsense.txt
new file mode 100644
index 000..c26a27d
--- /dev/null
+++ b/Documentation/zh_CN/stable_api_nonsense.txt
@@ -0,0 +1,157 @@
+Chinese translated version of Documentation/stable_api_nonsense.txt
+
+If you have any comment or update to the content, please contact the
+original document maintainer directly.  However, if you have problem
+communicating in English you can also ask the Chinese maintainer for help.
+Contact the Chinese maintainer, if this translation is outdated or there
+is problem with translation.
+
+Maintainer: Greg Kroah-Hartman <[EMAIL PROTECTED]>
+Chinese maintainer: TripleX Chung <[EMAIL PROTECTED]>
+-
+Documentation/stable_api_nonsense.txt 的中文翻译
+
+如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
+交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
+译存在问题,请联系中文版维护者。
+
+英文版维护者: Greg Kroah-Hartman <[EMAIL PROTECTED]>
+中文版维护者: 钟宇  TripleX Chung <[EMAIL PROTECTED]>
+中文版翻译者: 钟宇  TripleX Chung <[EMAIL PROTECTED]>
+中文版校译者: 李阳  Li Yang <[EMAIL PROTECTED]>
+以下为正文
+-
+
+写作本文档的目的,是为了解释为什么Linux既没有二进制内核接口,也没有稳定
+的内核接口。这里所说的内核接口,是指内核里的接口,而不是内核和用户空间
+的接口。内核到用户空间的接口,是提供给应用程序使用的系统调用,系统调用
+在历史上几乎没有过变化,将来也不会有变化。我有一些老应用程序是在0.9版本
+或者更早版本的内核上编译的,在使用2.6版本内核的Linux发布上依然用得很好
+。用户和应用程序作者可以将这个接口看成是稳定的。
+
+
+执行纲要
+
+
+你也许以为自己想要稳定的内核接口,但是你不清楚你要的实际上不是它。你需
+要的其实是稳定的驱动程序,而你只有将驱动程序放到公版内核的源代码树里,
+才有可能达到这个目的。而且这样做还有很多其它好处,正是因为这些好处使得
+Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选择Linux的原因。
+
+
+入门
+-
+
+只有那些写驱动程序的“怪人”才会担心内核接口的改变,对广大用户来说,既
+看不到内核接口,也不需要去关心它。
+
+首先,我不打算讨论关于任何非GPL许可的内核驱动的法律问题,这些非GPL许可
+的驱动程序包括不公开源代码,隐藏源代码,二进制或者是用源代码包装,或者
+是其它任何形式的不能以GPL许可公开源代码的驱动程序。如果有法律问题,请咨
+询律师,我只是一个程序员,所以我只打算探讨技术问题(不是小看法律问题,
+法律问题很实际,并且需要一直关注)。
+
+既然只谈技术问题,我们就有了下面两个主题:二进制内核接口和稳定的内核源
+代码接口。这两个问题是互相关联的,让我们先解决掉二进制接口的问题。
+
+
+二进制内核接口
+--
+假如我们有一个稳定的内核源代码接口,那么自然而然的,我们就拥有了稳定的
+二进制接口,是这样的吗?错。让我们看看关于Linux内核的几点事实:
+- 取决于所用的C编译器的版本,不同的内核数据结构里的结构体的对齐方
+式会有差别,代码中不同函数的表现形式也不一样(函数是不是被inline编译取
+决于编译器行为)。不同的函数的表现形式并不重要,但是数据结构内部的对齐
+方式很关键。
+- 取决于内核的配置选项,不同的选项会让内核的很多东西发生改变:
+  - 同一个结构体可能包含不同的成员变量
+  - 有的函数可能根本不会被实现(比如编译的时候没有选择SMP支持
+,一些锁函数就会被定义成空函数)。
+  - 内核使用的内存会以不同的方式对齐,这取决于不同的内核配置选
+项。
+- Linux可以在很多的不同体系结构的处理器上运行。在某个体系结构上编
+译好的二进制驱动程序,不可能在另外一个体系结构上正确的运行。
+
+对于一个特定的内核,满足这些条件并不难,使用同一个C编译器和同样的内核配
+置选项来编译驱动程序模块就可以了。这对于给一个特定Linux发布的特定版本提
+供驱动程序,是完全可以满足需求的。但是如果你要给不同发布的不同版本都发
+布一个驱动程序,就需要在每个发布上用不同的内核设置参数都编译一次内核,
+这简直跟噩梦一样。而且还要注意到,每个Linux发布还提供不同的Linux内核,
+这些内核都针对不同的硬件类型进行了优化(有很多种不同的处理器,还有不同
+的内核设置选项)。所以每发布一次驱动程序,都需要提供很多不同版本的内核
+模块。
+
+相信我,如果你真的要采取这种发布方式,一定会慢慢疯掉,我很久以前就有过
+深刻的教训...
+
+
+稳定的内核源代码接口
+
+
+如果有人不将他的内核驱动程序,放入公版内核的源代码树,而又想让驱动程序
+一直保持在最新的内核中可用,那么这个话题将会变得没完没了。
+ 内核开发是持续而且快节奏的,从来都不会慢下来。内核开发人员在当前接口中
+找到bug,或者找到更好的实现方式。一旦发现这些,他们就很快会去修改当前的
+接口。修改接口意味着,函数名可能会改变,结构体可能被扩充或者删减,函数
+的参数也可能发生改变。一旦接口被修改,内核中使用这些接口的地方需要同时
+修正,这样才能保证所有的东西继续工作。
+
+举一个例子,内核的USB驱动程序接口在USB子系统的整个生命周期中,至少经历
+了三次重写。这些重写解决以下问题:
+- 把数据流从同步模式改成非同步模式,这个改动减少了一些驱动程序的
+复杂度,提高了所有USB驱动程序的吞吐率,这样几乎所有的USB设备都能以最大
+速率工作了。
+- 修改了USB核心代码中为USB驱动分配数据包内存的方式,所有的驱动都
+需要提供更多的参数给USB核心,以修正了很多已经被记录在案的死锁。
+
+这和一些封闭源代码的操作系统形成鲜明的对比,在那些操作系统上,不得不额
+外的维护旧的USB接口。这导致了一个可能性,新的开发者依然会不小心使用旧的
+接口,以不恰当的方式编写代码,进而影响到操作系统的稳定性。
+ 在上面的例子中,所有的开发者都同意这些重要的改动,在这样的情况下修改代
+价很低。如果Linux保持一个稳定的内核源代码接口,那么就得创建一个新的接口
+;旧的,有问题的接口必须一直维护,给Linux USB开发者带来额外的工作。既然
+所有的Linux USB驱动的作者都是利用自己的时间工作,那么要求他们去做毫无意
+义的免费额外工作,是不可能的。
+ 安全问题对Linux来说十分重要。一个安全问题被发现,就会在短时间内得到修
+正。在很多情况下,这将导致Linux内核中的一些接口被重写,以从根本上避免安
+全问题。一旦接口被重写,所有使用这些接口的驱动程序,必须同时得到修正,
+以确定安全问题已经得到修复并且不可能在未来还有同样的安全问题。如果内核
+内部接口不允许改变,那么就不可能修复这样的安全问题,也不可能确认这样的
+安全问题以后不会发生。
+开发者一直在清理内核接口。如果一个接口没有人在使用了,它就会被删除。这
+样可以确保内核尽可能的小,而且所有潜在的接口都会得到尽可能完整的测试
+(没有人使用的接口是不可能得到良好的测试的)。
+
+
+要做什么
+---
+
+如果你写了一个Linux内核驱动,但是它还不在Linux源代码树里,作为一个开发
+者,你应该怎么做?为每个发布的每个版本提供一个二进制驱动,那简直是一个
+噩梦,要跟上永远处于变化之中的内核接口,也是一件辛苦活。
+很简单,让你的驱动进入内核源代码树(要记得我们在谈论的是以GPL许可发行
+的驱动,如果你的代码不符合GPL,那么祝你好运,你只能自己解决这个问题了,
+你这个吸血鬼<把Andrew和Linus对吸血鬼的定义链接到这里>)。当你的代码加入
+公版内核源代码树之后,如果一个内核接口改变,你的驱动会直接被修

Documentation: add Japanese translated stable_api_nonsense.txt

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5d329e6bb513323bde40668a31e1d734a16eb7b2
Commit: 5d329e6bb513323bde40668a31e1d734a16eb7b2
Parent: 73fd625371db08377b7053816c7e486b9bffc18d
Author: IKEDA, Munehiro <[EMAIL PROTECTED]>
AuthorDate: Tue Jun 12 09:46:04 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 16:02:12 2007 -0700

Documentation: add Japanese translated stable_api_nonsense.txt

Signed-off-by: IKEDA, Munehiro <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/ja_JP/stable_api_nonsense.txt |  263 +++
 1 files changed, 263 insertions(+), 0 deletions(-)

diff --git a/Documentation/ja_JP/stable_api_nonsense.txt 
b/Documentation/ja_JP/stable_api_nonsense.txt
new file mode 100644
index 000..b3f2b27
--- /dev/null
+++ b/Documentation/ja_JP/stable_api_nonsense.txt
@@ -0,0 +1,263 @@
+NOTE:
+This is a Japanese translated version of
+"Documentation/stable_api_nonsense.txt".
+This one is maintained by
+IKEDA, Munehiro <[EMAIL PROTECTED]>
+and JF Project team .
+If you find difference with original file or problem in translation,
+please contact the maintainer of this file or JF project.
+
+Please also note that purpose of this file is easier to read for non
+English natives and not to be intended to fork. So, if you have any
+comments or updates of this file, please try to update
+Original(English) file at first.
+
+==
+これは、
+linux-2.6.22-rc4/Documentation/stable_api_nonsense.txt の和訳
+です。
+翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
+翻訳日 : 2007/06/11
+原著作者: Greg Kroah-Hartman < greg at kroah dot com >
+翻訳者 : 池田 宗広 < m-ikeda at ds dot jp dot nec dot com >
+校正者 : Masanori Kobayashi さん < zap03216 at nifty dot ne dot jp >
+  Seiji Kaneko さん < skaneko at a2 dot mbn dot or dot jp >
+==
+
+
+
+Linux カーネルのドライバインターフェース
+(あなたの質問すべてに対する回答とその他諸々)
+
+Greg Kroah-Hartman 
+
+
+この文書は、なぜ Linux ではバイナリカーネルインターフェースが定義
+されていないのか、またはなぜ不変のカーネルインターフェースを持たな
+いのか、ということを説明するために書かれた。ここでの話題は「カーネ
+ル内部の」インターフェースについてであり、ユーザー空間とのインター
+フェースではないことを理解してほしい。カーネルとユーザー空間とのイ
+ンターフェースとはアプリケーションプログラムが使用するものであり、
+つまりシステムコールのインターフェースがこれに当たる。これは今まで
+長きに渡り、かつ今後も「まさしく」不変である。私は確か 0.9 か何か
+より前のカーネルを使ってビルドした古いプログラムを持っているが、そ
+れは最新の 2.6 カーネルでもきちんと動作する。ユーザー空間とのイン
+ターフェースは、ユーザーとアプリケーションプログラマが不変性を信頼
+してよいものの一つである。
+
+
+要旨
+
+
+あなたは不変のカーネルインターフェースが必要だと考えているかもしれ
+ないが、実際のところはそうではない。あなたは必要としているものが分
+かっていない。あなたが必要としているものは安定して動作するドライバ
+であり、それはドライバがメインのカーネルツリーに含まれる場合のみ得
+ることができる。ドライバがメインのカーネルツリーに含まれていると、
+他にも多くの良いことがある。それは、Linux をより強固で、安定な、成
+熟したオペレーティングシステムにすることができるということだ。これ
+こそ、そもそもあなたが Linux を使う理由のはずだ。
+
+
+はじめに
+
+
+カーネル内部のインターフェース変更を心配しなければならないドライバ
+を書きたいなどというのは、変わり者だけだ。この世界のほとんどの人は、
+そのようなドライバがどんなインターフェースを使っているかなど知らな
+いし、そんなドライバのことなど全く気にもかけていない。
+
+
+まず初めに、クローズソースとか、ソースコードの隠蔽とか、バイナリの
+みが配布される使い物にならない代物[訳注(1)]とか、実体はバイナリ
+コードでそれを読み込むためのラッパー部分のみソースコードが公開され
+ているとか、その他用語は何であれ GPL の下にソースコードがリリース
+されていないカーネルドライバに関する法的な問題について、私は「いか
+なる議論も」行うつもりがない。法的な疑問があるのならば、プログラマ
+である私ではなく、弁護士に相談して欲しい。ここでは単に、技術的な問
+題について述べることにする。(法的な問題を軽視しているわけではない。
+それらは実際に存在するし、あなたはそれをいつも気にかけておく必要が
+ある)
+
+訳注(1)
+「使い物にならない代物」の原文は "blob"
+
+
+さてここでは、バイナリカーネルインターフェースについてと、ソースレ
+ベルでのインターフェースの不変性について、という二つの話題を取り上
+げる。この二つは互いに依存する関係にあるが、まずはバイナリインター
+フェースについて議論を行いやっつけてしまおう。
+
+
+バイナリカーネルインターフェース
+
+
+もしソースレベルでのインターフェースが不変ならば、バイナリインター
+フェースも当然のように不変である、というのは正しいだろうか?正しく
+ない。Linux カーネルに関する以下の事実を考えてみてほしい。
+  - あなたが使用するCコンパイラのバージョンによって、カーネル内部
+の構造体の配置構造は異なったものになる。また、関数は異なった方
+法でカーネルに含まれることになるかもしれない(例えばインライン
+関数として扱われたり、扱われなかったりする)。個々の関数がどの
+ようにコンパイルされるかはそれほど重要ではないが、構造体のパデ
+ィングが異なるというのは非常に重要である。
+  - あなたがカーネルのビルドオプションをどのように設定するかによっ
+て、カーネルには広い範囲で異なった事態が起こり得る。
+  - データ構造は異なるデータフィールドを持つかもしれない
+  - いくつかの関数は全く実装されていない状態になり得る
+(例:SMP向けではないビルドでは、いくつかのロックは中身が
+  カラにコンパイルされる)
+  - カーネル内のメモリは、異なった方法で配置され得る。これはビ
+ルドオプションに依存している。
+  - Linux は様々な異なるプロセッサアーキテクチャ上で動作する。
+あるアーキテクチャ用のバイナリドライバを、他のアーキテクチャで
+正常に動作させる方法はない。
+
+
+ある特定のカーネル設定を使用し、カーネルをビルドしたのと正確に同じ
+Cコンパイラを使用して単にカーネルモジュールをコンパイルするだけで
+も、あなたはこれらいくつもの問題に直面することになる。ある特定の
+Linux ディストリビューションの、ある特定のリリースバージョン用にモ
+ジュールを提供しようと思っただけでも、これらの問題を引き起こすには
+十分である。にも関わらず Linux ディストリビューションの数と、サ
+ポートするディストリビューションのリリース数を掛け算し、それら一つ
+一つについてビルドを行ったとしたら、今度はリリースごとのビルドオプ
+ションの違いという悪夢にすぐさま悩まされることになる。また、ディス
+トリビューションの各リリースバージョンには、異なるハードウェア(プ
+ロセッサタイプや種々のオプション)に対応するため、何種類かのカーネ
+ルが含まれているということも理解して欲しい。従って、ある一つのリ
+リースバージョンだけのためにモジュールを作成する場合でも、あなたは
+何バージョンものモジュールを用意しなければならない。
+
+
+信じて欲しい。このような方法でサポートを続けようとするなら、あなた
+はいずれ正気を失うだろう。遠い昔、私はそれがいかに困難なことか、身
+をもって学んだのだ・・・
+
+
+不変のカーネルソースレベルインターフェース
+--
+
+メインカーネルツリーに含まれていない Linux カーネルドライバを継続
+してサポートしていこうとしている人たちとの議論においては、これは極
+めて「引火性の高い」話題である。[訳注(2)]
+
+訳注(2)
+「引火性の高い」の原文は "volatile"。
+volatile には「揮発性の」「爆発しやすい」という意味の他、「変わり
+やすい」「移り気

HOWTO: add Chinese translation of Documentation/HOWTO

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0da1fa0aa2b438aaee6764742d45766d6a9283bc
Commit: 0da1fa0aa2b438aaee6764742d45766d6a9283bc
Parent: 5d329e6bb513323bde40668a31e1d734a16eb7b2
Author: Li Yang <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 21 22:40:17 2007 +0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 16:02:12 2007 -0700

HOWTO: add Chinese translation of Documentation/HOWTO

This is a Chinese translated version of Documentation/HOWTO.  Currently
Chinese involvement in Linux kernel is very low, especially comparing to
its largest population base.  Language could be the main obstacle.  Hope
this document will help more Chinese to contribute to Linux kernel.

Signed-off-by: Li Yang <[EMAIL PROTECTED]>
Signed-off-by: TripleX Chung <[EMAIL PROTECTED]>
Signed-off-by: Maggie Chen <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/zh_CN/HOWTO |  536 +
 1 files changed, 536 insertions(+), 0 deletions(-)

diff --git a/Documentation/zh_CN/HOWTO b/Documentation/zh_CN/HOWTO
new file mode 100644
index 000..239f454
--- /dev/null
+++ b/Documentation/zh_CN/HOWTO
@@ -0,0 +1,536 @@
+Chinese translated version of Documentation/HOWTO
+
+If you have any comment or update to the content, please contact the
+original document maintainer directly.  However, if you have problem
+communicating in English you can also ask the Chinese maintainer for
+help.  Contact the Chinese maintainer, if this translation is outdated
+or there is problem with translation.
+
+Maintainer: Greg Kroah-Hartman <[EMAIL PROTECTED]>
+Chinese maintainer: Li Yang <[EMAIL PROTECTED]>
+-
+Documentation/HOWTO 的中文翻译
+
+如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
+交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
+译存在问题,请联系中文版维护者。
+
+英文版维护者: Greg Kroah-Hartman <[EMAIL PROTECTED]>
+中文版维护者: 李阳  Li Yang <[EMAIL PROTECTED]>
+中文版翻译者: 李阳  Li Yang <[EMAIL PROTECTED]>
+中文版校译者: 钟宇  TripleX Chung <[EMAIL PROTECTED]>
+   陈琦  Maggie Chen <[EMAIL PROTECTED]>
+   王聪  Wang Cong <[EMAIL PROTECTED]>
+
+以下为正文
+-
+
+如何参与Linux内核开发
+-
+
+这是一篇将如何参与Linux内核开发的相关问题一网打尽的终极秘笈。它将指导你
+成为一名Linux内核开发者,并且学会如何同Linux内核开发社区合作。它尽可能不
+包括任何关于内核编程的技术细节,但会给你指引一条获得这些知识的正确途径。
+
+如果这篇文章中的任何内容不再适用,请给文末列出的文件维护者发送补丁。
+
+
+入门
+
+
+你想了解如何成为一名Linux内核开发者?或者老板吩咐你“给这个设备写个Linux
+驱动程序”?这篇文章的目的就是教会你达成这些目标的全部诀窍,它将描述你需
+要经过的流程以及给出如何同内核社区合作的一些提示。它还将试图解释内核社区
+为何这样运作。
+
+Linux内核大部分是由C语言写成的,一些体系结构相关的代码用到了汇编语言。要
+参与内核开发,你必须精通C语言。除非你想为某个架构开发底层代码,否则你并
+不需要了解(任何体系结构的)汇编语言。下面列举的书籍虽然不能替代扎实的C
+语言教育和多年的开发经验,但如果需要的话,做为参考还是不错的:
+ - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
+   《C程序设计语言(第2版·新版)》(徐宝文 李志 译)[机械工业出版社]
+ - "Practical C Programming" by Steve Oualline [O'Reilly]
+   《实用C语言编程(第三版)》(郭大海 译)[中国电力出版社]
+ - "C:  A Reference Manual" by Harbison and Steele [Prentice Hall]
+   《C语言参考手册(原书第5版)》(邱仲潘 等译)[机械工业出版社]
+
+Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C89标准,但也用到了一些
+标准中没有定义的扩展。内核是自给自足的C环境,不依赖于标准C库的支持,所以
+并不支持C标准中的部分定义。比如long long类型的大数除法和浮点运算就不允许
+使用。有时候确实很难弄清楚内核对工具链的要求和它所使用的扩展,不幸的是目
+前还没有明确的参考资料可以解释它们。请查阅gcc信息页(使用“info gcc”命令
+显示)获得一些这方面信息。
+
+请记住你是在学习怎么和已经存在的开发社区打交道。它由一群形形色色的人组成,
+他们对代码、风格和过程有着很高的标准。这些标准是在长期实践中总结出来的,
+适应于地理上分散的大型开发团队。它们已经被很好得整理成档,建议你在开发
+之前尽可能多的学习这些标准,而不要期望别人来适应你或者你公司的行为方式。
+
+
+法律问题
+
+
+Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的。要了解这种许可
+的细节请查看源代码主目录下的COPYING文件。如果你对它还有更深入问题请联系
+律师,而不要在Linux内核邮件组上提问。因为邮件组里的人并不是律师,不要期
+望他们的话有法律效力。
+
+对于GPL的常见问题和解答,请访问以下链接:
+   http://www.gnu.org/licenses/gpl-faq.html
+
+
+文档
+
+
+Linux内核代码中包含有大量的文档。这些文档对于学习如何与内核社区互动有着
+不可估量的价值。当一个新的功能被加入内核,最好把解释如何使用这个功能的文
+档也放进内核。当内核的改动导致面向用户空间的接口发生变化时,最好将相关信
+息或手册页(manpages)[EMAIL PROTECTED](manpages)
+的维护者解释这些变化。
+
+以下是内核代码中需要阅读的文档:
+  README
+文件简要介绍了Linux内核的背景,并且描述了如何配置和编译内核。内核的
+新用户应该从这里开始。
+
+  Documentation/Changes
+文件给出了用来编译和使用内核所需要的最小软件包列表。
+
+  Documentation/CodingStyle
+描述Linux内核的代码风格和理由。所有新代码需要遵守这篇文档中定义的规
+范。大多数维护者只会接收符合规定的补丁,很多人也只会帮忙检查符合风格
+的代码。
+
+  Documentation/SubmittingPatches
+  Documentation/SubmittingDrivers
+这两份文档明确描述如何创建和发送补丁,其中包括(但不仅限于):
+   - 邮件内容
+   - 邮件格式
+   - 选择收件人
+遵守这些规定并不能保证提交成功(因为所有补丁需要通过严格的内容和风格
+审查),但是忽视他们几乎就意味着失败。
+
+其他关于如何正确地生成补丁的优秀文档包括:
+"The Perfect Patch"
+http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
+"Linux kernel patch submission format"
+http://linux.yyz.us/patch-format.html
+
+  Documentation/stable_api_nonsense.txt
+论证内核为什么特意不包括稳定的内核内部API,也就是说不包括像这样的特
+性:
+   - 子系统中间层(为了兼容性?)
+   - 在不同操作系统间易于移植的驱动程序
+   - 减缓(甚至阻止)内核代码的快速变化
+这篇文档对于理解Linux的开发哲学至关重要。对于将开发平台从其他操作系
+统转移到Linux的人来说也很重要。
+
+  Documentation/SecurityBugs
+如果你认为自己发现了Linux内核的

HOWTO: add Japanese translation of Documentation/HOWTO

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=73fd625371db08377b7053816c7e486b9bffc18d
Commit: 73fd625371db08377b7053816c7e486b9bffc18d
Parent: 5bae7ac9feba925fd0099057f6b23d7be80b7b41
Author: Tsugikazu Shibata <[EMAIL PROTECTED]>
AuthorDate: Tue Jun 12 17:16:12 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 16:02:11 2007 -0700

HOWTO: add Japanese translation of Documentation/HOWTO

Add the japanese translation of the Documentation/HOWTO file.

Signed-off-by: Tsugikazu Shibata <[EMAIL PROTECTED]>
Cc: IKEDA Munehiro <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/ja_JP/HOWTO |  650 +
 1 files changed, 650 insertions(+), 0 deletions(-)

diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO
new file mode 100644
index 000..b2446a0
--- /dev/null
+++ b/Documentation/ja_JP/HOWTO
@@ -0,0 +1,650 @@
+NOTE:
+This is Japanese translated version of "Documentation/HOWTO".
+This one is maintained by Tsugikazu Shibata <[EMAIL PROTECTED]>
+and JF Project team .
+If you find difference with original file or problem in translation,
+please contact maintainer of this file or JF project.
+
+Please also note that purpose of this file is easier to read for non
+English natives and not to be intended to fork. So, if you have any
+comments or updates of this file, please try to update Original(English)
+file at first.
+
+Last Updated: 2007/06/04
+==
+これは、
+linux-2.6.21/Documentation/HOWTO
+の和訳です。
+
+翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
+翻訳日: 2007/06/04
+翻訳者: Tsugikazu Shibata 
+校正者: 松倉さん 
+ 小林 雅典さん (Masanori Kobayasi) 
+ 武井伸光さん、
+ かねこさん (Seiji Kaneko) 
+ 野口さん (Kenji Noguchi) 
+ 河内さん (Takayoshi Kochi) 
+ 岩本さん (iwamoto) 
+==
+
+Linux カーネル開発のやり方
+---
+
+これは上のトピック( Linux カーネル開発のやり方)の重要な事柄を網羅した
+ドキュメントです。ここには Linux カーネル開発者になるための方法と
+Linux カーネル開発コミュニティと共に活動するやり方を学ぶ方法が含まれて
+います。カーネルプログラミングに関する技術的な項目に関することは何も含
+めないようにしていますが、カーネル開発者となるための正しい方向に向かう
+手助けになります。
+
+もし、このドキュメントのどこかが古くなっていた場合には、このドキュメン
+トの最後にリストしたメンテナーにパッチを送ってください。
+
+はじめに
+-
+
+あなたは Linux カーネルの開発者になる方法を学びたいのでしょうか? そ
+れともあなたは上司から「このデバイスの Linux ドライバを書くように」と
+言われているのでしょうか? 
+この文書の目的は、あなたが踏むべき手順と、コミュニティと一緒にうまく働
+くヒントを書き下すことで、あなたが知るべき全てのことを教えることです。
+また、このコミュニティがなぜ今うまくまわっているのかという理由の一部も
+説明しようと試みています。
+
+カーネルは 少量のアーキテクチャ依存部分がアセンブリ言語で書かれている
+以外は大部分は C 言語で書かれています。C言語をよく理解していることはカー
+ネル開発者には必要です。アーキテクチャ向けの低レベル部分の開発をするの
+でなければ、(どんなアーキテクチャでも)アセンブリ(訳注: 言語)は必要あり
+ません。以下の本は、C 言語の十分な知識や何年もの経験に取って代わるもの
+ではありませんが、少なくともリファレンスとしてはいい本です。
+ - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
+ -『プログラミング言語C第2版』(B.W. カーニハン/D.M. リッチー著 石田晴久訳) [共立出版]
+ - "Practical C Programming" by Steve Oualline [O'Reilly]
+ - 『C実践プログラミング第3版』(Steve Oualline著 望月康司監訳 谷口功訳) [オライリージャパン]
+ - "C:  A Reference Manual" by Harbison and Steele [Prentice Hall]
+ - 『新・詳説 C 言語 H&S リファレンス』
+   (サミュエル P ハービソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトバンク]
+
+カーネルは GNU C と GNU ツールチェインを使って書かれています。カーネル
+は ISO C89 仕様に準拠して書く一方で、標準には無い言語拡張を多く使って
+います。カーネルは標準 C ライブラリとは関係がないといった、C 言語フリー
+スタンディング環境です。そのため、C の標準で使えないものもあります。任
+意の long long の除算や浮動小数点は使えません。
+ときどき、カーネルがツールチェインや C 言語拡張に置いている前提がどう
+なっているのかわかりにくいことがあり、また、残念なことに決定的なリファ
+レンスは存在しません。情報を得るには、gcc の info ページ( info gcc )を
+みてください。
+
+あなたは既存の開発コミュニティと一緒に作業する方法を学ぼうとしているこ
+とに留意してください。そのコミュニティは、コーディング、スタイル、
+開発手順について高度な標準を持つ、多様な人の集まりです。
+地理的に分散した大規模なチームに対してもっともうまくいくとわかったこと
+をベースにしながら、これらの標準は長い時間をかけて築かれてきました。
+これらはきちんと文書化されていますから、事前にこれらの標準についてでき
+るだけたくさん学んでください。また皆があなたやあなたの会社のやり方に合わ
+せてくれると思わないでください。
+
+法的問題
+
+
+Linux カーネルのソースコードは GPL ライセンスの下でリリースされていま
+す。ライセンスの詳細については、ソースツリーのメインディレクトリに存在
+する、COPYING のファイルをみてください。もしライセンスについてさらに質
+問があれば、Linux Kernel メーリングリストに質問するのではなく、どうぞ
+法律家に相談してください。メーリングリストの人達は法律家ではなく、法的
+問題については彼らの声明はあてにするべきではありません。
+
+GPL に関する共通の質問や回答については、以下を参照してください。
+   http://www.gnu.org/licenses/gpl-faq.html
+
+ドキュメント
+
+
+Linux カーネルソースツリーは幅広い範囲のドキュメントを含んでおり、それ
+らはカーネルコミュニティと会話する方法を学ぶのに非常に貴重なものです。
+新しい機能がカーネルに追加される場合、その機能の使い方について説明した
+新しいドキュメントファイルも追加することを勧めます。
+カーネルの変更が、カーネルがユーザ空間に公開しているインターフェイスの
+変更を引き起こす場合、その変更を説明するマニュアルページのパッチや情報
+をマニュアルページのメンテナ [EMAIL PROTECTED] に送ることを勧めます。
+
+以下はカーネルソースツリーに含まれている読んでおくべきファイルの一覧で
+す-
+
+  README
+このファイルは Linuxカーネルの簡単な背景とカーネルを設定(訳注
+configure )し、生成(訳注 build )するために必要なことは何かが書かれ
+ています。カーネルに関して初めての人はここからスタートするとよいで
+しょう。
+
+  Documentation/Changes
+ このファイルはカーネルをうまく生成(訳注 build )し、走らせるのに最
+ 小限のレベルで必要な数々のソフトウェアパッケージの一覧を示してい
+ ます。
+
+  Documentation/CodingStyle
+これは Linux カーネルのコーディングスタイルと背景にある理由を記述
+しています。全ての新しいコードはこのドキュメントにあるガイドライン
+に従っていることを期待されています。大部分のメンテナーはこれらのルー
+ルに従っているものだけを受け付け、多くの人は正しいスタイルのコード
+だけをレビューします。
+
+  Documentation/SubmittingPatches
+  Documentation/SubmittingDrivers
+ 

sysfs: kill an extra put in sysfs_create_link() failure path

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a1da4dfe35bc36c3bc9716d995c85b7983c38a76
Commit: a1da4dfe35bc36c3bc9716d995c85b7983c38a76
Parent: 2ee97caf0a6602f749ddbfdb1449e383e1212707
Author: Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 16:14:45 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:50 2007 -0700

sysfs: kill an extra put in sysfs_create_link() failure path

There is a subtle bug in sysfs_create_link() failure path.  When
symlink creation fails because there's already a node with the same
name, the target sysfs_dirent is put twice - once by failure path of
sysfs_create_link() and once more when the symlink is released.

Fix it by making only the symlink node responsible for putting
target_sd.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Gabriel C <[EMAIL PROTECTED]>
Cc: Miles Lane <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 fs/sysfs/symlink.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index 2f86e04..d056e96 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -86,7 +86,9 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * 
target, const char
sd = sysfs_new_dirent(name, S_IFLNK|S_IRWXUGO, SYSFS_KOBJ_LINK);
if (!sd)
goto out_put;
+
sd->s_elem.symlink.target_sd = target_sd;
+   target_sd = NULL;   /* reference is now owned by the symlink */
 
sysfs_addrm_start(&acxt, parent_sd);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sysfs: cosmetic clean up on node creation failure paths

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=967e35dcc9ac194b4a6fad69a5a51f93d69bb0d1
Commit: 967e35dcc9ac194b4a6fad69a5a51f93d69bb0d1
Parent: a1da4dfe35bc36c3bc9716d995c85b7983c38a76
Author: Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 16:38:11 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:50 2007 -0700

sysfs: cosmetic clean up on node creation failure paths

Node addition failure is detected by testing return value of
sysfs_addfm_finish() which returns the number of added and removed
nodes.  As the function is called as the last step of addition right
on top of error handling block, the if blocks looked like the
following.

if (sysfs_addrm_finish(&acxt))
success handling, usually return;
/* fall through to error handling */

This is the opposite of usual convention in sysfs and makes the code
difficult to understand.  This patch inverts the test and makes those
blocks look more like others.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Gabriel C <[EMAIL PROTECTED]>
Cc: Miles Lane <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 fs/sysfs/dir.c |   12 +++-
 fs/sysfs/file.c|9 +
 fs/sysfs/symlink.c |   10 ++
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 2e6775a..048e605 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -699,17 +699,19 @@ static int create_dir(struct kobject *kobj, struct 
sysfs_dirent *parent_sd,
 
/* link in */
sysfs_addrm_start(&acxt, parent_sd);
+
if (!sysfs_find_dirent(parent_sd, name)) {
sysfs_add_one(&acxt, sd);
sysfs_link_sibling(sd);
}
-   if (sysfs_addrm_finish(&acxt)) {
-   *p_sd = sd;
-   return 0;
+
+   if (!sysfs_addrm_finish(&acxt)) {
+   sysfs_put(sd);
+   return -EEXIST;
}
 
-   sysfs_put(sd);
-   return -EEXIST;
+   *p_sd = sd;
+   return 0;
 }
 
 int sysfs_create_subdir(struct kobject *kobj, const char *name,
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index cc49799..3e1cc06 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -410,11 +410,12 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const 
struct attribute *attr,
sysfs_link_sibling(sd);
}
 
-   if (sysfs_addrm_finish(&acxt))
-   return 0;
+   if (!sysfs_addrm_finish(&acxt)) {
+   sysfs_put(sd);
+   return -EEXIST;
+   }
 
-   sysfs_put(sd);
-   return -EEXIST;
+   return 0;
 }
 
 
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index d056e96..4ce687f 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -97,11 +97,13 @@ int sysfs_create_link(struct kobject * kobj, struct kobject 
* target, const char
sysfs_link_sibling(sd);
}
 
-   if (sysfs_addrm_finish(&acxt))
-   return 0;
+   if (!sysfs_addrm_finish(&acxt)) {
+   error = -EEXIST;
+   goto out_put;
+   }
+
+   return 0;
 
-   error = -EEXIST;
-   /* fall through */
  out_put:
sysfs_put(target_sd);
sysfs_put(sd);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Driver core: check return code of sysfs_create_link()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ee97caf0a6602f749ddbfdb1449e383e1212707
Commit: 2ee97caf0a6602f749ddbfdb1449e383e1212707
Parent: be3884943674f8ee7656b1d8b71c087ec900c836
Author: Cornelia Huck <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 01:43:47 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:50 2007 -0700

Driver core: check return code of sysfs_create_link()

Check for return value of sysfs_create_link() in device_add() and
device_rename().  Add helper functions device_add_class_symlinks() and
device_remove_class_symlinks() to make the code easier to read.

[EMAIL PROTECTED]: fix unused var warnings]

Signed-off-by: Cornelia Huck <[EMAIL PROTECTED]>
Acked-by: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/base/core.c |  145 +--
 1 files changed, 105 insertions(+), 40 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 91a0367..3599ab2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -660,6 +660,82 @@ static int setup_parent(struct device *dev, struct device 
*parent)
return 0;
 }
 
+static int device_add_class_symlinks(struct device *dev)
+{
+   int error;
+
+   if (!dev->class)
+   return 0;
+   error = sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj,
+ "subsystem");
+   if (error)
+   goto out;
+   /*
+* If this is not a "fake" compatible device, then create the
+* symlink from the class to the device.
+*/
+   if (dev->kobj.parent != &dev->class->subsys.kobj) {
+   error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
+ dev->bus_id);
+   if (error)
+   goto out_subsys;
+   }
+   /* only bus-device parents get a "device"-link */
+   if (dev->parent && dev->parent->bus) {
+   error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
+ "device");
+   if (error)
+   goto out_busid;
+#ifdef CONFIG_SYSFS_DEPRECATED
+   {
+   char * class_name = make_class_name(dev->class->name,
+   &dev->kobj);
+   if (class_name)
+   error = sysfs_create_link(&dev->parent->kobj,
+   &dev->kobj, class_name);
+   kfree(class_name);
+   if (error)
+   goto out_device;
+   }
+#endif
+   }
+   return 0;
+
+#ifdef CONFIG_SYSFS_DEPRECATED
+out_device:
+   if (dev->parent)
+   sysfs_remove_link(&dev->kobj, "device");
+#endif
+out_busid:
+   if (dev->kobj.parent != &dev->class->subsys.kobj)
+   sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
+out_subsys:
+   sysfs_remove_link(&dev->kobj, "subsystem");
+out:
+   return error;
+}
+
+static void device_remove_class_symlinks(struct device *dev)
+{
+   if (!dev->class)
+   return;
+   if (dev->parent) {
+#ifdef CONFIG_SYSFS_DEPRECATED
+   char *class_name;
+
+   class_name = make_class_name(dev->class->name, &dev->kobj);
+   if (class_name) {
+   sysfs_remove_link(&dev->parent->kobj, class_name);
+   kfree(class_name);
+   }
+#endif
+   sysfs_remove_link(&dev->kobj, "device");
+   }
+   if (dev->kobj.parent != &dev->class->subsys.kobj)
+   sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
+   sysfs_remove_link(&dev->kobj, "subsystem");
+}
+
 /**
  * device_add - add device to device hierarchy.
  * @dev:   device.
@@ -674,7 +750,6 @@ static int setup_parent(struct device *dev, struct device 
*parent)
 int device_add(struct device *dev)
 {
struct device *parent = NULL;
-   char *class_name = NULL;
struct class_interface *class_intf;
int error = -EINVAL;
 
@@ -714,27 +789,9 @@ int device_add(struct device *dev)
goto ueventattrError;
}
 
-   if (dev->class) {
-   sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj,
- "subsystem");
-   /* If this is not a "fake" compatible device, then create the
-* symlink from the class to the device. */
-   if (dev->kobj.parent != &dev->class->subsys.kobj)
-   sysfs_create_link(&dev->class->subsys.kobj,
- &dev->kobj, dev->bu

dev_vdbg() documentation

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6b09448ab81e90e59c09cfbc6d0d612dc84a2b1d
Commit: 6b09448ab81e90e59c09cfbc6d0d612dc84a2b1d
Parent: aebdc3b450a3febf7d7d00cd2235509055ec7082
Author: David Brownell <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 13 16:32:09 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:50 2007 -0700

dev_vdbg() documentation

Update CodingStyle to talk about "-DDEBUG" message conventions and the
new "-DVERBOSE_DEBUG" convention.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/CodingStyle |   20 ++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index a667eb1..7f1730f 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -633,12 +633,27 @@ covers RTL which is used frequently with assembly 
language in the kernel.
 
 Kernel developers like to be seen as literate. Do mind the spelling
 of kernel messages to make a good impression. Do not use crippled
-words like "dont" and use "do not" or "don't" instead.
+words like "dont"; use "do not" or "don't" instead.  Make the messages
+concise, clear, and unambiguous.
 
 Kernel messages do not have to be terminated with a period.
 
 Printing numbers in parentheses (%d) adds no value and should be avoided.
 
+There are a number of driver model diagnostic macros in 
+which you should use to make sure messages are matched to the right device
+and driver, and are tagged with the right level:  dev_err(), dev_warn(),
+dev_info(), and so forth.  For messages that aren't associated with a
+particular device,  defines pr_debug() and pr_info().
+
+Coming up with good debugging messages can be quite a challenge; and once
+you have them, they can be a huge help for remote troubleshooting.  Such
+messages should be compiled out when the DEBUG symbol is not defined (that
+is, by default they are not included).  When you use dev_dbg() or pr_debug(),
+that's automatic.  Many subsystems have Kconfig options to turn on -DDEBUG.
+A related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the
+ones already enabled by DEBUG.
+
 
Chapter 14: Allocating memory
 
@@ -790,4 +805,5 @@ Kernel CodingStyle, by [EMAIL PROTECTED] at OLS 2002:
 http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/
 
 --
-Last updated on 2006-December-06.
+Last updated on 2007-July-13.
+
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


HOWTO: Add the knwon_regression URI to the documentation

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be3884943674f8ee7656b1d8b71c087ec900c836
Commit: be3884943674f8ee7656b1d8b71c087ec900c836
Parent: 6b09448ab81e90e59c09cfbc6d0d612dc84a2b1d
Author: Paolo Ciarrocchi <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 16 23:55:05 2007 +0200
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:50 2007 -0700

HOWTO: Add the knwon_regression URI to the documentation

We should let everybody know about where the regression
list is hosted. The more is known the more it is used.

Signed-off-by: Paolo Ciarrocchi <[EMAIL PROTECTED]>
Cc: Li Yang <[EMAIL PROTECTED]>
Cc: TripleX Chung <[EMAIL PROTECTED]>
Cc: Maggie Chen <[EMAIL PROTECTED]>
Cc: WANG Cong <[EMAIL PROTECTED]>
Cc: Tsugikazu Shibata <[EMAIL PROTECTED]>
Cc: IKEDA Munehiro <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/HOWTO |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index 98e2701..f8cc3f8 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -249,6 +249,9 @@ process is as follows:
 release a new -rc kernel every week.
   - Process continues until the kernel is considered "ready", the
 process should last around 6 weeks.
+  - A list of known regressions present in each -rc release is
+tracked at the following URI:
+http://kernelnewbies.org/known_regressions
 
 It is worth mentioning what Andrew Morton wrote on the linux-kernel
 mailing list about kernel releases:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sysfs: make sysfs_init_inode() static

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bc37e2830339cbfa42ac8579a7bf62fc4cdd360d
Commit: bc37e2830339cbfa42ac8579a7bf62fc4cdd360d
Parent: e080e436f605877e47e4950f5386ed843badbb1b
Author: Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 14:30:28 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

sysfs: make sysfs_init_inode() static

With sysfs_fill_super() converted to use sysfs_get_inode(), there is
no user of sysfs_init_inode() outside of fs/sysfs/inode.c.  Make it
static.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Acked-by: Jean Delvare <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 fs/sysfs/inode.c |2 +-
 fs/sysfs/sysfs.h |1 -
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 3756e15..10d1b52 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -133,7 +133,7 @@ static inline void set_inode_attr(struct inode * inode, 
struct iattr * iattr)
  */
 static struct lock_class_key sysfs_inode_imutex_key;
 
-void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
+static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
 {
inode->i_blocks = 0;
inode->i_mapping->a_ops = &sysfs_aops;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 6a37f23..6b8c8d7 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -71,7 +71,6 @@ extern void sysfs_remove_one(struct sysfs_addrm_cxt *acxt,
 extern int sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);
 
 extern void sysfs_delete_inode(struct inode *inode);
-extern void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode);
 extern struct inode * sysfs_get_inode(struct sysfs_dirent *sd);
 extern void sysfs_instantiate(struct dentry *dentry, struct inode *inode);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


dev_vdbg(), available with -DVERBOSE_DEBUG

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aebdc3b450a3febf7d7d00cd2235509055ec7082
Commit: aebdc3b450a3febf7d7d00cd2235509055ec7082
Parent: bc37e2830339cbfa42ac8579a7bf62fc4cdd360d
Author: David Brownell <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 22:08:22 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:50 2007 -0700

dev_vdbg(), available with -DVERBOSE_DEBUG

This defines a dev_vdbg() call, which is enabled with -DVERBOSE_DEBUG.
When enabled, dev_vdbg() acts just like dev_dbg().  When disabled, it is a
NOP ...  just like dev_dbg() without -DDEBUG.  The specific code was moved
out of a USB patch, but lots of drivers have similar support.

That is, code can now be written to use an additional level of debug
output, selected at compile time.  Many driver authors have found this
idiom to be very useful.  A typical usage model is for "normal" debug
messages to focus on fault paths and not be very "chatty", so that those
messages can be left on during normal operation without much of a
performance or syslog load.  On the other hand "verbose" messages would be
noisy enough that they wouldn't normally be enabled; they might even affect
timings enough to change system or driver behavior.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/driver.c |7 ---
 include/linux/device.h|   10 ++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 73c4936..6548574 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -29,13 +29,6 @@
 #include "hcd.h"
 #include "usb.h"
 
-#define VERBOSE_DEBUG  0
-
-#if VERBOSE_DEBUG
-#define dev_vdbg   dev_dbg
-#else
-#define dev_vdbg(dev, fmt, args...)do { } while (0)
-#endif
 
 #ifdef CONFIG_HOTPLUG
 
diff --git a/include/linux/device.h b/include/linux/device.h
index be2debe..d9f0a57 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -572,6 +572,16 @@ dev_dbg(struct device * dev, const char * fmt, ...)
 }
 #endif
 
+#ifdef VERBOSE_DEBUG
+#define dev_vdbg   dev_dbg
+#else
+static inline int __attribute__ ((format (printf, 2, 3)))
+dev_vdbg(struct device * dev, const char * fmt, ...)
+{
+   return 0;
+}
+#endif
+
 #define dev_err(dev, format, arg...)   \
dev_printk(KERN_ERR , dev , format , ## arg)
 #define dev_info(dev, format, arg...)  \
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Documentation fix devres.txt: lib/iomap.c -> lib/devres.c

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2c19c49a59ccf2162c0eb999de1ec60c0e07a533
Commit: 2c19c49a59ccf2162c0eb999de1ec60c0e07a533
Parent: 01da2425f327d7ac673e594bee5655523115970b
Author: Brandon Philips <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 22:09:34 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

Documentation fix devres.txt: lib/iomap.c -> lib/devres.c

Signed-off-by: Brandon Philips <[EMAIL PROTECTED]>
Acked-by: Tejun Heo <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/driver-model/devres.txt |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/driver-model/devres.txt 
b/Documentation/driver-model/devres.txt
index 6c8d8f2..8569072 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -207,7 +207,7 @@ responsibility.  This is usually non-issue because bus ops 
and
 resource allocations already do the job.
 
 For an example of single-instance devres type, read pcim_iomap_table()
-in lib/iomap.c.
+in lib/devres.c.
 
 All devres interface functions can be called without context if the
 right gfp mask is given.
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sysfs: fix sysfs root inode nlink accounting

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e080e436f605877e47e4950f5386ed843badbb1b
Commit: e080e436f605877e47e4950f5386ed843badbb1b
Parent: 2c19c49a59ccf2162c0eb999de1ec60c0e07a533
Author: Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 14:29:06 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

sysfs: fix sysfs root inode nlink accounting

While making sysfs indoes hashed, sysfs root inode was left out.  Now
that nlink accounting depends on the inode being on the hash, sysfs
root inode nlink isn't adjusted properly.

Put sysfs root inode on the inode hash by allocating it using
sysfs_get_inode() like other sysfs inodes.  While at it, massage
comments a bit.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Acked-by: Jean Delvare <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 fs/sysfs/mount.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 402cc35..60714d0 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -43,19 +43,19 @@ static int sysfs_fill_super(struct super_block *sb, void 
*data, int silent)
sb->s_time_gran = 1;
sysfs_sb = sb;
 
-   inode = new_inode(sysfs_sb);
+   /* get root inode, initialize and unlock it */
+   inode = sysfs_get_inode(&sysfs_root);
if (!inode) {
pr_debug("sysfs: could not get root inode\n");
return -ENOMEM;
}
 
-   sysfs_init_inode(&sysfs_root, inode);
-
inode->i_op = &sysfs_dir_inode_operations;
inode->i_fop = &sysfs_dir_operations;
-   /* directory inodes start off with i_nlink == 2 (for "." entry) */
-   inc_nlink(inode);
+   inc_nlink(inode); /* directory, account for "." */
+   unlock_new_inode(inode);
 
+   /* instantiate and link root dentry */
root = d_alloc_root(inode);
if (!root) {
pr_debug("%s: could not get root dentry!\n",__FUNCTION__);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


PM: remove deprecated dpm_runtime_* routines

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f8df781fc5f9ee5253a54ba669e1c8872844b86
Commit: 3f8df781fc5f9ee5253a54ba669e1c8872844b86
Parent: 471d0558045fe35f8c5f291c1ee63815eb9c2dcd
Author: Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 16:57:22 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

PM: remove deprecated dpm_runtime_* routines

This patch (as933) removes the deprecated dpm_runtime_suspend() and
dpm_runtime_resume() routines from the PM core.  The only user of
those routines is the PCMCIA ds driver; local replacements are added.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
CC: Dominik Brodowski <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/feature-removal-schedule.txt |1 -
 drivers/base/power/Makefile|2 +-
 drivers/base/power/power.h |5 --
 drivers/base/power/runtime.c   |   85 
 drivers/pcmcia/ds.c|   40 +++--
 include/linux/pm.h |   11 
 6 files changed, 35 insertions(+), 109 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 9cf9d83..1b5c707 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -27,7 +27,6 @@ Who:  Hans Verkuil <[EMAIL PROTECTED]> and
 ---
 
 What:  dev->power.power_state
-   dpm_runtime_{suspend,resume)()
 When:  July 2007
 Why:   Broken design for runtime control over driver power states, confusing
driver-internal runtime power management with:  mechanisms to support
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile
index 91f2309..fff1780 100644
--- a/drivers/base/power/Makefile
+++ b/drivers/base/power/Makefile
@@ -1,5 +1,5 @@
 obj-y  := shutdown.o
-obj-$(CONFIG_PM)   += main.o suspend.o resume.o runtime.o sysfs.o
+obj-$(CONFIG_PM)   += main.o suspend.o resume.o sysfs.o
 obj-$(CONFIG_PM_TRACE) += trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 2760f25..591a0dd 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -62,11 +62,6 @@ extern int resume_device(struct device *);
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-
-/*
- * runtime.c
- */
-
 #else /* CONFIG_PM */
 
 
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
deleted file mode 100644
index df6174d..000
--- a/drivers/base/power/runtime.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * drivers/base/power/runtime.c - Handling dynamic device power management.
- *
- * Copyright (c) 2003 Patrick Mochel
- * Copyright (c) 2003 Open Source Development Lab
- *
- */
-
-#include 
-#include "power.h"
-
-
-static void runtime_resume(struct device * dev)
-{
-   dev_dbg(dev, "resuming\n");
-   if (!dev->power.power_state.event)
-   return;
-   if (!resume_device(dev))
-   dev->power.power_state = PMSG_ON;
-}
-
-
-/**
- * dpm_runtime_resume - Power one device back on.
- * @dev:   Device.
- *
- * Bring one device back to the on state by first powering it
- * on, then restoring state. We only operate on devices that aren't
- * already on.
- * FIXME: We need to handle devices that are in an unknown state.
- */
-
-void dpm_runtime_resume(struct device * dev)
-{
-   mutex_lock(&dpm_mtx);
-   runtime_resume(dev);
-   mutex_unlock(&dpm_mtx);
-}
-EXPORT_SYMBOL(dpm_runtime_resume);
-
-
-/**
- * dpm_runtime_suspend - Put one device in low-power state.
- * @dev:   Device.
- * @state: State to enter.
- */
-
-int dpm_runtime_suspend(struct device * dev, pm_message_t state)
-{
-   int error = 0;
-
-   mutex_lock(&dpm_mtx);
-   if (dev->power.power_state.event == state.event)
-   goto Done;
-
-   if (dev->power.power_state.event)
-   runtime_resume(dev);
-
-   if (!(error = suspend_device(dev, state)))
-   dev->power.power_state = state;
- Done:
-   mutex_unlock(&dpm_mtx);
-   return error;
-}
-EXPORT_SYMBOL(dpm_runtime_suspend);
-
-
-#if 0
-/**
- * dpm_set_power_state - Update power_state field.
- * @dev:   Device.
- * @state: Power state device is in.
- *
- * This is an update mechanism for drivers to notify the core
- * what power state a device is in. Device probing code may not
- * always be able to tell, but we need accurate information to
- * work reliably.
- */
-void dpm_set_power_state(struct device * dev, pm_message_t state)
-{
-   mutex_lock(&dpm_mtx);
-   dev->power.power_state = state;
-   mutex_unlock(&dpm_mtx);
-}
-#endif  /*  0  */
diff --git a/drivers/pcmcia/ds.c b/dr

sysfs: avoid kmem_cache_free(NULL)

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=01da2425f327d7ac673e594bee5655523115970b
Commit: 01da2425f327d7ac673e594bee5655523115970b
Parent: 3f8df781fc5f9ee5253a54ba669e1c8872844b86
Author: Akinobu Mita <[EMAIL PROTECTED]>
AuthorDate: Sat Jul 14 11:03:35 2007 +0900
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

sysfs: avoid kmem_cache_free(NULL)

kmem_cache_free() with NULL is not allowed. But it may happen
if out of memory error is triggered in sysfs_new_dirent().
This patch fixes that error handling.

Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 fs/sysfs/dir.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index aee966c..2e6775a 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -361,20 +361,20 @@ static struct dentry_operations sysfs_dentry_ops = {
 struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type)
 {
char *dup_name = NULL;
-   struct sysfs_dirent *sd = NULL;
+   struct sysfs_dirent *sd;
 
if (type & SYSFS_COPY_NAME) {
name = dup_name = kstrdup(name, GFP_KERNEL);
if (!name)
-   goto err_out;
+   return NULL;
}
 
sd = kmem_cache_zalloc(sysfs_dir_cachep, GFP_KERNEL);
if (!sd)
-   goto err_out;
+   goto err_out1;
 
if (sysfs_alloc_ino(&sd->s_ino))
-   goto err_out;
+   goto err_out2;
 
atomic_set(&sd->s_count, 1);
atomic_set(&sd->s_active, 0);
@@ -386,9 +386,10 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, 
umode_t mode, int type)
 
return sd;
 
- err_out:
-   kfree(dup_name);
+ err_out2:
kmem_cache_free(sysfs_dir_cachep, sd);
+ err_out1:
+   kfree(dup_name);
return NULL;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Driver core: accept all valid action-strings in uevent-trigger

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=60a96a59569bab85571d0089682109bd3324e896
Commit: 60a96a59569bab85571d0089682109bd3324e896
Parent: a6bb340da32f0abf76656be1619fb85150eef61b
Author: Kay Sievers <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 8 22:29:26 2007 +0200
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

Driver core: accept all valid action-strings in uevent-trigger

This allows the uevent file to handle any type of uevent action to be
triggered by userspace instead of just the "add" uevent.


Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/base/core.c |   23 ---
 include/linux/kobject.h |   25 +
 lib/kobject_uevent.c|   30 ++
 3 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 0455aa7..91a0367 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -24,6 +24,8 @@
 #include "base.h"
 #include "power/power.h"
 
+extern const char *kobject_actions[];
+
 int (*platform_notify)(struct device * dev) = NULL;
 int (*platform_notify_remove)(struct device * dev) = NULL;
 
@@ -303,10 +305,25 @@ out:
 static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
 {
-   if (memcmp(buf, "add", 3) != 0)
-   dev_err(dev, "uevent: unsupported action-string; this will "
-   "be ignored in a future kernel version");
+   size_t len = count;
+   enum kobject_action action;
+
+   if (len && buf[len-1] == '\n')
+   len--;
+
+   for (action = 0; action < KOBJ_MAX; action++) {
+   if (strncmp(kobject_actions[action], buf, len) != 0)
+   continue;
+   if (kobject_actions[action][len] != '\0')
+   continue;
+   kobject_uevent(&dev->kobj, action);
+   goto out;
+   }
+
+   dev_err(dev, "uevent: unsupported action-string; this will "
+"be ignored in a future kernel version\n");
kobject_uevent(&dev->kobj, KOBJ_ADD);
+out:
return count;
 }
 
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 06cbf41..aa2fe22 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -36,15 +36,24 @@ extern char uevent_helper[];
 /* counter to tag the uevent, read only except for the kobject core */
 extern u64 uevent_seqnum;
 
-/* the actions here must match the proper string in lib/kobject_uevent.c */
-typedef int __bitwise kobject_action_t;
+/*
+ * The actions here must match the index to the string array
+ * in lib/kobject_uevent.c
+ *
+ * Do not add new actions here without checking with the driver-core
+ * maintainers. Action strings are not meant to express subsystem
+ * or device specific properties. In most cases you want to send a
+ * kobject_uevent_env(kobj, KOBJ_CHANGE, env) with additional event
+ * specific variables added to the event environment.
+ */
 enum kobject_action {
-   KOBJ_ADD= (__force kobject_action_t) 0x01,  /* exclusive to 
core */
-   KOBJ_REMOVE = (__force kobject_action_t) 0x02,  /* exclusive to 
core */
-   KOBJ_CHANGE = (__force kobject_action_t) 0x03,  /* device state 
change */
-   KOBJ_OFFLINE= (__force kobject_action_t) 0x04,  /* device 
offline */
-   KOBJ_ONLINE = (__force kobject_action_t) 0x05,  /* device 
online */
-   KOBJ_MOVE   = (__force kobject_action_t) 0x06,  /* device move 
*/
+   KOBJ_ADD,
+   KOBJ_REMOVE,
+   KOBJ_CHANGE,
+   KOBJ_MOVE,
+   KOBJ_ONLINE,
+   KOBJ_OFFLINE,
+   KOBJ_MAX
 };
 
 struct kobject {
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index bd5ecbb..6a80c78 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -33,25 +33,15 @@ static DEFINE_SPINLOCK(sequence_lock);
 static struct sock *uevent_sock;
 #endif
 
-static char *action_to_string(enum kobject_action action)
-{
-   switch (action) {
-   case KOBJ_ADD:
-   return "add";
-   case KOBJ_REMOVE:
-   return "remove";
-   case KOBJ_CHANGE:
-   return "change";
-   case KOBJ_OFFLINE:
-   return "offline";
-   case KOBJ_ONLINE:
-   return "online";
-   case KOBJ_MOVE:
-   return "move";
-   default:
-   return NULL;
-   }
-}
+/* the strings here must match the enum in include/linux/kobject.h */
+const char *kobject_actions[] = {
+   "add",
+   "remove",
+   "change",
+   "move",
+   "online",
+   "offline",
+};
 
 /**
  * kobject_uevent_env - send an uevent with environmental data
@@ -83,7 +73,7 @@ int kobject_uevent_env

PM: Remove deprecated sysfs files

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=471d0558045fe35f8c5f291c1ee63815eb9c2dcd
Commit: 471d0558045fe35f8c5f291c1ee63815eb9c2dcd
Parent: 60a96a59569bab85571d0089682109bd3324e896
Author: Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 16:55:07 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:49 2007 -0700

PM: Remove deprecated sysfs files

This patch (as932) removes the deprecated sysfs .../power/state
attribute files.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Acked-by: Pavel Machek <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/feature-removal-schedule.txt |3 +-
 drivers/base/power/sysfs.c |   66 
 kernel/power/Kconfig   |   12 -
 3 files changed, 1 insertions(+), 80 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index d05e624..9cf9d83 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -26,8 +26,7 @@ Who:  Hans Verkuil <[EMAIL PROTECTED]> and
 
 ---
 
-What:  /sys/devices/.../power/state
-   dev->power.power_state
+What:  dev->power.power_state
dpm_runtime_{suspend,resume)()
 When:  July 2007
 Why:   Broken design for runtime control over driver power states, confusing
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 2d47517..f2ed179 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -7,69 +7,6 @@
 #include "power.h"
 
 
-#ifdef CONFIG_PM_SYSFS_DEPRECATED
-
-/**
- * state - Control current power state of device
- *
- * show() returns the current power state of the device. '0' indicates
- * the device is on. Other values (2) indicate the device is in some low
- * power state.
- *
- * store() sets the current power state, which is an integer valued
- * 0, 2, or 3.  Devices with bus.suspend_late(), or bus.resume_early()
- * methods fail this operation; those methods couldn't be called.
- * Otherwise,
- *
- * - If the recorded dev->power.power_state.event matches the
- *   target value, nothing is done.
- * - If the recorded event code is nonzero, the device is reactivated
- *   by calling bus.resume() and/or class.resume().
- * - If the target value is nonzero, the device is suspended by
- *   calling class.suspend() and/or bus.suspend() with event code
- *   PM_EVENT_SUSPEND.
- *
- * This mechanism is DEPRECATED and should only be used for testing.
- */
-
-static ssize_t state_show(struct device * dev, struct device_attribute *attr, 
char * buf)
-{
-   if (dev->power.power_state.event)
-   return sprintf(buf, "2\n");
-   else
-   return sprintf(buf, "0\n");
-}
-
-static ssize_t state_store(struct device * dev, struct device_attribute *attr, 
const char * buf, size_t n)
-{
-   pm_message_t state;
-   int error = -EINVAL;
-
-   /* disallow incomplete suspend sequences */
-   if (dev->bus && (dev->bus->suspend_late || dev->bus->resume_early))
-   return error;
-
-   state.event = PM_EVENT_SUSPEND;
-   /* Older apps expected to write "3" here - confused with PCI D3 */
-   if ((n == 1) && !strcmp(buf, "3"))
-   error = dpm_runtime_suspend(dev, state);
-
-   if ((n == 1) && !strcmp(buf, "2"))
-   error = dpm_runtime_suspend(dev, state);
-
-   if ((n == 1) && !strcmp(buf, "0")) {
-   dpm_runtime_resume(dev);
-   error = 0;
-   }
-
-   return error ? error : n;
-}
-
-static DEVICE_ATTR(state, 0644, state_show, state_store);
-
-
-#endif /* CONFIG_PM_SYSFS_DEPRECATED */
-
 /*
  * wakeup - Report/change current wakeup option for device
  *
@@ -143,9 +80,6 @@ static DEVICE_ATTR(wakeup, 0644, wake_show, wake_store);
 
 
 static struct attribute * power_attrs[] = {
-#ifdef CONFIG_PM_SYSFS_DEPRECATED
-   &dev_attr_state.attr,
-#endif
&dev_attr_wakeup.attr,
NULL,
 };
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 495b7d4..7332847 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -65,18 +65,6 @@ config PM_TRACE
CAUTION: this option will cause your machine's real-time clock to be
set to an invalid time after a resume.
 
-config PM_SYSFS_DEPRECATED
-   bool "Driver model /sys/devices/.../power/state files (DEPRECATED)"
-   depends on PM && SYSFS
-   default n
-   help
- The driver model started out with a sysfs file intended to provide
- a userspace hook for device power management.  This feature has never
- worked very well, except for limited testing purposes, and so it will
- be removed.   It's not clear that a generic mechanism could rea

UIO: Hilscher CIF card driver

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bc4c4f45acbe1f1528d654b0b1793f25c175bf8f
Commit: bc4c4f45acbe1f1528d654b0b1793f25c175bf8f
Parent: e3e0a28b5b067d16b8e2e5ddaedecda5bd0c3ec2
Author: Hans-Jürgen Koch <[EMAIL PROTECTED]>
AuthorDate: Fri Mar 2 13:03:12 2007 +0100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:57:16 2007 -0700

UIO: Hilscher CIF card driver

this is a patch that adds support for Hilscher CIF DeviceNet and
Profibus cards. I tested it on a Kontron CPX board, and Thomas reviewed
it.

You can find the user space part here:

http://www.osadl.org/projects/downloads/UIO/user/cif-0.1.0.tar.gz

Notes: cif_api.c is the main file you want to look at. It contains the
functions to open, close, mmap and so on. cif_dps.c adds functions
specific to Profibus cards, and cif_dn.c contains functions for
DeviceNet cards.  cif.c is a universal playground, it's just a small
test program.  The user space part of this UIO driver is still work in
progress, and not everything is tested yet. At the moment, the thread in
cif_api.c contains some code that artificially makes the card generate
interrupts, this was added for testing and will be removed later. But
the driver already contains all the functions needed for useful
operation, so it gives a good idea of how such a thing looks like.

For comparison, here's what you get from the manufacturer
(www.hilscher.com) when you ask for a Linux 2.6 driver:

http://www.tglx.de/private/hjk/cif-orig-2.6.tar.bz2

WARNING: Don't look at the code for too long, you might become sick :-)


Signed-off-by: Hans-Jürgen Koch <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/uio/Kconfig   |   13 
 drivers/uio/Makefile  |3 +-
 drivers/uio/uio_cif.c |  156 +
 3 files changed, 171 insertions(+), 1 deletions(-)

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 6b1a62d..b778ed7 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -13,4 +13,17 @@ config UIO
 
  If you don't know what to do here, say N.
 
+config UIO_CIF
+   tristate "generic Hilscher CIF Card driver"
+   depends on UIO && PCI
+   default n
+   help
+ Driver for Hilscher CIF DeviceNet and Profibus cards.  This
+ driver requires a userspace component that handles all of the
+ heavy lifting and can be found at:
+   http://www.osadl.org/projects/downloads/UIO/user/cif-*
+
+ To compile this driver as a module, choose M here: the module
+ will be called uio_cif.
+
 endmenu
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index 9b7c830..7fecfb4 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -1 +1,2 @@
-obj-$(CONFIG_UIO) += uio.o
+obj-$(CONFIG_UIO)  += uio.o
+obj-$(CONFIG_UIO_CIF)  += uio_cif.o
diff --git a/drivers/uio/uio_cif.c b/drivers/uio/uio_cif.c
new file mode 100644
index 000..838bae4
--- /dev/null
+++ b/drivers/uio/uio_cif.c
@@ -0,0 +1,156 @@
+/*
+ * UIO Hilscher CIF card driver
+ *
+ * (C) 2007 Hans J. Koch <[EMAIL PROTECTED]>
+ * Original code (C) 2005 Benedikt Spranger <[EMAIL PROTECTED]>
+ *
+ * Licensed under GPL version 2 only.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifndef PCI_DEVICE_ID_PLX_9030
+#define PCI_DEVICE_ID_PLX_9030 0x9030
+#endif
+
+#define PLX9030_INTCSR 0x4C
+#define INTSCR_INT1_ENABLE 0x01
+#define INTSCR_INT1_STATUS 0x04
+#define INT1_ENABLED_AND_ACTIVE(INTSCR_INT1_ENABLE | 
INTSCR_INT1_STATUS)
+
+#define PCI_SUBVENDOR_ID_PEP   0x1518
+#define CIF_SUBDEVICE_PROFIBUS 0x430
+#define CIF_SUBDEVICE_DEVICENET0x432
+
+
+static irqreturn_t hilscher_handler(int irq, struct uio_info *dev_info)
+{
+   void __iomem *plx_intscr = dev_info->mem[0].internal_addr
+   + PLX9030_INTCSR;
+
+   if ((ioread8(plx_intscr) & INT1_ENABLED_AND_ACTIVE)
+   != INT1_ENABLED_AND_ACTIVE)
+   return IRQ_NONE;
+
+   /* Disable interrupt */
+   iowrite8(ioread8(plx_intscr) & ~INTSCR_INT1_ENABLE, plx_intscr);
+   return IRQ_HANDLED;
+}
+
+static int __devinit hilscher_pci_probe(struct pci_dev *dev,
+   const struct pci_device_id *id)
+{
+   struct uio_info *info;
+
+   info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
+   if (!info)
+   return -ENOMEM;
+
+   if (pci_enable_device(dev))
+   goto out_free;
+
+   if (pci_request_regions(dev, "hilscher"))
+   goto out_disable;
+
+   info->mem[0].addr = pci_resource_start(dev, 0);
+   if (!info->mem[0].addr)
+   goto out_release;
+   info->mem[0].internal_addr = ioremap(pci_resource_start(dev, 0),
+

debugfs: remove rmdir() non-empty complaint

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a6bb340da32f0abf76656be1619fb85150eef61b
Commit: a6bb340da32f0abf76656be1619fb85150eef61b
Parent: 5bae7ac9feba925fd0099057f6b23d7be80b7b41
Author: Jens Axboe <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 11 14:53:28 2007 +0200
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:49:48 2007 -0700

debugfs: remove rmdir() non-empty complaint

Hi,

This patch kills the pointless debugfs rmdir() printk() when called on a
non-empty directory. blktrace will sometimes have to call it a few times
when forcefully ending a trace, which polutes the log with pointless
warnings.

Rationale:

- It's more code to work-around this "problem" in the debugfs users, and
  you would have to add code to check for empty directories to do so (or
  assume that debugfs is using simple_ helpers, but that would be a
  layering violation).

- Other rmdir() implementations don't complain about something this
  silly.

Signed-off-by: Jens Axboe <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 fs/debugfs/inode.c |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 1d533a2..11be8a3 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -345,11 +345,6 @@ void debugfs_remove(struct dentry *dentry)
switch (dentry->d_inode->i_mode & S_IFMT) {
case S_IFDIR:
ret = simple_rmdir(parent->d_inode, dentry);
-   if (ret)
-   printk(KERN_ERR
-   "DebugFS rmdir on %s failed : "
-   "directory not empty.\n",
-   dentry->d_name.name);
break;
case S_IFLNK:
kfree(dentry->d_inode->i_private);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


UIO: Documentation

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e3e0a28b5b067d16b8e2e5ddaedecda5bd0c3ec2
Commit: e3e0a28b5b067d16b8e2e5ddaedecda5bd0c3ec2
Parent: beafc54c4e2fba24e1ca45cdb7f79d9aa83e3db1
Author: Hans J. Koch <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 11 16:59:59 2006 +0100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:57:16 2007 -0700

UIO: Documentation

Documentation for the UIO interface

From: Hans J. Koch <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 Documentation/DocBook/kernel-api.tmpl |4 +
 Documentation/DocBook/uio-howto.tmpl  |  611 +
 2 files changed, 615 insertions(+), 0 deletions(-)

diff --git a/Documentation/DocBook/kernel-api.tmpl 
b/Documentation/DocBook/kernel-api.tmpl
index fd2ef4d..a0af560 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -408,6 +408,10 @@ X!Edrivers/pnp/system.c
 !Edrivers/pnp/manager.c
 !Edrivers/pnp/support.c
  
+ Userspace IO devices
+!Edrivers/uio/uio.c
+!Iinclude/linux/uio_driver.h
+ 
   
 
   
diff --git a/Documentation/DocBook/uio-howto.tmpl 
b/Documentation/DocBook/uio-howto.tmpl
new file mode 100644
index 000..e3bb29a
--- /dev/null
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -0,0 +1,611 @@
+
+http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"; []>
+
+
+
+The Userspace I/O HOWTO
+
+
+  Hans-Jürgen
+  Koch
+  Linux developer, Linutronix
+   
+   
+   http://www.linutronix.de";>Linutronix
+   
+
+   
+  [EMAIL PROTECTED]
+   
+
+
+
+2006-12-11
+
+
+   This HOWTO describes concept and usage of Linux kernel's
+   Userspace I/O system.
+
+
+
+   
+   0.3
+   2007-04-29
+   hjk
+   Added section about userspace drivers.
+   
+   
+   0.2
+   2007-02-13
+   hjk
+   Update after multiple mappings were added.
+   
+   
+   0.1
+   2006-12-11
+   hjk
+   First draft.
+   
+
+
+
+
+
+About this document
+
+
+
+Copyright and License
+
+  Copyright (c) 2006 by Hans-Jürgen Koch.
+
+This documentation is Free Software licensed under the terms of the
+GPL version 2.
+
+
+
+
+
+Translations
+
+If you know of any translations for this document, or you are
+interested in translating it, please email me
+[EMAIL PROTECTED].
+
+
+
+
+Preface
+   
+   For many types of devices, creating a Linux kernel driver is
+   overkill.  All that is really needed is some way to handle an
+   interrupt and provide access to the memory space of the
+   device.  The logic of controlling the device does not
+   necessarily have to be within the kernel, as the device does
+   not need to take advantage of any of other resources that the
+   kernel provides.  One such common class of devices that are
+   like this are for industrial I/O cards.
+   
+   
+   To address this situation, the userspace I/O system (UIO) was
+   designed.  For typical industrial I/O cards, only a very small
+   kernel module is needed. The main part of the driver will run in
+   user space. This simplifies development and reduces the risk of
+   serious bugs within a kernel module.
+   
+
+
+
+Acknowledgments
+   I'd like to thank Thomas Gleixner and Benedikt Spranger of
+   Linutronix, who have not only written most of the UIO code, but also
+   helped greatly writing this HOWTO by giving me all kinds of background
+   information.
+
+
+
+Feedback
+   Find something wrong with this document? (Or perhaps something
+   right?) I would love to hear from you. Please email me at
+   [EMAIL PROTECTED].
+
+
+
+
+
+About UIO
+
+If you use UIO for your card's driver, here's what you get:
+
+
+
+   only one small kernel module to write and maintain.
+
+
+   develop the main part of your driver in user space,
+   with all the tools and libraries you're used to.
+
+
+   bugs in your driver won't crash the kernel.
+
+
+   updates of your driver can take place without recompiling
+   the kernel.
+
+
+   if you need to keep some parts of your driver closed source,
+   you can do so without violating the GPL license on the kernel.
+
+
+
+
+How UIO works
+   
+   Each UIO device is accessed through a device file and several
+   sysfs attribute files. The device file will be called
+   /dev/uio0 for the first device, and
+   /dev/uio1, /dev/uio2
+   and so on for subsequent devices.
+   
+
+   /dev/uioX is used to access the
+   address space of the card. Just use
+   mmap() to access registers or RAM
+   locations of your card.
+   
+
+   
+   Interrupts are handled by reading from
+   /dev/uioX. A blocking
+   read() from
+   /dev/uioX will return as soon as

locks: fix vfs_test_lock() comment

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6924c55492c904695f13c552c461c2211f4fdd6a
Commit: 6924c55492c904695f13c552c461c2211f4fdd6a
Parent: 6d34ac199a4af5c678a3a8f3275aeb2586b72da3
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Fri May 11 16:22:50 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:17:19 2007 -0400

locks: fix vfs_test_lock() comment

Thanks to Doug Chapman for pointing out that the comment here is
inconsistent with the function prototype.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/locks.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 4a80727..4f2d749 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1600,8 +1600,7 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int 
cmd)
 /**
  * vfs_test_lock - test file byte range lock
  * @filp: The file to test lock for
- * @fl: The lock to test
- * @conf: Place to return a copy of the conflicting lock, if found
+ * @fl: The lock to test; also used to hold result
  *
  * Returns -ERRNO on failure.  Indicates presence of conflicting lock by
  * setting conf->fl_type to something other than F_UNLCK.
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


UIO: Add the User IO core code

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=beafc54c4e2fba24e1ca45cdb7f79d9aa83e3db1
Commit: beafc54c4e2fba24e1ca45cdb7f79d9aa83e3db1
Parent: 5bae7ac9feba925fd0099057f6b23d7be80b7b41
Author: Hans J. Koch <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 7 10:58:29 2006 +0100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 15:57:15 2007 -0700

UIO: Add the User IO core code

This interface allows the ability to write the majority of a driver in
userspace with only a very small shell of a driver in the kernel itself.
It uses a char device and sysfs to interact with a userspace process to
process interrupts and control memory accesses.

See the docbook documentation for more details on how to use this
interface.

From: Hans J. Koch <[EMAIL PROTECTED]>
Cc: Thomas Gleixner <[EMAIL PROTECTED]>
Cc: Benedikt Spranger <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/Kconfig|1 +
 drivers/Makefile   |1 +
 drivers/uio/Kconfig|   16 +
 drivers/uio/Makefile   |1 +
 drivers/uio/uio.c  |  701 
 include/linux/uio_driver.h |   91 ++
 6 files changed, 811 insertions(+), 0 deletions(-)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 7916f4b..ae01d86 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -84,4 +84,5 @@ source "drivers/auxdisplay/Kconfig"
 
 source "drivers/kvm/Kconfig"
 
+source "drivers/uio/Kconfig"
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 6d9d7fa..c34c8ef 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_ATA) += ata/
 obj-$(CONFIG_FUSION)   += message/
 obj-$(CONFIG_FIREWIRE) += firewire/
 obj-$(CONFIG_IEEE1394) += ieee1394/
+obj-$(CONFIG_UIO)  += uio/
 obj-y  += cdrom/
 obj-y  += auxdisplay/
 obj-$(CONFIG_MTD)  += mtd/
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
new file mode 100644
index 000..6b1a62d
--- /dev/null
+++ b/drivers/uio/Kconfig
@@ -0,0 +1,16 @@
+menu "Userspace I/O"
+   depends on !S390
+
+config UIO
+   tristate "Userspace I/O drivers"
+   default n
+   help
+ Enable this to allow the userspace driver core code to be
+ built.  This code allows userspace programs easy access to
+ kernel interrupts and memory locations, allowing some drivers
+ to be written in userspace.  Note that a small kernel driver
+ is also required for interrupt handling to work properly.
+
+ If you don't know what to do here, say N.
+
+endmenu
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
new file mode 100644
index 000..9b7c830
--- /dev/null
+++ b/drivers/uio/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_UIO) += uio.o
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
new file mode 100644
index 000..865f32b
--- /dev/null
+++ b/drivers/uio/uio.c
@@ -0,0 +1,701 @@
+/*
+ * drivers/uio/uio.c
+ *
+ * Copyright(C) 2005, Benedikt Spranger <[EMAIL PROTECTED]>
+ * Copyright(C) 2005, Thomas Gleixner <[EMAIL PROTECTED]>
+ * Copyright(C) 2006, Hans J. Koch <[EMAIL PROTECTED]>
+ * Copyright(C) 2006, Greg Kroah-Hartman <[EMAIL PROTECTED]>
+ *
+ * Userspace IO
+ *
+ * Base Functions
+ *
+ * Licensed under the GPLv2 only.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define UIO_MAX_DEVICES 255
+
+struct uio_device {
+   struct module   *owner;
+   struct device   *dev;
+   int minor;
+   atomic_tevent;
+   struct fasync_struct*async_queue;
+   wait_queue_head_t   wait;
+   int vma_count;
+   struct uio_info *info;
+   struct kset map_attr_kset;
+};
+
+static int uio_major;
+static DEFINE_IDR(uio_idr);
+static struct file_operations uio_fops;
+
+/* UIO class infrastructure */
+static struct uio_class {
+   struct kref kref;
+   struct class *class;
+} *uio_class;
+
+/*
+ * attributes
+ */
+
+static struct attribute attr_addr = {
+   .name  = "addr",
+   .mode  = S_IRUGO,
+};
+
+static struct attribute attr_size = {
+   .name  = "size",
+   .mode  = S_IRUGO,
+};
+
+static struct attribute* map_attrs[] = {
+   &attr_addr, &attr_size, NULL
+};
+
+static ssize_t map_attr_show(struct kobject *kobj, struct attribute *attr,
+char *buf)
+{
+   struct uio_mem *mem = container_of(kobj, struct uio_mem, kobj);
+
+   if (strncmp(attr->name,"addr",4) == 0)
+   return sprintf(buf, "0x%lx\n", mem->addr);
+
+   if (strncmp(attr->name,"size",4) == 0)
+   return sprintf(buf, "0x%lx\n", mem->size);
+
+   return -ENODEV;
+}
+
+static void map_attr_

nfs: disable leases over NFS

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=370f6599e8bc03fd9fc6d1a1be00ae0c6373ca59
Commit: 370f6599e8bc03fd9fc6d1a1be00ae0c6373ca59
Parent: 60446067ba7a8e890a91db3b4a7436fe0ebd2dee
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 8 15:23:34 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:17:19 2007 -0400

nfs: disable leases over NFS

As Peter Staubach says elsewhere
(http://marc.info/?l=linux-kernel&m=118113649526444&w=2):

> The problem is that some file system such as NFSv2 and NFSv3 do
> not have sufficient support to be able to support leases correctly.
> In particular for these two file systems, there is no over the wire
> protocol support.
>
> Currently, these two file systems fail the fcntl(F_SETLEASE) call
> accidentally, due to a reference counting difference.  These file
> systems should fail more consciously, with a proper error to
> indicate that the call is invalid for them.

Define an nfs setlease method that just returns -EINVAL.

If someone can demonstrate a real need, perhaps we could reenable
them in the presence of the "nolock" mount option.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
Cc: Peter Staubach <[EMAIL PROTECTED]>
Cc: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/file.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 8689b73..13ac6fa 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -53,6 +53,7 @@ static int  nfs_fsync(struct file *, struct dentry *dentry, 
int datasync);
 static int nfs_check_flags(int flags);
 static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl);
 static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl);
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl);
 
 const struct file_operations nfs_file_operations = {
.llseek = nfs_file_llseek,
@@ -69,6 +70,7 @@ const struct file_operations nfs_file_operations = {
.flock  = nfs_flock,
.splice_read= nfs_file_splice_read,
.check_flags= nfs_check_flags,
+   .setlease   = nfs_setlease,
 };
 
 const struct inode_operations nfs_file_inode_operations = {
@@ -558,3 +560,13 @@ static int nfs_flock(struct file *filp, int cmd, struct 
file_lock *fl)
return do_unlk(filp, cmd, fl);
return do_setlk(filp, cmd, fl);
 }
+
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
+{
+   /*
+* There is no protocol support for leases, so we have no way
+* to implement them correctly in the face of opens by other
+* clients.
+*/
+   return -EINVAL;
+}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


locks: make posix_test_lock() interface more consistent

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d34ac199a4af5c678a3a8f3275aeb2586b72da3
Commit: 6d34ac199a4af5c678a3a8f3275aeb2586b72da3
Parent: 370f6599e8bc03fd9fc6d1a1be00ae0c6373ca59
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Fri May 11 16:09:32 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:17:19 2007 -0400

locks: make posix_test_lock() interface more consistent

Since posix_test_lock(), like fcntl() and ->lock(), indicates absence or
presence of a conflict lock by setting fl_type to, respectively, F_UNLCK
or something other than F_UNLCK, the return value is no longer needed.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/locks.c |   10 --
 fs/nfs/file.c  |4 +++-
 include/linux/fs.h |2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 4c73b85..4a80727 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -659,7 +659,7 @@ static int locks_block_on_timeout(struct file_lock 
*blocker, struct file_lock *w
return result;
 }
 
-int
+void
 posix_test_lock(struct file *filp, struct file_lock *fl)
 {
struct file_lock *cfl;
@@ -671,14 +671,12 @@ posix_test_lock(struct file *filp, struct file_lock *fl)
if (posix_locks_conflict(cfl, fl))
break;
}
-   if (cfl) {
+   if (cfl)
__locks_copy_lock(fl, cfl);
-   unlock_kernel();
-   return 1;
-   } else
+   else
fl->fl_type = F_UNLCK;
unlock_kernel();
-   return 0;
+   return;
 }
 
 EXPORT_SYMBOL(posix_test_lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 13ac6fa..c87dc71 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -402,7 +402,9 @@ static int do_getlk(struct file *filp, int cmd, struct 
file_lock *fl)
 
lock_kernel();
/* Try local locking first */
-   if (posix_test_lock(filp, fl)) {
+   posix_test_lock(filp, fl);
+   if (fl->fl_type != F_UNLCK) {
+   /* found a conflict */
goto out;
}
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b188c2e..80deaaf 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -862,7 +862,7 @@ extern void locks_init_lock(struct file_lock *);
 extern void locks_copy_lock(struct file_lock *, struct file_lock *);
 extern void locks_remove_posix(struct file *, fl_owner_t);
 extern void locks_remove_flock(struct file *);
-extern int posix_test_lock(struct file *, struct file_lock *);
+extern void posix_test_lock(struct file *, struct file_lock *);
 extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock 
*);
 extern int posix_lock_file_wait(struct file *, struct file_lock *);
 extern int posix_unblock_lock(struct file *, struct file_lock *);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


locks: export setlease to filesystems

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4698afe8e3a725576366f86560a8a8242b21b9f7
Commit: 4698afe8e3a725576366f86560a8a8242b21b9f7
Parent: f9ffed26d6f3e6ac9988947242821579d615fda7
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 4 17:21:37 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:17:06 2007 -0400

locks: export setlease to filesystems

Export setlease so it can used by filesystems to implement their lease
methods.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/locks.c |3 ++-
 include/linux/fs.h |1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 94f5d80..4c73b85 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1336,7 +1336,7 @@ int fcntl_getlease(struct file *filp)
  *
  * Called with kernel lock held.
  */
-static int setlease(struct file *filp, long arg, struct file_lock **flp)
+int setlease(struct file *filp, long arg, struct file_lock **flp)
 {
struct file_lock *fl, **before, **my_before = NULL, *lease;
struct dentry *dentry = filp->f_path.dentry;
@@ -1421,6 +1421,7 @@ static int setlease(struct file *filp, long arg, struct 
file_lock **flp)
 out:
return error;
 }
+EXPORT_SYMBOL(setlease);
 
  /**
  * vfs_setlease-   sets a lease on an open file
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c8ddf34..b188c2e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -872,6 +872,7 @@ extern int vfs_cancel_lock(struct file *filp, struct 
file_lock *fl);
 extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
+extern int setlease(struct file *, long, struct file_lock **);
 extern int vfs_setlease(struct file *, long, struct file_lock **);
 extern int lease_modify(struct file_lock **, int);
 extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


gfs2: stop giving out non-cluster-coherent leases

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=60446067ba7a8e890a91db3b4a7436fe0ebd2dee
Commit: 60446067ba7a8e890a91db3b4a7436fe0ebd2dee
Parent: 4698afe8e3a725576366f86560a8a8242b21b9f7
Author: Marc Eshel <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 15 18:33:36 2007 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:17:19 2007 -0400

gfs2: stop giving out non-cluster-coherent leases

Since gfs2 can't prevent conflicting opens or leases on other nodes, we
probably shouldn't allow it to give out leases at all.

Put the newly defined lease operation into use in gfs2 by turning off
lease, unless we're using the "nolock' locking module (in which case all
locking is local anyway).

Signed-off-by: Marc Eshel <[EMAIL PROTECTED]>
Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
Cc: Steven Whitehouse <[EMAIL PROTECTED]>
---
 fs/gfs2/ops_file.c |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 196d832..1a5e8e8 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -489,6 +489,29 @@ static int gfs2_fsync(struct file *file, struct dentry 
*dentry, int datasync)
 }
 
 /**
+ * gfs2_setlease - acquire/release a file lease
+ * @file: the file pointer
+ * @arg: lease type
+ * @fl: file lock
+ *
+ * Returns: errno
+ */
+
+static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
+{
+   struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host);
+
+   /*
+* We don't currently have a way to enforce a lease across the whole
+* cluster; until we do, disable leases (by just returning -EINVAL),
+* unless the administrator has requested purely local locking.
+*/
+   if (!sdp->sd_args.ar_localflocks)
+   return -EINVAL;
+   return setlease(file, arg, fl);
+}
+
+/**
  * gfs2_lock - acquire/release a posix lock on a file
  * @file: the file pointer
  * @cmd: either modify or retrieve lock state, possibly wait
@@ -638,6 +661,7 @@ const struct file_operations gfs2_file_fops = {
.flock  = gfs2_flock,
.splice_read= generic_file_splice_read,
.splice_write   = generic_file_splice_write,
+   .setlease   = gfs2_setlease,
 };
 
 const struct file_operations gfs2_dir_fops = {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


locks: rename lease functions to reflect locks.c conventions

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a9933cea7a1d80dd9efae9f1acd857f5dce742b9
Commit: a9933cea7a1d80dd9efae9f1acd857f5dce742b9
Parent: 6d5e8b05caf074ae5676ad9aaf92e381226a14a7
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 7 17:09:49 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:14:12 2007 -0400

locks: rename lease functions to reflect locks.c conventions

We've been using the convention that vfs_foo is the function that calls
a filesystem-specific foo method if it exists, or falls back on a
generic method if it doesn't; thus vfs_foo is what is called when some
other part of the kernel (normally lockd or nfsd) wants to get a lock,
whereas foo is what filesystems call to use the underlying local
functionality as part of their lock implementation.

So rename setlease to vfs_setlease (which will call a
filesystem-specific setlease after a later patch) and __setlease to
setlease.

Also, vfs_setlease need only be GPL-exported as long as it's only needed
by lockd and nfsd.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/locks.c  |   15 +++
 fs/nfsd/nfs4state.c |   10 +-
 include/linux/fs.h  |2 +-
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 0e5873b..a65d85c 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1326,7 +1326,7 @@ int fcntl_getlease(struct file *filp)
 }
 
 /**
- * __setlease  -   sets a lease on an open file
+ * setlease-   sets a lease on an open file
  * @filp: file pointer
  * @arg: type of lease to obtain
  * @flp: input - file_lock to use, output - file_lock inserted
@@ -1336,7 +1336,7 @@ int fcntl_getlease(struct file *filp)
  *
  * Called with kernel lock held.
  */
-static int __setlease(struct file *filp, long arg, struct file_lock **flp)
+static int setlease(struct file *filp, long arg, struct file_lock **flp)
 {
struct file_lock *fl, **before, **my_before = NULL, *lease;
struct dentry *dentry = filp->f_path.dentry;
@@ -1423,7 +1423,7 @@ out:
 }
 
  /**
- * setlease-   sets a lease on an open file
+ * vfs_setlease-   sets a lease on an open file
  * @filp: file pointer
  * @arg: type of lease to obtain
  * @lease: file_lock to use
@@ -1432,18 +1432,17 @@ out:
  * The fl_lmops fl_break function is required by break_lease
  */
 
-int setlease(struct file *filp, long arg, struct file_lock **lease)
+int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
 {
int error;
 
lock_kernel();
-   error = __setlease(filp, arg, lease);
+   error = setlease(filp, arg, lease);
unlock_kernel();
 
return error;
 }
-
-EXPORT_SYMBOL(setlease);
+EXPORT_SYMBOL_GPL(vfs_setlease);
 
 /**
  * fcntl_setlease  -   sets a lease on an open file
@@ -1469,7 +1468,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, 
long arg)
 
lock_kernel();
 
-   error = __setlease(filp, arg, &flp);
+   error = vfs_setlease(filp, arg, &flp);
if (error || arg == F_UNLCK)
goto out_unlock;
 
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index e4a4c87..6284807 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -256,7 +256,7 @@ nfs4_close_delegation(struct nfs4_delegation *dp)
/* The following nfsd_close may not actually close the file,
 * but we want to remove the lease in any case. */
if (dp->dl_flock)
-   setlease(filp, F_UNLCK, &dp->dl_flock);
+   vfs_setlease(filp, F_UNLCK, &dp->dl_flock);
nfsd_close(filp);
 }
 
@@ -1402,7 +1402,7 @@ void nfsd_release_deleg_cb(struct file_lock *fl)
 /*
  * Set the delegation file_lock back pointer.
  *
- * Called from __setlease() with lock_kernel() held.
+ * Called from setlease() with lock_kernel() held.
  */
 static
 void nfsd_copy_lock_deleg_cb(struct file_lock *new, struct file_lock *fl)
@@ -1416,7 +1416,7 @@ void nfsd_copy_lock_deleg_cb(struct file_lock *new, 
struct file_lock *fl)
 }
 
 /*
- * Called from __setlease() with lock_kernel() held
+ * Called from setlease() with lock_kernel() held
  */
 static
 int nfsd_same_client_deleg_cb(struct file_lock *onlist, struct file_lock *try)
@@ -1716,10 +1716,10 @@ nfs4_open_delegation(struct svc_fh *fh, struct 
nfsd4_open *open, struct nfs4_sta
fl.fl_file = stp->st_vfs_file;
fl.fl_pid = current->tgid;
 
-   /* setlease checks to see if delegation should be handed out.
+   /* vfs_setlease checks to see if delegation should be handed out.
 * the lock_manager callbacks fl_mylease and fl_change are used
 */
-   if ((status = setlease(stp->st_vfs_file,
+   if ((status = vfs_setlease(stp->st_vfs_file,
flag == NFS4_OPEN_DELEGATE_

locks: provide a file lease method enabling cluster-coherent leases

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f9ffed26d6f3e6ac9988947242821579d615fda7
Commit: f9ffed26d6f3e6ac9988947242821579d615fda7
Parent: a9933cea7a1d80dd9efae9f1acd857f5dce742b9
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Tue Nov 14 15:51:40 2006 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:14:47 2007 -0400

locks: provide a file lease method enabling cluster-coherent leases

Currently leases are only kept locally, so there's no way for a distributed
filesystem to enforce them against multiple clients.  We're particularly
interested in the case of nfsd exporting a cluster filesystem, in which
case nfsd needs cluster-coherent leases in order to implement delegations
correctly.

Also add some documentation.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/locks.c |   24 ++--
 include/linux/fs.h |1 +
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index a65d85c..94f5d80 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1429,7 +1429,24 @@ out:
  * @lease: file_lock to use
  *
  * Call this to establish a lease on the file.
- * The fl_lmops fl_break function is required by break_lease
+ * The (*lease)->fl_lmops->fl_break operation must be set; if not,
+ * break_lease will oops!
+ *
+ * This will call the filesystem's setlease file method, if
+ * defined.  Note that there is no getlease method; instead, the
+ * filesystem setlease method should call back to setlease() to
+ * add a lease to the inode's lease list, where fcntl_getlease() can
+ * find it.  Since fcntl_getlease() only reports whether the current
+ * task holds a lease, a cluster filesystem need only do this for
+ * leases held by processes on this node.
+ *
+ * There is also no break_lease method; filesystems that
+ * handle their own leases shoud break leases themselves from the
+ * filesystem's open, create, and (on truncate) setattr methods.
+ *
+ * Warning: the only current setlease methods exist only to disable
+ * leases in certain cases.  More vfs changes may be required to
+ * allow a full filesystem lease implementation.
  */
 
 int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
@@ -1437,7 +1454,10 @@ int vfs_setlease(struct file *filp, long arg, struct 
file_lock **lease)
int error;
 
lock_kernel();
-   error = setlease(filp, arg, lease);
+   if (filp->f_op && filp->f_op->setlease)
+   error = filp->f_op->setlease(filp, arg, lease);
+   else
+   error = setlease(filp, arg, lease);
unlock_kernel();
 
return error;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a24f029..c8ddf34 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1122,6 +1122,7 @@ struct file_operations {
int (*flock) (struct file *, int, struct file_lock *);
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t 
*, size_t, unsigned int);
ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info 
*, size_t, unsigned int);
+   int (*setlease)(struct file *, long, struct file_lock **);
 };
 
 struct inode_operations {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


locks: clean up lease_alloc()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e32b8ee27b486f682a6d13533cfe6549c8abcdef
Commit: e32b8ee27b486f682a6d13533cfe6549c8abcdef
Parent: d2ab0b0c4c2570921a9ec1eff1e3a5143e05b231
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 1 14:34:35 2007 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:09:27 2007 -0400

locks: clean up lease_alloc()

Return the newly allocated structure as the return value instead of
using a struct ** parameter.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/locks.c |   21 +
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 3c23fd2..838ca54 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -458,22 +458,20 @@ static int lease_init(struct file *filp, int type, struct 
file_lock *fl)
 }
 
 /* Allocate a file_lock initialised to this type of lease */
-static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
+static struct file_lock *lease_alloc(struct file *filp, int type)
 {
struct file_lock *fl = locks_alloc_lock();
int error = -ENOMEM;
 
if (fl == NULL)
-   goto out;
+   return ERR_PTR(error);
 
error = lease_init(filp, type, fl);
if (error) {
locks_free_lock(fl);
-   fl = NULL;
+   return ERR_PTR(error);
}
-out:
-   *flp = fl;
-   return error;
+   return fl;
 }
 
 /* Check if two locks overlap each other.
@@ -1179,12 +1177,10 @@ int __break_lease(struct inode *inode, unsigned int 
mode)
int error = 0, future;
struct file_lock *new_fl, *flock;
struct file_lock *fl;
-   int alloc_err;
unsigned long break_time;
int i_have_this_lease = 0;
 
-   alloc_err = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK,
-   &new_fl);
+   new_fl = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK);
 
lock_kernel();
 
@@ -1212,8 +1208,9 @@ int __break_lease(struct inode *inode, unsigned int mode)
goto out;
}
 
-   if (alloc_err && !i_have_this_lease && ((mode & O_NONBLOCK) == 0)) {
-   error = alloc_err;
+   if (IS_ERR(new_fl) && !i_have_this_lease
+   && ((mode & O_NONBLOCK) == 0)) {
+   error = PTR_ERR(new_fl);
goto out;
}
 
@@ -1260,7 +1257,7 @@ restart:
 
 out:
unlock_kernel();
-   if (!alloc_err)
+   if (!IS_ERR(new_fl))
locks_free_lock(new_fl);
return error;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


locks: share more common lease code

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d5e8b05caf074ae5676ad9aaf92e381226a14a7
Commit: 6d5e8b05caf074ae5676ad9aaf92e381226a14a7
Parent: e32b8ee27b486f682a6d13533cfe6549c8abcdef
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Thu May 31 17:03:46 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:09:27 2007 -0400

locks: share more common lease code

Share more code between setlease (used by nfsd) and fcntl.

Also some minor cleanup.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
Acked-by: Christoph Hellwig <[EMAIL PROTECTED]>
---
 fs/locks.c |   30 ++
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 838ca54..0e5873b 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1343,6 +1343,14 @@ static int __setlease(struct file *filp, long arg, 
struct file_lock **flp)
struct inode *inode = dentry->d_inode;
int error, rdlease_count = 0, wrlease_count = 0;
 
+   if ((current->fsuid != inode->i_uid) && !capable(CAP_LEASE))
+   return -EACCES;
+   if (!S_ISREG(inode->i_mode))
+   return -EINVAL;
+   error = security_file_lock(filp, arg);
+   if (error)
+   return error;
+
time_out_leases(inode);
 
BUG_ON(!(*flp)->fl_lmops->fl_break);
@@ -1426,18 +1434,8 @@ out:
 
 int setlease(struct file *filp, long arg, struct file_lock **lease)
 {
-   struct dentry *dentry = filp->f_path.dentry;
-   struct inode *inode = dentry->d_inode;
int error;
 
-   if ((current->fsuid != inode->i_uid) && !capable(CAP_LEASE))
-   return -EACCES;
-   if (!S_ISREG(inode->i_mode))
-   return -EINVAL;
-   error = security_file_lock(filp, arg);
-   if (error)
-   return error;
-
lock_kernel();
error = __setlease(filp, arg, lease);
unlock_kernel();
@@ -1464,14 +1462,6 @@ int fcntl_setlease(unsigned int fd, struct file *filp, 
long arg)
struct inode *inode = dentry->d_inode;
int error;
 
-   if ((current->fsuid != inode->i_uid) && !capable(CAP_LEASE))
-   return -EACCES;
-   if (!S_ISREG(inode->i_mode))
-   return -EINVAL;
-   error = security_file_lock(filp, arg);
-   if (error)
-   return error;
-
locks_init_lock(&fl);
error = lease_init(filp, arg, &fl);
if (error)
@@ -1485,9 +1475,9 @@ int fcntl_setlease(unsigned int fd, struct file *filp, 
long arg)
 
error = fasync_helper(fd, filp, 1, &flp->fl_fasync);
if (error < 0) {
-   /* remove lease just inserted by __setlease */
+   /* remove lease just inserted by setlease */
flp->fl_type = F_UNLCK | F_INPROGRESS;
-   flp->fl_break_time = jiffies- 10;
+   flp->fl_break_time = jiffies - 10;
time_out_leases(inode);
goto out_unlock;
}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


leases: minor break_lease() comment clarification

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=87250dd26a34c65ae31d08837174222889007641
Commit: 87250dd26a34c65ae31d08837174222889007641
Parent: 8b4a40809e5330c9da5d20107d693d92d73b31dc
Author: david m. richter <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 16:10:27 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:09:27 2007 -0400

leases: minor break_lease() comment clarification

clarify that break_lease() checks for presence of any lock, not just leases.

Signed-off-by: David M. Richter <[EMAIL PROTECTED]>
Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/locks.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 431a8b8..924e4a7 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1169,9 +1169,9 @@ static void time_out_leases(struct inode *inode)
  * @inode: the inode of the file to return
  * @mode: the open mode (read or write)
  *
- * break_lease (inlined for speed) has checked there already
- * is a lease on this file.  Leases are broken on a call to open()
- * or truncate().  This function can sleep unless you
+ * break_lease (inlined for speed) has checked there already is at least
+ * some kind of lock (maybe a lease) on this file.  Leases are broken on
+ * a call to open() or truncate().  This function can sleep unless you
  * specified %O_NONBLOCK to your open().
  */
 int __break_lease(struct inode *inode, unsigned int mode)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


locks: convert an -EINVAL return to a BUG

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d2ab0b0c4c2570921a9ec1eff1e3a5143e05b231
Commit: d2ab0b0c4c2570921a9ec1eff1e3a5143e05b231
Parent: 87250dd26a34c65ae31d08837174222889007641
Author: J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Sat Jun 30 12:40:32 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:09:27 2007 -0400

locks: convert an -EINVAL return to a BUG

There's no point trying to return an error in these cases, which all 
represent
bugs in the callers.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/locks.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 924e4a7..3c23fd2 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1348,9 +1348,7 @@ static int __setlease(struct file *filp, long arg, struct 
file_lock **flp)
 
time_out_leases(inode);
 
-   error = -EINVAL;
-   if (!flp || !(*flp) || !(*flp)->fl_lmops || !(*flp)->fl_lmops->fl_break)
-   goto out;
+   BUG_ON(!(*flp)->fl_lmops->fl_break);
 
lease = *flp;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mthca: Factor out setting WQE UD segment entries

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e535c699bfeafd0380418156f93494e370613e9d
Commit: e535c699bfeafd0380418156f93494e370613e9d
Parent: 400ddc11eb01a8d04c580892fde3adbd45ebdc9e
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 13:21:14 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 13:21:14 2007 -0700

IB/mthca: Factor out setting WQE UD segment entries

Factor code to set UD entries out of the work request posting
functions into inline functions set_tavor_ud_seg() and
set_arbel_ud_seg().  This doesn't change the generated code in any
significant way, and makes the source easier on the eyes.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |   40 +--
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index 43d4d77..b5bd704 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1599,6 +1599,24 @@ static __always_inline void set_atomic_seg(struct 
mthca_atomic_seg *aseg,
 
 }
 
+static void set_tavor_ud_seg(struct mthca_tavor_ud_seg *useg,
+struct ib_send_wr *wr)
+{
+   useg->lkey= cpu_to_be32(to_mah(wr->wr.ud.ah)->key);
+   useg->av_addr = cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma);
+   useg->dqpn= cpu_to_be32(wr->wr.ud.remote_qpn);
+   useg->qkey= cpu_to_be32(wr->wr.ud.remote_qkey);
+
+}
+
+static void set_arbel_ud_seg(struct mthca_arbel_ud_seg *useg,
+struct ib_send_wr *wr)
+{
+   memcpy(useg->av, to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE);
+   useg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn);
+   useg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey);
+}
+
 int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
  struct ib_send_wr **bad_wr)
 {
@@ -1707,16 +1725,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
break;
 
case UD:
-   ((struct mthca_tavor_ud_seg *) wqe)->lkey =
-   cpu_to_be32(to_mah(wr->wr.ud.ah)->key);
-   ((struct mthca_tavor_ud_seg *) wqe)->av_addr =
-   cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma);
-   ((struct mthca_tavor_ud_seg *) wqe)->dqpn =
-   cpu_to_be32(wr->wr.ud.remote_qpn);
-   ((struct mthca_tavor_ud_seg *) wqe)->qkey =
-   cpu_to_be32(wr->wr.ud.remote_qkey);
-
-   wqe += sizeof (struct mthca_tavor_ud_seg);
+   set_tavor_ud_seg(wqe, wr);
+   wqe  += sizeof (struct mthca_tavor_ud_seg);
size += sizeof (struct mthca_tavor_ud_seg) / 16;
break;
 
@@ -2064,14 +2074,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
break;
 
case UD:
-   memcpy(((struct mthca_arbel_ud_seg *) wqe)->av,
-  to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE);
-   ((struct mthca_arbel_ud_seg *) wqe)->dqpn =
-   cpu_to_be32(wr->wr.ud.remote_qpn);
-   ((struct mthca_arbel_ud_seg *) wqe)->qkey =
-   cpu_to_be32(wr->wr.ud.remote_qkey);
-
-   wqe += sizeof (struct mthca_arbel_ud_seg);
+   set_arbel_ud_seg(wqe, wr);
+   wqe  += sizeof (struct mthca_arbel_ud_seg);
size += sizeof (struct mthca_arbel_ud_seg) / 16;
break;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mthca: Simplify use of size0 in work request posting

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=43509d1fece975ac457282ca1137fe438894a81d
Commit: 43509d1fece975ac457282ca1137fe438894a81d
Parent: e535c699bfeafd0380418156f93494e370613e9d
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 13:28:29 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 13:28:29 2007 -0700

IB/mthca: Simplify use of size0 in work request posting

Current code sets size0 to 0 at the start of work request posting
functions and then handles size0 == 0 specially within the loop over
work requests.  Change this so size0 is set along with f0 the first
time through the loop (when nreq == 0).  This makes the code easier to
understand by making it clearer that f0 and size0 are always
initialized if nreq != 0 without having to know that size0 == 0
implies nreq == 0.

Also annotate size0 with uninitialized_var() so that this doesn't
introduce a new compiler warning.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |   41 ++-
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index b5bd704..df01b20 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1629,13 +1629,14 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
int nreq;
int i;
int size;
-   int size0 = 0;
/*
-* f0 is only used if nreq != 0, and f0 will be initialized
-* the first time through the main loop, since size0 == 0 the
-* first time through.  So nreq cannot become non-zero without
-* initializing f0, and f0 is in fact never used uninitialized.
+* f0 and size0 are only used if nreq != 0, and they will
+* always be initialized the first time through the main loop
+* before nreq is incremented.  So nreq cannot become non-zero
+* without initializing f0 and size0, and they are in fact
+* never used uninitialized.
 */
+   int uninitialized_var(size0);
u32 uninitialized_var(f0);
int ind;
u8 op0 = 0;
@@ -1780,11 +1781,11 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
mthca_opcode[wr->opcode]);
wmb();
((struct mthca_next_seg *) prev_wqe)->ee_nds =
-   cpu_to_be32((size0 ? 0 : MTHCA_NEXT_DBD) | size |
+   cpu_to_be32((nreq ? 0 : MTHCA_NEXT_DBD) | size |
((wr->send_flags & IB_SEND_FENCE) ?
MTHCA_NEXT_FENCE : 0));
 
-   if (!size0) {
+   if (!nreq) {
size0 = size;
op0   = mthca_opcode[wr->opcode];
f0= wr->send_flags & IB_SEND_FENCE ?
@@ -1834,7 +1835,14 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct 
ib_recv_wr *wr,
int nreq;
int i;
int size;
-   int size0 = 0;
+   /*
+* size0 is only used if nreq != 0, and it will always be
+* initialized the first time through the main loop before
+* nreq is incremented.  So nreq cannot become non-zero
+* without initializing size0, and it is in fact never used
+* uninitialized.
+*/
+   int uninitialized_var(size0);
int ind;
void *wqe;
void *prev_wqe;
@@ -1888,7 +1896,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct 
ib_recv_wr *wr,
((struct mthca_next_seg *) prev_wqe)->ee_nds =
cpu_to_be32(MTHCA_NEXT_DBD | size);
 
-   if (!size0)
+   if (!nreq)
size0 = size;
 
++ind;
@@ -1910,7 +1918,6 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct 
ib_recv_wr *wr,
 
qp->rq.next_ind = ind;
qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
-   size0 = 0;
}
}
 
@@ -1952,13 +1959,14 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
int nreq;
int i;
int size;
-   int size0 = 0;
/*
-* f0 is only used if nreq != 0, and f0 will be initialized
-* the first time through the main loop, since size0 == 0 the
-* first time through.  So nreq cannot become non-zero without
-* initializing f0, and f0 is in fact never used uninitialized.
+* f0 and size0 are only used if nreq != 0, and they will
+* always be initialized the first time through the main loop
+* before nreq is incremented.  So nreq cannot become non-zero
+* without initializing f0 and siz

IB/mlx4: Factor out setting other WQE segments

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0fbfa6a9062c71b62ec216c0294b676b76e41661
Commit: 0fbfa6a9062c71b62ec216c0294b676b76e41661
Parent: d420d9e32f4bd741b2f0b7227a91941107f96b47
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 11:47:55 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 11:47:55 2007 -0700

IB/mlx4: Factor out setting other WQE segments

Factor code to set remote address, atomic and datagram segments out of
mlx4_ib_post_send() into small helper functions.  This doesn't change
the generated code in any significant way, and makes the source easier
on the eyes.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mlx4/qp.c |   67 +--
 1 files changed, 36 insertions(+), 31 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index a59c7f0..b5a24fb 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1183,6 +1183,35 @@ static int mlx4_wq_overflow(struct mlx4_ib_wq *wq, int 
nreq, struct ib_cq *ib_cq
return cur + nreq >= wq->max_post;
 }
 
+static __always_inline void set_raddr_seg(struct mlx4_wqe_raddr_seg *rseg,
+ u64 remote_addr, u32 rkey)
+{
+   rseg->raddr= cpu_to_be64(remote_addr);
+   rseg->rkey = cpu_to_be32(rkey);
+   rseg->reserved = 0;
+}
+
+static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, struct ib_send_wr 
*wr)
+{
+   if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP) {
+   aseg->swap_add = cpu_to_be64(wr->wr.atomic.swap);
+   aseg->compare  = cpu_to_be64(wr->wr.atomic.compare_add);
+   } else {
+   aseg->swap_add = cpu_to_be64(wr->wr.atomic.compare_add);
+   aseg->compare  = 0;
+   }
+
+}
+
+static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg,
+struct ib_send_wr *wr)
+{
+   memcpy(dseg->av, &to_mah(wr->wr.ud.ah)->av, sizeof (struct mlx4_av));
+   dseg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn);
+   dseg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey);
+
+}
+
 static void set_data_seg(struct mlx4_wqe_data_seg *dseg,
 struct ib_sge *sg)
 {
@@ -1246,26 +1275,13 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
switch (wr->opcode) {
case IB_WR_ATOMIC_CMP_AND_SWP:
case IB_WR_ATOMIC_FETCH_AND_ADD:
-   ((struct mlx4_wqe_raddr_seg *) wqe)->raddr =
-   cpu_to_be64(wr->wr.atomic.remote_addr);
-   ((struct mlx4_wqe_raddr_seg *) wqe)->rkey =
-   cpu_to_be32(wr->wr.atomic.rkey);
-   ((struct mlx4_wqe_raddr_seg *) wqe)->reserved = 
0;
-
+   set_raddr_seg(wqe, wr->wr.atomic.remote_addr,
+ wr->wr.atomic.rkey);
wqe  += sizeof (struct mlx4_wqe_raddr_seg);
 
-   if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP) {
-   ((struct mlx4_wqe_atomic_seg *) 
wqe)->swap_add =
-   cpu_to_be64(wr->wr.atomic.swap);
-   ((struct mlx4_wqe_atomic_seg *) 
wqe)->compare =
-   
cpu_to_be64(wr->wr.atomic.compare_add);
-   } else {
-   ((struct mlx4_wqe_atomic_seg *) 
wqe)->swap_add =
-   
cpu_to_be64(wr->wr.atomic.compare_add);
-   ((struct mlx4_wqe_atomic_seg *) 
wqe)->compare = 0;
-   }
-
+   set_atomic_seg(wqe, wr);
wqe  += sizeof (struct mlx4_wqe_atomic_seg);
+
size += (sizeof (struct mlx4_wqe_raddr_seg) +
 sizeof (struct mlx4_wqe_atomic_seg)) / 
16;
 
@@ -1274,15 +1290,10 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
case IB_WR_RDMA_READ:
case IB_WR_RDMA_WRITE:
case IB_WR_RDMA_WRITE_WITH_IMM:
-   ((struct mlx4_wqe_raddr_seg *) wqe)->raddr =
-   cpu_to_be64(wr->wr.rdma.remote_addr);
-   ((struct mlx4_wqe_raddr_seg *) wqe)->rkey =
-   cpu_to_be32(wr->wr.rdma.rkey);
-   ((struct mlx4_wqe_raddr_seg *) wqe)->reserved = 
0;
-
+   set_raddr_seg(wqe, wr->wr.r

IB/mthca: Factor out setting WQE remote address and atomic segment entries

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=400ddc11eb01a8d04c580892fde3adbd45ebdc9e
Commit: 400ddc11eb01a8d04c580892fde3adbd45ebdc9e
Parent: 0fbfa6a9062c71b62ec216c0294b676b76e41661
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 12:55:42 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 12:55:42 2007 -0700

IB/mthca: Factor out setting WQE remote address and atomic segment entries

Factor code to set remote address and atomic segment entries out of the
work request posting functions into inline functions set_raddr_seg()
and set_atomic_seg().  This doesn't change the generated code in any
significant way, and makes the source easier on the eyes.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |   99 +---
 1 files changed, 40 insertions(+), 59 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index 2548250..43d4d77 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1578,6 +1578,27 @@ static inline int mthca_wq_overflow(struct mthca_wq *wq, 
int nreq,
return cur + nreq >= wq->max;
 }
 
+static __always_inline void set_raddr_seg(struct mthca_raddr_seg *rseg,
+ u64 remote_addr, u32 rkey)
+{
+   rseg->raddr= cpu_to_be64(remote_addr);
+   rseg->rkey = cpu_to_be32(rkey);
+   rseg->reserved = 0;
+}
+
+static __always_inline void set_atomic_seg(struct mthca_atomic_seg *aseg,
+  struct ib_send_wr *wr)
+{
+   if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP) {
+   aseg->swap_add = cpu_to_be64(wr->wr.atomic.swap);
+   aseg->compare  = cpu_to_be64(wr->wr.atomic.compare_add);
+   } else {
+   aseg->swap_add = cpu_to_be64(wr->wr.atomic.compare_add);
+   aseg->compare  = 0;
+   }
+
+}
+
 int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
  struct ib_send_wr **bad_wr)
 {
@@ -1642,25 +1663,11 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
switch (wr->opcode) {
case IB_WR_ATOMIC_CMP_AND_SWP:
case IB_WR_ATOMIC_FETCH_AND_ADD:
-   ((struct mthca_raddr_seg *) wqe)->raddr =
-   cpu_to_be64(wr->wr.atomic.remote_addr);
-   ((struct mthca_raddr_seg *) wqe)->rkey =
-   cpu_to_be32(wr->wr.atomic.rkey);
-   ((struct mthca_raddr_seg *) wqe)->reserved = 0;
-
+   set_raddr_seg(wqe, wr->wr.atomic.remote_addr,
+ wr->wr.atomic.rkey);
wqe += sizeof (struct mthca_raddr_seg);
 
-   if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP) {
-   ((struct mthca_atomic_seg *) 
wqe)->swap_add =
-   cpu_to_be64(wr->wr.atomic.swap);
-   ((struct mthca_atomic_seg *) 
wqe)->compare =
-   
cpu_to_be64(wr->wr.atomic.compare_add);
-   } else {
-   ((struct mthca_atomic_seg *) 
wqe)->swap_add =
-   
cpu_to_be64(wr->wr.atomic.compare_add);
-   ((struct mthca_atomic_seg *) 
wqe)->compare = 0;
-   }
-
+   set_atomic_seg(wqe, wr);
wqe += sizeof (struct mthca_atomic_seg);
size += (sizeof (struct mthca_raddr_seg) +
 sizeof (struct mthca_atomic_seg)) / 16;
@@ -1669,12 +1676,9 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
case IB_WR_RDMA_WRITE:
case IB_WR_RDMA_WRITE_WITH_IMM:
case IB_WR_RDMA_READ:
-   ((struct mthca_raddr_seg *) wqe)->raddr =
-   cpu_to_be64(wr->wr.rdma.remote_addr);
-   ((struct mthca_raddr_seg *) wqe)->rkey =
-   cpu_to_be32(wr->wr.rdma.rkey);
-   ((struct mthca_raddr_seg *) wqe)->reserved = 0;
-   wqe += sizeof (struct mthca_raddr_seg);
+   set_raddr_seg(wqe, wr->wr.rdma.remote_addr,
+ wr->wr.rdma.rkey);
+   wqe  += sizeof (struct m

IB/mlx4: Factor out setting WQE data segment entries

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d420d9e32f4bd741b2f0b7227a91941107f96b47
Commit: d420d9e32f4bd741b2f0b7227a91941107f96b47
Parent: 80885456e844552044c8c5f1f9bf0f6773b187ea
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 11:46:27 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 11:46:27 2007 -0700

IB/mlx4: Factor out setting WQE data segment entries

Factor code to set data segment entries out of mlx4_ib_post_send()
into set_data_seg().  This cleans up the code and lets the compiler do
a better job -- on x86_64:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16)
function old new   delta
mlx4_ib_post_send   15981582 -16

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mlx4/qp.c |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 8d09aa3..a59c7f0 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1183,6 +1183,14 @@ static int mlx4_wq_overflow(struct mlx4_ib_wq *wq, int 
nreq, struct ib_cq *ib_cq
return cur + nreq >= wq->max_post;
 }
 
+static void set_data_seg(struct mlx4_wqe_data_seg *dseg,
+struct ib_sge *sg)
+{
+   dseg->byte_count = cpu_to_be32(sg->length);
+   dseg->lkey   = cpu_to_be32(sg->lkey);
+   dseg->addr   = cpu_to_be64(sg->addr);
+}
+
 int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
  struct ib_send_wr **bad_wr)
 {
@@ -1313,12 +1321,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
}
 
for (i = 0; i < wr->num_sge; ++i) {
-   ((struct mlx4_wqe_data_seg *) wqe)->byte_count =
-   cpu_to_be32(wr->sg_list[i].length);
-   ((struct mlx4_wqe_data_seg *) wqe)->lkey =
-   cpu_to_be32(wr->sg_list[i].lkey);
-   ((struct mlx4_wqe_data_seg *) wqe)->addr =
-   cpu_to_be64(wr->sg_list[i].addr);
+   set_data_seg(wqe, wr->sg_list + i);
 
wqe  += sizeof (struct mlx4_wqe_data_seg);
size += sizeof (struct mlx4_wqe_data_seg) / 16;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mlx4: Return receive queue sizes for userspace QPs from query QP

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7f5eb9bb8c7fb3bd411674b856872d7ab4a7b1a3
Commit: 7f5eb9bb8c7fb3bd411674b856872d7ab4a7b1a3
Parent: c9f2ba5ed26a204a78bf23aa08a4f528f11a18f4
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 20:59:02 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 20:59:02 2007 -0700

IB/mlx4: Return receive queue sizes for userspace QPs from query QP

Return the receive queue sizes for both userspace QPs and kernel Qps
(not just kernel QPs) from mlx4_ib_query_qp().  Also zero the send
queue sizes for userspace QPs to avoid a possible information leak,
and set the max_inline_data for kernel QPs to 0 since inline sends are
not supported for kernel QPs.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mlx4/qp.c |   24 
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 0793059..8d09aa3 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1581,17 +1581,25 @@ int mlx4_ib_query_qp(struct ib_qp *ibqp, struct 
ib_qp_attr *qp_attr, int qp_attr
 
 done:
qp_attr->cur_qp_state= qp_attr->qp_state;
+   qp_attr->cap.max_recv_wr = qp->rq.wqe_cnt;
+   qp_attr->cap.max_recv_sge= qp->rq.max_gs;
+
if (!ibqp->uobject) {
-   qp_attr->cap.max_send_wr = qp->sq.wqe_cnt;
-   qp_attr->cap.max_recv_wr = qp->rq.wqe_cnt;
-   qp_attr->cap.max_send_sge= qp->sq.max_gs;
-   qp_attr->cap.max_recv_sge= qp->rq.max_gs;
-   qp_attr->cap.max_inline_data = (1 << qp->sq.wqe_shift) -
-   send_wqe_overhead(qp->ibqp.qp_type) -
-   sizeof (struct mlx4_wqe_inline_seg);
-   qp_init_attr->cap= qp_attr->cap;
+   qp_attr->cap.max_send_wr  = qp->sq.wqe_cnt;
+   qp_attr->cap.max_send_sge = qp->sq.max_gs;
+   } else {
+   qp_attr->cap.max_send_wr  = 0;
+   qp_attr->cap.max_send_sge = 0;
}
 
+   /*
+* We don't support inline sends for kernel QPs (yet), and we
+* don't know what userspace's value should be.
+*/
+   qp_attr->cap.max_inline_data = 0;
+
+   qp_init_attr->cap= qp_attr->cap;
+
return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mthca: Factor out setting WQE data segment entries

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=80885456e844552044c8c5f1f9bf0f6773b187ea
Commit: 80885456e844552044c8c5f1f9bf0f6773b187ea
Parent: 7f5eb9bb8c7fb3bd411674b856872d7ab4a7b1a3
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 18 11:30:34 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 11:30:34 2007 -0700

IB/mthca: Factor out setting WQE data segment entries

Factor code to set data segment entries out of the work request
posting functions into inline functions mthca_set_data_seg() and
mthca_set_data_seg_inval().  This makes the code more readable and
also allows the compiler to do a better job -- on x86_64:

add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-69 (-69)
function old new   delta
mthca_arbel_post_srq_recv373 369  -4
mthca_arbel_post_receive 570 562  -8
mthca_tavor_post_srq_recv520 508 -12
mthca_tavor_post_send   13441330 -14
mthca_arbel_post_send   14811467 -14
mthca_tavor_post_receive 792 775 -17

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c  |   41 +++
 drivers/infiniband/hw/mthca/mthca_srq.c |   28 
 drivers/infiniband/hw/mthca/mthca_wqe.h |   15 +++
 3 files changed, 30 insertions(+), 54 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index 0e9ef24..2548250 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1740,13 +1740,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
}
 
for (i = 0; i < wr->num_sge; ++i) {
-   ((struct mthca_data_seg *) wqe)->byte_count =
-   cpu_to_be32(wr->sg_list[i].length);
-   ((struct mthca_data_seg *) wqe)->lkey =
-   cpu_to_be32(wr->sg_list[i].lkey);
-   ((struct mthca_data_seg *) wqe)->addr =
-   cpu_to_be64(wr->sg_list[i].addr);
-   wqe += sizeof (struct mthca_data_seg);
+   mthca_set_data_seg(wqe, wr->sg_list + i);
+   wqe  += sizeof (struct mthca_data_seg);
size += sizeof (struct mthca_data_seg) / 16;
}
 
@@ -1869,13 +1864,8 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct 
ib_recv_wr *wr,
}
 
for (i = 0; i < wr->num_sge; ++i) {
-   ((struct mthca_data_seg *) wqe)->byte_count =
-   cpu_to_be32(wr->sg_list[i].length);
-   ((struct mthca_data_seg *) wqe)->lkey =
-   cpu_to_be32(wr->sg_list[i].lkey);
-   ((struct mthca_data_seg *) wqe)->addr =
-   cpu_to_be64(wr->sg_list[i].addr);
-   wqe += sizeof (struct mthca_data_seg);
+   mthca_set_data_seg(wqe, wr->sg_list + i);
+   wqe  += sizeof (struct mthca_data_seg);
size += sizeof (struct mthca_data_seg) / 16;
}
 
@@ -2125,13 +2115,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
}
 
for (i = 0; i < wr->num_sge; ++i) {
-   ((struct mthca_data_seg *) wqe)->byte_count =
-   cpu_to_be32(wr->sg_list[i].length);
-   ((struct mthca_data_seg *) wqe)->lkey =
-   cpu_to_be32(wr->sg_list[i].lkey);
-   ((struct mthca_data_seg *) wqe)->addr =
-   cpu_to_be64(wr->sg_list[i].addr);
-   wqe += sizeof (struct mthca_data_seg);
+   mthca_set_data_seg(wqe, wr->sg_list + i);
+   wqe  += sizeof (struct mthca_data_seg);
size += sizeof (struct mthca_data_seg) / 16;
}
 
@@ -2253,20 +2238,12 @@ int mthca_arbel_post_receive(struct ib_qp *ibqp, struct 
ib_recv_wr *wr,
}
 
for (i = 0; i < wr->num_sge; ++i) {
-   ((struct mthca_data_seg *) wqe)->byte_count =
-   cpu_to_be32(wr->sg_list[i].length);
-   ((struct mthca_data_seg *) wqe)->lkey =
-   cpu_to_be32(wr->sg_list[i].lkey);
-   ((struct mthca_data_seg *) wqe)->addr =
-   cpu_to_be64(wr->sg_list[i].addr);
+   mthca_set_data_seg(wqe, wr->sg_lis

IB/mlx4: Increase max outstanding RDMA reads as target

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9f2ba5ed26a204a78bf23aa08a4f528f11a18f4
Commit: c9f2ba5ed26a204a78bf23aa08a4f528f11a18f4
Parent: 8f076531cd20fbf83ed889024c8133d0c71a1fe4
Author: Jack Morgenstein <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 13:11:43 2007 +0300
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 20:50:50 2007 -0700

IB/mlx4: Increase max outstanding RDMA reads as target

Change the maximum number of outstanding RDMA reads allowed as a
target from 4 to 16 to per QP.  This allows RDMA read operations to
pipeline better.

Pointed out by Dotan Barak and Sagi Rotem.

Signed-off-by: Jack Morgenstein <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/net/mlx4/main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index e8f45e6..4dc9dc1 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -78,7 +78,7 @@ static const char mlx4_version[] __devinitdata =
 static struct mlx4_profile default_profile = {
.num_qp = 1 << 16,
.num_srq= 1 << 16,
-   .rdmarc_per_qp  = 4,
+   .rdmarc_per_qp  = 1 << 4,
.num_cq = 1 << 16,
.num_mcg= 1 << 13,
.num_mpt= 1 << 17,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RDMA/cma: Remove local write permission from QP access flags

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8f076531cd20fbf83ed889024c8133d0c71a1fe4
Commit: 8f076531cd20fbf83ed889024c8133d0c71a1fe4
Parent: 6d7d080e9f7cd535a8821efd3835c5cfa5223ab6
Author: Dotan Barak <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 17:58:57 2007 +0300
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 20:30:22 2007 -0700

RDMA/cma: Remove local write permission from QP access flags

Local write permission makes no sense as part of the QP access flags,
since the access flags only control what the remote end of the
connection is allowed to do.  Remove the code in the RDMA CM that
initializes qp_access_flags with IB_ACCESS_LOCAL_WRITE.

Signed-off-by: Dotan Barak <[EMAIL PROTECTED]>
Acked-by: Sean Hefty <[EMAIL PROTECTED]>
Acked-by: Steve Wise <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/cma.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 23af7a0..9ffb998 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -573,7 +573,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct 
ib_qp_attr *qp_attr,
break;
case RDMA_TRANSPORT_IWARP:
if (!id_priv->cm_id.iw) {
-   qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE;
+   qp_attr->qp_access_flags = 0;
*qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS;
} else
ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/cm: Make internal function cm_get_ack_delay() static

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=454a01e7f486279b0bf8979d94203ab7a503e053
Commit: 454a01e7f486279b0bf8979d94203ab7a503e053
Parent: 1743b91710053d00e05632d63de7c457c649042f
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:43 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:43 2007 -0700

IB/cm: Make internal function cm_get_ack_delay() static

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/cm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 9820c67..4df269f 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3374,7 +3374,7 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
 }
 EXPORT_SYMBOL(ib_cm_init_qp_attr);
 
-void cm_get_ack_delay(struct cm_device *cm_dev)
+static void cm_get_ack_delay(struct cm_device *cm_dev)
 {
struct ib_device_attr attr;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mthca: Use uninitialized_var() for f0

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d7d080e9f7cd535a8821efd3835c5cfa5223ab6
Commit: 6d7d080e9f7cd535a8821efd3835c5cfa5223ab6
Parent: 454a01e7f486279b0bf8979d94203ab7a503e053
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 19:30:51 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 19:30:51 2007 -0700

IB/mthca: Use uninitialized_var() for f0

Commit 9db48926 ("drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd
var warning") added "= 0" to the declarations of f0 to shut up gcc
warnings.  However, there's no point in making the code bigger by
initializing f0 to a random value just to get rid of a warning;
setting f0 to 0 is no safer than just using uninitialized_var(), which
documents the situation better and gives smaller code too.  For example,
on x86_64:

add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16 (-16)
function old new   delta
mthca_tavor_post_send   13521344  -8
mthca_arbel_post_send   14891481  -8

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index 11f1d99..0e9ef24 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1591,7 +1591,13 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
int i;
int size;
int size0 = 0;
-   u32 f0 = 0;
+   /*
+* f0 is only used if nreq != 0, and f0 will be initialized
+* the first time through the main loop, since size0 == 0 the
+* first time through.  So nreq cannot become non-zero without
+* initializing f0, and f0 is in fact never used uninitialized.
+*/
+   u32 uninitialized_var(f0);
int ind;
u8 op0 = 0;
 
@@ -1946,7 +1952,13 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
int i;
int size;
int size0 = 0;
-   u32 f0 = 0;
+   /*
+* f0 is only used if nreq != 0, and f0 will be initialized
+* the first time through the main loop, since size0 == 0 the
+* first time through.  So nreq cannot become non-zero without
+* initializing f0, and f0 is in fact never used uninitialized.
+*/
+   u32 uninitialized_var(f0);
int ind;
u8 op0 = 0;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/ipath: Remove ipath_get_user_pages_nocopy()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1743b91710053d00e05632d63de7c457c649042f
Commit: 1743b91710053d00e05632d63de7c457c649042f
Parent: da9aec7b627c0369b955f82e855508c6711929ac
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:43 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:43 2007 -0700

IB/ipath: Remove ipath_get_user_pages_nocopy()

It has no callers and is completely dead code.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ipath/ipath_kernel.h |1 -
 drivers/infiniband/hw/ipath/ipath_user_pages.c |   26 
 2 files changed, 0 insertions(+), 27 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h 
b/drivers/infiniband/hw/ipath/ipath_kernel.h
index b6ccd04..ace63ef 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -819,7 +819,6 @@ static inline u64 ipath_mdio_req(int cmd, int dev, int reg, 
int data)
 #define IPATH_MDIO_CTRL_8355_REG_10 0x1D
 
 int ipath_get_user_pages(unsigned long, size_t, struct page **);
-int ipath_get_user_pages_nocopy(unsigned long, struct page **);
 void ipath_release_user_pages(struct page **, size_t);
 void ipath_release_user_pages_on_close(struct page **, size_t);
 int ipath_eeprom_read(struct ipath_devdata *, u8, void *, int);
diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c 
b/drivers/infiniband/hw/ipath/ipath_user_pages.c
index 27034d3..0190edc 100644
--- a/drivers/infiniband/hw/ipath/ipath_user_pages.c
+++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c
@@ -171,32 +171,6 @@ int ipath_get_user_pages(unsigned long start_page, size_t 
num_pages,
return ret;
 }
 
-/**
- * ipath_get_user_pages_nocopy - lock a single page for I/O and mark shared
- * @start_page: the page to lock
- * @p: the output page structure
- *
- * This is similar to ipath_get_user_pages, but it's always one page, and we
- * mark the page as locked for I/O, and shared.  This is used for the user
- * process page that contains the destination address for the rcvhdrq tail
- * update, so we need to have the vma. If we don't do this, the page can be
- * taken away from us on fork, even if the child never touches it, and then
- * the user process never sees the tail register updates.
- */
-int ipath_get_user_pages_nocopy(unsigned long page, struct page **p)
-{
-   struct vm_area_struct *vma;
-   int ret;
-
-   down_write(¤t->mm->mmap_sem);
-
-   ret = __get_user_pages(page, 1, p, &vma);
-
-   up_write(¤t->mm->mmap_sem);
-
-   return ret;
-}
-
 void ipath_release_user_pages(struct page **p, size_t num_pages)
 {
down_write(¤t->mm->mmap_sem);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


mlx4_core: Reset device when internal error is detected

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ee49bd9397cd2b8fe7a1962505d81c1d0a1366fc
Commit: ee49bd9397cd2b8fe7a1962505d81c1d0a1366fc
Parent: 41179e2de6962b46d1d9f2b4437243ac740efdec
Author: Jack Morgenstein <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:50:45 2007 +0300
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:42 2007 -0700

mlx4_core: Reset device when internal error is detected

Reset the device when an internal error is detected.

Also, detect errors by polling the error buffer rather than using
interrupts.  This is more robust and doesn't depend on MSI-X.  Remove
the old interrupt handler entirely, since we don't want to support two
mechanisms for detecting internal errors.

Signed-off-by: Jack Morgenstein <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/net/mlx4/catas.c |  106 +++---
 drivers/net/mlx4/eq.c|   56 +++-
 drivers/net/mlx4/intf.c  |2 +
 drivers/net/mlx4/main.c  |   24 ++-
 drivers/net/mlx4/mlx4.h  |   13 --
 5 files changed, 129 insertions(+), 72 deletions(-)

diff --git a/drivers/net/mlx4/catas.c b/drivers/net/mlx4/catas.c
index 1bb088a..6b32ec9 100644
--- a/drivers/net/mlx4/catas.c
+++ b/drivers/net/mlx4/catas.c
@@ -30,41 +30,133 @@
  * SOFTWARE.
  */
 
+#include 
+
 #include "mlx4.h"
 
-void mlx4_handle_catas_err(struct mlx4_dev *dev)
+enum {
+   MLX4_CATAS_POLL_INTERVAL= 5 * HZ,
+};
+
+static DEFINE_SPINLOCK(catas_lock);
+
+static LIST_HEAD(catas_list);
+static struct workqueue_struct *catas_wq;
+static struct work_struct catas_work;
+
+static int internal_err_reset = 1;
+module_param(internal_err_reset, int, 0644);
+MODULE_PARM_DESC(internal_err_reset,
+"Reset device on internal errors if non-zero (default 1)");
+
+static void dump_err_buf(struct mlx4_dev *dev)
 {
struct mlx4_priv *priv = mlx4_priv(dev);
 
int i;
 
-   mlx4_err(dev, "Catastrophic error detected:\n");
+   mlx4_err(dev, "Internal error detected:\n");
for (i = 0; i < priv->fw.catas_size; ++i)
mlx4_err(dev, "  buf[%02x]: %08x\n",
 i, swab32(readl(priv->catas_err.map + i)));
+}
 
-   mlx4_dispatch_event(dev, MLX4_EVENT_TYPE_LOCAL_CATAS_ERROR, 0, 0);
+static void poll_catas(unsigned long dev_ptr)
+{
+   struct mlx4_dev *dev = (struct mlx4_dev *) dev_ptr;
+   struct mlx4_priv *priv = mlx4_priv(dev);
+
+   if (readl(priv->catas_err.map)) {
+   dump_err_buf(dev);
+
+   mlx4_dispatch_event(dev, MLX4_EVENT_TYPE_LOCAL_CATAS_ERROR, 0, 
0);
+
+   if (internal_err_reset) {
+   spin_lock(&catas_lock);
+   list_add(&priv->catas_err.list, &catas_list);
+   spin_unlock(&catas_lock);
+
+   queue_work(catas_wq, &catas_work);
+   }
+   } else
+   mod_timer(&priv->catas_err.timer,
+ round_jiffies(jiffies + MLX4_CATAS_POLL_INTERVAL));
 }
 
-void mlx4_map_catas_buf(struct mlx4_dev *dev)
+static void catas_reset(struct work_struct *work)
+{
+   struct mlx4_priv *priv, *tmppriv;
+   struct mlx4_dev *dev;
+
+   LIST_HEAD(tlist);
+   int ret;
+
+   spin_lock_irq(&catas_lock);
+   list_splice_init(&catas_list, &tlist);
+   spin_unlock_irq(&catas_lock);
+
+   list_for_each_entry_safe(priv, tmppriv, &tlist, catas_err.list) {
+   ret = mlx4_restart_one(priv->dev.pdev);
+   dev = &priv->dev;
+   if (ret)
+   mlx4_err(dev, "Reset failed (%d)\n", ret);
+   else
+   mlx4_dbg(dev, "Reset succeeded\n");
+   }
+}
+
+void mlx4_start_catas_poll(struct mlx4_dev *dev)
 {
struct mlx4_priv *priv = mlx4_priv(dev);
unsigned long addr;
 
+   INIT_LIST_HEAD(&priv->catas_err.list);
+   init_timer(&priv->catas_err.timer);
+   priv->catas_err.map = NULL;
+
addr = pci_resource_start(dev->pdev, priv->fw.catas_bar) +
priv->fw.catas_offset;
 
priv->catas_err.map = ioremap(addr, priv->fw.catas_size * 4);
-   if (!priv->catas_err.map)
-   mlx4_warn(dev, "Failed to map catastrophic error buffer at 
0x%lx\n",
+   if (!priv->catas_err.map) {
+   mlx4_warn(dev, "Failed to map internal error buffer at 0x%lx\n",
  addr);
+   return;
+   }
 
+   priv->catas_err.timer.data = (unsigned long) dev;
+   priv->catas_err.timer.function = poll_catas;
+   priv->catas_err.timer.expires  =
+   round_jiffies(jiffies + MLX4_CATAS_POLL_INTERVAL);
+   add_timer(&priv->catas_err.timer);
 }
 
-void mlx4_unmap_catas_buf(struct mlx4_dev *dev)
+void mlx4_stop_catas_poll(struct mlx4_dev *dev)
 {

IB/ipath: Make a few functions static

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=da9aec7b627c0369b955f82e855508c6711929ac
Commit: da9aec7b627c0369b955f82e855508c6711929ac
Parent: ee49bd9397cd2b8fe7a1962505d81c1d0a1366fc
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:43 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:43 2007 -0700

IB/ipath: Make a few functions static

Make some functions that are only used in a single .c file static.  In
addition to being a cleanup, this shrinks the generated code.  On x86_64:

add/remove: 1/3 grow/shrink: 2/1 up/down: 4777/-4956 (-179)
function old new   delta
handle_errors  -3994   +3994
__verbs_timer 42 710+668
ipath_do_ruc_send   21312246+115
ipath_no_bufs_available  136   --136
ipath_disarm_senderrbufs 639   --639
ipath_ib_timer   658   --658
ipath_intr  58782355   -3523

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ipath/ipath_driver.c |2 +-
 drivers/infiniband/hw/ipath/ipath_eeprom.c |4 ++--
 drivers/infiniband/hw/ipath/ipath_intr.c   |2 +-
 drivers/infiniband/hw/ipath/ipath_kernel.h |1 -
 drivers/infiniband/hw/ipath/ipath_ruc.c|2 +-
 drivers/infiniband/hw/ipath/ipath_verbs.c  |2 +-
 drivers/infiniband/hw/ipath/ipath_verbs.h  |4 
 7 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c 
b/drivers/infiniband/hw/ipath/ipath_driver.c
index 9361f5a..09c5fd8 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -1889,7 +1889,7 @@ void ipath_write_kreg_port(const struct ipath_devdata 
*dd, ipath_kreg regno,
 /* Below is "non-zero" to force override, but both actual LEDs are off */
 #define LED_OVER_BOTH_OFF (8)
 
-void ipath_run_led_override(unsigned long opaque)
+static void ipath_run_led_override(unsigned long opaque)
 {
struct ipath_devdata *dd = (struct ipath_devdata *)opaque;
int timeoff;
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c 
b/drivers/infiniband/hw/ipath/ipath_eeprom.c
index 6b91479..b4503e9 100644
--- a/drivers/infiniband/hw/ipath/ipath_eeprom.c
+++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c
@@ -426,8 +426,8 @@ bail:
  * @buffer: data to write
  * @len: number of bytes to write
  */
-int ipath_eeprom_internal_write(struct ipath_devdata *dd, u8 eeprom_offset,
-   const void *buffer, int len)
+static int ipath_eeprom_internal_write(struct ipath_devdata *dd, u8 
eeprom_offset,
+  const void *buffer, int len)
 {
u8 single_byte;
int sub_len;
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c 
b/drivers/infiniband/hw/ipath/ipath_intr.c
index 47aa434..1fd91c5 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -70,7 +70,7 @@ static void ipath_clrpiobuf(struct ipath_devdata *dd, u32 
pnum)
  * If rewrite is true, and bits are set in the sendbufferror registers,
  * we'll write to the buffer, for error recovery on parity errors.
  */
-void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite)
+static void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite)
 {
u32 piobcnt;
unsigned long sbuf[4];
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h 
b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 3105005..b6ccd04 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -776,7 +776,6 @@ void ipath_get_eeprom_info(struct ipath_devdata *);
 int ipath_update_eeprom_log(struct ipath_devdata *dd);
 void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr);
 u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg);
-void ipath_disarm_senderrbufs(struct ipath_devdata *, int);
 
 /*
  * Set LED override, only the two LSBs have "public" meaning, but
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c 
b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 8525674..c69c252 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -507,7 +507,7 @@ static int want_buffer(struct ipath_devdata *dd)
  *
  * Called when we run out of PIO buffers.
  */
-void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev)
+static void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev 
*dev)
 {
unsigned long flags;
 
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c 
b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 65f7181..16aa61f 100644
--- a/drivers/infiniband

IB/iser: Make a couple of functions static

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41179e2de6962b46d1d9f2b4437243ac740efdec
Commit: 41179e2de6962b46d1d9f2b4437243ac740efdec
Parent: e4daf738683d9e87caf12f4249268d3c9ed2e00f
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:42 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:42 2007 -0700

IB/iser: Make a couple of functions static

Make iser_conn_release() and iser_start_rdma_unaligned_sg() static,
since they are only used in the .c file where they are defined.  In
addition to being a cleanup, this even shrinks the generated code by
allowing the single call of iser_start_rdma_unaligned_sg() to be
inlined into its callsite.  On x86_64:

add/remove: 0/1 grow/shrink: 1/0 up/down: 466/-533 (-67)
function old new   delta
iser_reg_rdma_mem   15181984+466
iser_start_rdma_unaligned_sg 533   --533

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/ulp/iser/iscsi_iser.h  |5 ---
 drivers/infiniband/ulp/iser/iser_memory.c |4 +-
 drivers/infiniband/ulp/iser/iser_verbs.c  |   47 ++---
 3 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h 
b/drivers/infiniband/ulp/iser/iscsi_iser.h
index e235370..1ee867b 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -310,8 +310,6 @@ int  iser_conn_init(struct iser_conn **ib_conn);
 
 void iser_conn_terminate(struct iser_conn *ib_conn);
 
-void iser_conn_release(struct iser_conn *ib_conn);
-
 void iser_rcv_completion(struct iser_desc *desc,
 unsigned longdto_xfer_len);
 
@@ -329,9 +327,6 @@ void iser_reg_single(struct iser_device  *device,
 struct iser_regd_buf*regd_buf,
 enum dma_data_direction direction);
 
-int  iser_start_rdma_unaligned_sg(struct iscsi_iser_cmd_task*ctask,
- enum iser_data_dircmd_dir);
-
 void iser_finalize_rdma_unaligned_sg(struct iscsi_iser_cmd_task *ctask,
 enum iser_data_dir cmd_dir);
 
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c 
b/drivers/infiniband/ulp/iser/iser_memory.c
index fc9f1fd..36cdf77 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -103,8 +103,8 @@ void iser_reg_single(struct iser_device *device,
 /**
  * iser_start_rdma_unaligned_sg
  */
-int iser_start_rdma_unaligned_sg(struct iscsi_iser_cmd_task  *iser_ctask,
-enum iser_data_dir cmd_dir)
+static int iser_start_rdma_unaligned_sg(struct iscsi_iser_cmd_task *iser_ctask,
+   enum iser_data_dir cmd_dir)
 {
int dma_nents;
struct ib_device *dev;
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c 
b/drivers/infiniband/ulp/iser/iser_verbs.c
index 2044de1..d42ec01 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -311,6 +311,29 @@ static int iser_conn_state_comp_exch(struct iser_conn 
*ib_conn,
 }
 
 /**
+ * Frees all conn objects and deallocs conn descriptor
+ */
+static void iser_conn_release(struct iser_conn *ib_conn)
+{
+   struct iser_device  *device = ib_conn->device;
+
+   BUG_ON(ib_conn->state != ISER_CONN_DOWN);
+
+   mutex_lock(&ig.connlist_mutex);
+   list_del(&ib_conn->conn_list);
+   mutex_unlock(&ig.connlist_mutex);
+
+   iser_free_ib_conn_res(ib_conn);
+   ib_conn->device = NULL;
+   /* on EVENT_ADDR_ERROR there's no device yet for this conn */
+   if (device != NULL)
+   iser_device_try_release(device);
+   if (ib_conn->iser_conn)
+   ib_conn->iser_conn->ib_conn = NULL;
+   kfree(ib_conn);
+}
+
+/**
  * triggers start of the disconnect procedures and wait for them to be done
  */
 void iser_conn_terminate(struct iser_conn *ib_conn)
@@ -550,30 +573,6 @@ connect_failure:
 }
 
 /**
- * Frees all conn objects and deallocs conn descriptor
- */
-void iser_conn_release(struct iser_conn *ib_conn)
-{
-   struct iser_device  *device = ib_conn->device;
-
-   BUG_ON(ib_conn->state != ISER_CONN_DOWN);
-
-   mutex_lock(&ig.connlist_mutex);
-   list_del(&ib_conn->conn_list);
-   mutex_unlock(&ig.connlist_mutex);
-
-   iser_free_ib_conn_res(ib_conn);
-   ib_conn->device = NULL;
-   /* on EVENT_ADDR_ERROR there's no device yet for this conn */
-   if (device != NULL)
-   iser_device_try_release(device);
-   if (ib_conn->iser_conn)
-   ib_conn->iser_conn->ib_conn = NULL;
-   kfree(ib_conn);
-}
-
-
-/**
  * iser_reg_page_vec - Register physical memory
  *
  * returns: 0

IB/mthca: Schedule MSI support for removal

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f6be6fbe262d065e85be159ea27460852f13ec90
Commit: f6be6fbe262d065e85be159ea27460852f13ec90
Parent: 2b94397adc68c2f0f851539884cc426e03444a26
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:41 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:41 2007 -0700

IB/mthca: Schedule MSI support for removal

The mthca driver supports both MSI and MSI-X.  However, MSI-X works with
all hardware that the driver handles, and provides a superset of what
MSI does, so there's no point in having code for both.  Schedule MSI
support for removal in 2008 to give anyone who actually needs MSI and
who can't use MSI time to speak up.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 Documentation/feature-removal-schedule.txt |   10 ++
 drivers/infiniband/hw/mthca/mthca_main.c   |   20 
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index d05e624..d245c63 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -310,3 +310,13 @@ Why:  The arch/powerpc tree is the merged architecture for 
ppc32 and ppc64
 Who:  [EMAIL PROTECTED]
 
 ---
+
+What:  mthca driver's MSI support
+When:  January 2008
+Files: drivers/infiniband/hw/mthca/*.[ch]
+Why:   All mthca hardware also supports MSI-X, which provides
+   strictly more functionality than MSI.  So there is no point in
+   having both MSI-X and MSI support in the driver.
+Who:   Roland Dreier <[EMAIL PROTECTED]>
+
+---
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c 
b/drivers/infiniband/hw/mthca/mthca_main.c
index aa563e6..7ea6713 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero");
 
 static int msi = 0;
 module_param(msi, int, 0444);
-MODULE_PARM_DESC(msi, "attempt to use MSI if nonzero");
+MODULE_PARM_DESC(msi, "attempt to use MSI if nonzero (deprecated, use MSI-X 
instead)");
 
 #else /* CONFIG_PCI_MSI */
 
@@ -1117,9 +1117,21 @@ static int __mthca_init_one(struct pci_dev *pdev, int 
hca_type)
 
if (msi_x && !mthca_enable_msi_x(mdev))
mdev->mthca_flags |= MTHCA_FLAG_MSI_X;
-   if (msi && !(mdev->mthca_flags & MTHCA_FLAG_MSI_X) &&
-   !pci_enable_msi(pdev))
-   mdev->mthca_flags |= MTHCA_FLAG_MSI;
+   else if (msi) {
+   static int warned;
+
+   if (!warned) {
+   printk(KERN_WARNING PFX "WARNING: MSI support will be "
+  "removed from the ib_mthca driver in January 
2008.\n");
+   printk(KERN_WARNING "If you are using MSI and 
cannot "
+  "switch to MSI-X, please tell "
+  "<[EMAIL PROTECTED]>.\n");
+   ++warned;
+   }
+
+   if (!pci_enable_msi(pdev))
+   mdev->mthca_flags |= MTHCA_FLAG_MSI;
+   }
 
if (mthca_cmd_init(mdev)) {
mthca_err(mdev, "Failed to init command interface, 
aborting.\n");
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mthca: Fix printk format used for firmware version in warning

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e4daf738683d9e87caf12f4249268d3c9ed2e00f
Commit: e4daf738683d9e87caf12f4249268d3c9ed2e00f
Parent: f6be6fbe262d065e85be159ea27460852f13ec90
Author: Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:42 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:42 2007 -0700

IB/mthca: Fix printk format used for firmware version in warning

When warning about out-of-date firmware, current mthca code messes up
the formatting of the version if the subminor doesn't have three
digits.  It doesn't fill the field with 0s so we end up with:

ib_mthca :0b:00.0: HCA FW version 1.1.  0 is old (1.2.  0 is 
current).

Change the format from "%3d" to "%03d" to get the right thing printed.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_main.c 
b/drivers/infiniband/hw/mthca/mthca_main.c
index 7ea6713..76fed75 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -1147,7 +1147,7 @@ static int __mthca_init_one(struct pci_dev *pdev, int 
hca_type)
goto err_cmd;
 
if (mdev->fw_ver < mthca_hca_table[hca_type].latest_fw) {
-   mthca_warn(mdev, "HCA FW version %d.%d.%3d is old (%d.%d.%3d is 
current).\n",
+   mthca_warn(mdev, "HCA FW version %d.%d.%03d is old (%d.%d.%03d 
is current).\n",
   (int) (mdev->fw_ver >> 32), (int) (mdev->fw_ver >> 
16) & 0x,
   (int) (mdev->fw_ver & 0x),
   (int) (mthca_hca_table[hca_type].latest_fw >> 32),
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/ehca: Fix warnings issued by checkpatch.pl

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b94397adc68c2f0f851539884cc426e03444a26
Commit: 2b94397adc68c2f0f851539884cc426e03444a26
Parent: 187c72e31f92791ec70395b80aa9883f2edad97f
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:53:47 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:40 2007 -0700

IB/ehca: Fix warnings issued by checkpatch.pl

Run the existing ehca code through checkpatch.pl and clean up the
worst of the coding style violations.

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_av.c  |2 +-
 drivers/infiniband/hw/ehca/ehca_classes.h |4 +-
 drivers/infiniband/hw/ehca/ehca_classes_pSeries.h |  156 ++--
 drivers/infiniband/hw/ehca/ehca_cq.c  |2 +-
 drivers/infiniband/hw/ehca/ehca_eq.c  |3 +-
 drivers/infiniband/hw/ehca/ehca_hca.c |   28 +++-
 drivers/infiniband/hw/ehca/ehca_irq.c |   56 
 drivers/infiniband/hw/ehca/ehca_iverbs.h  |7 +-
 drivers/infiniband/hw/ehca/ehca_main.c|   21 ++--
 drivers/infiniband/hw/ehca/ehca_mrmw.c|   59 
 drivers/infiniband/hw/ehca/ehca_mrmw.h|7 +-
 drivers/infiniband/hw/ehca/ehca_qes.h |   22 ++--
 drivers/infiniband/hw/ehca/ehca_qp.c  |   39 +++---
 drivers/infiniband/hw/ehca/ehca_reqs.c|   15 ++-
 drivers/infiniband/hw/ehca/ehca_tools.h   |   28 ++--
 drivers/infiniband/hw/ehca/ehca_uverbs.c  |   10 +-
 drivers/infiniband/hw/ehca/hcp_if.c   |8 +-
 drivers/infiniband/hw/ehca/hcp_phyp.c |2 +-
 drivers/infiniband/hw/ehca/hipz_fns_core.h|4 +-
 drivers/infiniband/hw/ehca/hipz_hw.h  |   24 ++--
 drivers/infiniband/hw/ehca/ipz_pt_fn.c|2 +-
 drivers/infiniband/hw/ehca/ipz_pt_fn.h|4 +-
 22 files changed, 261 insertions(+), 242 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_av.c 
b/drivers/infiniband/hw/ehca/ehca_av.c
index 3cd6bf3..e53a97a 100644
--- a/drivers/infiniband/hw/ehca/ehca_av.c
+++ b/drivers/infiniband/hw/ehca/ehca_av.c
@@ -79,7 +79,7 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct 
ib_ah_attr *ah_attr)
av->av.ipd = (ah_mult > 0) ?
((ehca_mult - 1) / ah_mult) : 0;
} else
-   av->av.ipd = ehca_static_rate;
+   av->av.ipd = ehca_static_rate;
 
av->av.lnh = ah_attr->ah_flags;
av->av.grh.word_0 = EHCA_BMASK_SET(GRH_IPVERSION_MASK, 6);
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h 
b/drivers/infiniband/hw/ehca/ehca_classes.h
index 5e00202..043e4fb 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -208,7 +208,7 @@ struct ehca_mr {
u32 num_hwpages;/* number of hw pages to form MR */
int acl;/* ACL (stored here for usage in reregister) */
u64 *start; /* virtual start address (stored here for */
-   /* usage in reregister) */
+   /* usage in reregister) */
u64 size;   /* size (stored here for usage in reregister) */
u32 fmr_page_size;  /* page size for FMR */
u32 fmr_max_pages;  /* max pages for FMR */
@@ -391,6 +391,6 @@ struct ehca_alloc_qp_parms {
 
 int ehca_cq_assign_qp(struct ehca_cq *cq, struct ehca_qp *qp);
 int ehca_cq_unassign_qp(struct ehca_cq *cq, unsigned int qp_num);
-struct ehca_qp* ehca_cq_get_qp(struct ehca_cq *cq, int qp_num);
+struct ehca_qp *ehca_cq_get_qp(struct ehca_cq *cq, int qp_num);
 
 #endif
diff --git a/drivers/infiniband/hw/ehca/ehca_classes_pSeries.h 
b/drivers/infiniband/hw/ehca/ehca_classes_pSeries.h
index fb3df5c..1798e64 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes_pSeries.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes_pSeries.h
@@ -154,83 +154,83 @@ struct hcp_modify_qp_control_block {
u32 reserved_70_127[58];   /* 70 */
 };
 
-#define MQPCB_MASK_QKEY EHCA_BMASK_IBM(0,0)
-#define MQPCB_MASK_SEND_PSN EHCA_BMASK_IBM(2,2)
-#define MQPCB_MASK_RECEIVE_PSN  EHCA_BMASK_IBM(3,3)
-#define MQPCB_MASK_PRIM_PHYS_PORT   EHCA_BMASK_IBM(4,4)
-#define MQPCB_PRIM_PHYS_PORTEHCA_BMASK_IBM(24,31)
-#define MQPCB_MASK_ALT_PHYS_PORTEHCA_BMASK_IBM(5,5)
-#define MQPCB_MASK_PRIM_P_KEY_IDX   EHCA_BMASK_IBM(6,6)
-#define MQPCB_PRIM_P_KEY_IDXEHCA_BMASK_IBM(24,31)
-#define MQPCB_MASK_ALT_P_KEY_IDXEHCA_BMASK_IBM(7,7)
-#define MQPCB_MASK_RDMA_ATOMIC_CTRL EHCA_BMASK_IBM(8,8)
-#define MQPCB_MASK_QP_STATE 

IB/ehca: MR/MW structure refactoring

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df17bfd4a030f7d986de14210f4b21876a7a2989
Commit: df17bfd4a030f7d986de14210f4b21876a7a2989
Parent: 2492398e616451788bc7c7905cadb8734b082bc7
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:52:29 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:40 2007 -0700

IB/ehca: MR/MW structure refactoring

- Rename struct ehca_mr fields to clearly distinguish between kernel
  and HW page size.
- Sort struct ehca_mr_pginfo into a common part and a union containing
  specific fields for physical, user and fast MR

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_classes.h |   50 ++--
 drivers/infiniband/hw/ehca/ehca_mrmw.c|  511 +++--
 2 files changed, 284 insertions(+), 277 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h 
b/drivers/infiniband/hw/ehca/ehca_classes.h
index daf823e..5e00202 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -204,8 +204,8 @@ struct ehca_mr {
spinlock_t mrlock;
 
enum ehca_mr_flag flags;
-   u32 num_pages;  /* number of MR pages */
-   u32 num_4k; /* number of 4k "page" portions to form MR */
+   u32 num_kpages; /* number of kernel pages */
+   u32 num_hwpages;/* number of hw pages to form MR */
int acl;/* ACL (stored here for usage in reregister) */
u64 *start; /* virtual start address (stored here for */
/* usage in reregister) */
@@ -217,9 +217,6 @@ struct ehca_mr {
/* fw specific data */
struct ipz_mrmw_handle ipz_mr_handle;   /* MR handle for h-calls */
struct h_galpas galpas;
-   /* data for userspace bridge */
-   u32 nr_of_pages;
-   void *pagearray;
 };
 
 struct ehca_mw {
@@ -241,26 +238,29 @@ enum ehca_mr_pgi_type {
 
 struct ehca_mr_pginfo {
enum ehca_mr_pgi_type type;
-   u64 num_pages;
-   u64 page_cnt;
-   u64 num_4k;   /* number of 4k "page" portions */
-   u64 page_4k_cnt;  /* counter for 4k "page" portions */
-   u64 next_4k;  /* next 4k "page" portion in buffer/chunk/listelem */
-
-   /* type EHCA_MR_PGI_PHYS section */
-   int num_phys_buf;
-   struct ib_phys_buf *phys_buf_array;
-   u64 next_buf;
-
-   /* type EHCA_MR_PGI_USER section */
-   struct ib_umem *region;
-   struct ib_umem_chunk *next_chunk;
-   u64 next_nmap;
-
-   /* type EHCA_MR_PGI_FMR section */
-   u64 *page_list;
-   u64 next_listelem;
-   /* next_4k also used within EHCA_MR_PGI_FMR */
+   u64 num_kpages;
+   u64 kpage_cnt;
+   u64 num_hwpages; /* number of hw pages */
+   u64 hwpage_cnt;  /* counter for hw pages */
+   u64 next_hwpage; /* next hw page in buffer/chunk/listelem */
+
+   union {
+   struct { /* type EHCA_MR_PGI_PHYS section */
+   int num_phys_buf;
+   struct ib_phys_buf *phys_buf_array;
+   u64 next_buf;
+   } phy;
+   struct { /* type EHCA_MR_PGI_USER section */
+   struct ib_umem *region;
+   struct ib_umem_chunk *next_chunk;
+   u64 next_nmap;
+   } usr;
+   struct { /* type EHCA_MR_PGI_FMR section */
+   u64 fmr_pgsize;
+   u64 *page_list;
+   u64 next_listelem;
+   } fmr;
+   } u;
 };
 
 /* output parameters for MR/FMR hipz calls */
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 58e8b33..53b334b 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -150,9 +150,6 @@ struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,
struct ehca_pd *e_pd = container_of(pd, struct ehca_pd, ib_pd);
 
u64 size;
-   struct ehca_mr_pginfo pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};
-   u32 num_pages_mr;
-   u32 num_pages_4k; /* 4k portion "pages" */
 
if ((num_phys_buf <= 0) || !phys_buf_array) {
ehca_err(pd->device, "bad input values: num_phys_buf=%x "
@@ -196,12 +193,6 @@ struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,
goto reg_phys_mr_exit0;
}
 
-   /* determine number of MR pages */
-   num_pages_mr = NUM_CHUNKS(((u64)iova_start % PAGE_SIZE) + size,
- PAGE_SIZE);
-   num_pages_4k = NUM_CHUNKS(((u64)iova_start % EHCA_PAGESIZE) + size,
- EHCA_PAGESIZE);
-
/* register MR on HCA */
if (ehca_mr_is_maxmr(size, i

IB/ehca: Restructure ehca_set_pagebuf()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=187c72e31f92791ec70395b80aa9883f2edad97f
Commit: 187c72e31f92791ec70395b80aa9883f2edad97f
Parent: df17bfd4a030f7d986de14210f4b21876a7a2989
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:53:11 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:40 2007 -0700

IB/ehca: Restructure ehca_set_pagebuf()

Split ehca_set_pagebuf() into three functions depending on MR type
(phys/user/fast) and remove superfluous ehca_set_pagebuf_1().

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |  531 
 1 files changed, 200 insertions(+), 331 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 53b334b..93c26cc 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -824,6 +824,7 @@ int ehca_map_phys_fmr(struct ib_fmr *fmr,
pginfo.u.fmr.page_list = page_list;
pginfo.next_hwpage = ((iova & (e_fmr->fmr_page_size-1)) /
  EHCA_PAGESIZE);
+   pginfo.u.fmr.fmr_pgsize = e_fmr->fmr_page_size;
 
ret = ehca_rereg_mr(shca, e_fmr, (u64*)iova,
list_len * e_fmr->fmr_page_size,
@@ -1044,15 +1045,15 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
} else
rnum = MAX_RPAGES;
 
-   if (rnum > 1) {
-   ret = ehca_set_pagebuf(e_mr, pginfo, rnum, kpage);
-   if (ret) {
-   ehca_err(&shca->ib_device, "ehca_set_pagebuf "
+   ret = ehca_set_pagebuf(pginfo, rnum, kpage);
+   if (ret) {
+   ehca_err(&shca->ib_device, "ehca_set_pagebuf "
 "bad rc, ret=%x rnum=%x kpage=%p",
 ret, rnum, kpage);
-   ret = -EFAULT;
-   goto ehca_reg_mr_rpages_exit1;
-   }
+   goto ehca_reg_mr_rpages_exit1;
+   }
+
+   if (rnum > 1) {
rpage = virt_to_abs(kpage);
if (!rpage) {
ehca_err(&shca->ib_device, "kpage=%p i=%x",
@@ -1060,15 +1061,8 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
ret = -EFAULT;
goto ehca_reg_mr_rpages_exit1;
}
-   } else {  /* rnum==1 */
-   ret = ehca_set_pagebuf_1(e_mr, pginfo, &rpage);
-   if (ret) {
-   ehca_err(&shca->ib_device, "ehca_set_pagebuf_1 "
-"bad rc, ret=%x i=%x", ret, i);
-   ret = -EFAULT;
-   goto ehca_reg_mr_rpages_exit1;
-   }
-   }
+   } else
+   rpage = *kpage;
 
h_ret = hipz_h_register_rpage_mr(shca->ipz_hca_handle, e_mr,
 0, /* pagesize 4k */
@@ -1146,7 +1140,7 @@ inline int ehca_rereg_mr_rereg1(struct ehca_shca *shca,
}
 
pginfo_save = *pginfo;
-   ret = ehca_set_pagebuf(e_mr, pginfo, pginfo->num_hwpages, kpage);
+   ret = ehca_set_pagebuf(pginfo, pginfo->num_hwpages, kpage);
if (ret) {
ehca_err(&shca->ib_device, "set pagebuf failed, e_mr=%p "
 "pginfo=%p type=%x num_kpages=%lx num_hwpages=%lx "
@@ -1306,98 +1300,86 @@ int ehca_unmap_one_fmr(struct ehca_shca *shca,
 {
int ret = 0;
u64 h_ret;
-   int rereg_1_hcall = 1; /* 1: use hipz_mr_reregister directly */
-   int rereg_3_hcall = 0; /* 1: use 3 hipz calls for unmapping */
struct ehca_pd *e_pd =
container_of(e_fmr->ib.ib_fmr.pd, struct ehca_pd, ib_pd);
struct ehca_mr save_fmr;
u32 tmp_lkey, tmp_rkey;
struct ehca_mr_pginfo pginfo;
struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
+   struct ehca_mr save_mr;
 
-   /* first check if reregistration hCall can be used for unmap */
-   if (e_fmr->fmr_max_pages > MAX_RPAGES) {
-   rereg_1_hcall = 0;
-   rereg_3_hcall = 1;
-   }
-
-   if (rereg_1_hcall) {
+   if (e_fmr->fmr_max_pages <= MAX_RPAGES) {
/*
 * note: after using rereg hcall with len=0,
 * rereg hcall must be used again for registering pages
 */
h_ret = hipz_h_reregister_pmr(shca->ipz_hca_handle, e_fmr, 0,
  0, 0, e_pd->fw_pd, 0, &hi

IB/ehca: Use macro to calculate number of chunks in a mem block

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2492398e616451788bc7c7905cadb8734b082bc7
Commit: 2492398e616451788bc7c7905cadb8734b082bc7
Parent: 4e4e74cae73325c9f8513fae3a5bd9f79458f4a7
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:51:43 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:39 2007 -0700

IB/ehca: Use macro to calculate number of chunks in a mem block

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |   47 ---
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 1fe4f72..58e8b33 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -48,6 +48,8 @@
 #include "hcp_if.h"
 #include "hipz_hw.h"
 
+#define NUM_CHUNKS(length, chunk_size) \
+   (((length) + (chunk_size - 1)) / (chunk_size))
 /* max number of rpages (per hcall register_rpages) */
 #define MAX_RPAGES 512
 
@@ -195,10 +197,10 @@ struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,
}
 
/* determine number of MR pages */
-   num_pages_mr = u64)iova_start % PAGE_SIZE) + size +
-PAGE_SIZE - 1) / PAGE_SIZE);
-   num_pages_4k = u64)iova_start % EHCA_PAGESIZE) + size +
-EHCA_PAGESIZE - 1) / EHCA_PAGESIZE);
+   num_pages_mr = NUM_CHUNKS(((u64)iova_start % PAGE_SIZE) + size,
+ PAGE_SIZE);
+   num_pages_4k = NUM_CHUNKS(((u64)iova_start % EHCA_PAGESIZE) + size,
+ EHCA_PAGESIZE);
 
/* register MR on HCA */
if (ehca_mr_is_maxmr(size, iova_start)) {
@@ -305,10 +307,9 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length, u64 virt
}
 
/* determine number of MR pages */
-   num_pages_mr = (((virt % PAGE_SIZE) + length + PAGE_SIZE - 1) /
-   PAGE_SIZE);
-   num_pages_4k = (((virt % EHCA_PAGESIZE) + length + EHCA_PAGESIZE - 1) /
-   EHCA_PAGESIZE);
+   num_pages_mr = NUM_CHUNKS((virt % PAGE_SIZE) + length, PAGE_SIZE);
+   num_pages_4k = NUM_CHUNKS((virt % EHCA_PAGESIZE) + length,
+ EHCA_PAGESIZE);
 
/* register MR on HCA */
pginfo.type   = EHCA_MR_PGI_USER;
@@ -462,10 +463,10 @@ int ehca_rereg_phys_mr(struct ib_mr *mr,
ret = -EINVAL;
goto rereg_phys_mr_exit1;
}
-   num_pages_mr = u64)new_start % PAGE_SIZE) + new_size +
-PAGE_SIZE - 1) / PAGE_SIZE);
-   num_pages_4k = u64)new_start % EHCA_PAGESIZE) + new_size +
-EHCA_PAGESIZE - 1) / EHCA_PAGESIZE);
+   num_pages_mr = NUM_CHUNKS(((u64)new_start % PAGE_SIZE) +
+ new_size, PAGE_SIZE);
+   num_pages_4k = NUM_CHUNKS(((u64)new_start % EHCA_PAGESIZE) +
+ new_size, EHCA_PAGESIZE);
pginfo.type   = EHCA_MR_PGI_PHYS;
pginfo.num_pages  = num_pages_mr;
pginfo.num_4k = num_pages_4k;
@@ -1030,9 +1031,9 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
}
 
/* max 512 pages per shot */
-   for (i = 0; i < ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES); i++) {
+   for (i = 0; i < NUM_CHUNKS(pginfo->num_4k, MAX_RPAGES); i++) {
 
-   if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
+   if (i == NUM_CHUNKS(pginfo->num_4k, MAX_RPAGES) - 1) {
rnum = pginfo->num_4k % MAX_RPAGES; /* last shot */
if (rnum == 0)
rnum = MAX_RPAGES;  /* last shot is full */
@@ -1069,7 +1070,7 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
 0, /* pagesize 4k */
 0, rpage, rnum);
 
-   if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
+   if (i == NUM_CHUNKS(pginfo->num_4k, MAX_RPAGES) - 1) {
/*
 * check for 'registration complete'==H_SUCCESS
 * and for 'page registered'==H_PAGE_REGISTERED
@@ -1475,10 +1476,10 @@ int ehca_reg_internal_maxmr(
iova_start = (u64*)KERNELBASE;
ib_pbuf.addr = 0;
ib_pbuf.size = size_maxmr;
-   num_pages_mr = u64)iova_start % PAGE_SIZE) + size_maxmr +
-PAGE_SIZE - 1) / PAGE_SIZE);
-   num_pages_4k = u64)iova_start % EHCA_PAGESIZE) + size_maxmr +
-EHCA_PAGESIZE 

IB/ehca: Use common error code mapping instead of specific ones

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a1a6ff11006c3a056cda9e8b13e7388fba3e69a1
Commit: a1a6ff11006c3a056cda9e8b13e7388fba3e69a1
Parent: 3df78f81e070c0e3330ae1bd40385e2f0d6fea2c
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:49:02 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:39 2007 -0700

IB/ehca: Use common error code mapping instead of specific ones

Instead of one error mapping function for each potential error source
in ehca_mrmw.c, use a centralized function that handles all cases,
saving a three-figure line count.

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c  |  195 ++-
 drivers/infiniband/hw/ehca/ehca_mrmw.h  |   14 ---
 drivers/infiniband/hw/ehca/ehca_tools.h |3 +
 3 files changed, 15 insertions(+), 197 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 98f2531..7c1656a 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -537,7 +537,7 @@ int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr 
*mr_attr)
 "hca_hndl=%lx mr_hndl=%lx lkey=%x",
 h_ret, mr, shca->ipz_hca_handle.handle,
 e_mr->ipz_mr_handle.handle, mr->lkey);
-   ret = ehca_mrmw_map_hrc_query_mr(h_ret);
+   ret = ehca2ib_return_code(h_ret);
goto query_mr_exit1;
}
mr_attr->pd   = mr->pd;
@@ -597,7 +597,7 @@ int ehca_dereg_mr(struct ib_mr *mr)
 "e_mr=%p hca_hndl=%lx mr_hndl=%lx mr->lkey=%x",
 h_ret, shca, e_mr, shca->ipz_hca_handle.handle,
 e_mr->ipz_mr_handle.handle, mr->lkey);
-   ret = ehca_mrmw_map_hrc_free_mr(h_ret);
+   ret = ehca2ib_return_code(h_ret);
goto dereg_mr_exit0;
}
 
@@ -637,7 +637,7 @@ struct ib_mw *ehca_alloc_mw(struct ib_pd *pd)
ehca_err(pd->device, "hipz_mw_allocate failed, h_ret=%lx "
 "shca=%p hca_hndl=%lx mw=%p",
 h_ret, shca, shca->ipz_hca_handle.handle, e_mw);
-   ib_mw = ERR_PTR(ehca_mrmw_map_hrc_alloc(h_ret));
+   ib_mw = ERR_PTR(ehca2ib_return_code(h_ret));
goto alloc_mw_exit1;
}
/* successful MW allocation */
@@ -680,7 +680,7 @@ int ehca_dealloc_mw(struct ib_mw *mw)
 "mw=%p rkey=%x hca_hndl=%lx mw_hndl=%lx",
 h_ret, shca, mw, mw->rkey, shca->ipz_hca_handle.handle,
 e_mw->ipz_mw_handle.handle);
-   return ehca_mrmw_map_hrc_free_mw(h_ret);
+   return ehca2ib_return_code(h_ret);
}
/* successful deallocation */
ehca_mw_delete(e_mw);
@@ -923,7 +923,7 @@ int ehca_dealloc_fmr(struct ib_fmr *fmr)
 "hca_hndl=%lx fmr_hndl=%lx fmr->lkey=%x",
 h_ret, e_fmr, shca->ipz_hca_handle.handle,
 e_fmr->ipz_mr_handle.handle, fmr->lkey);
-   ret = ehca_mrmw_map_hrc_free_mr(h_ret);
+   ret = ehca2ib_return_code(h_ret);
goto free_fmr_exit0;
}
/* successful deregistration */
@@ -964,7 +964,7 @@ int ehca_reg_mr(struct ehca_shca *shca,
if (h_ret != H_SUCCESS) {
ehca_err(&shca->ib_device, "hipz_alloc_mr failed, h_ret=%lx "
 "hca_hndl=%lx", h_ret, shca->ipz_hca_handle.handle);
-   ret = ehca_mrmw_map_hrc_alloc(h_ret);
+   ret = ehca2ib_return_code(h_ret);
goto ehca_reg_mr_exit0;
}
 
@@ -1079,7 +1079,7 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
 shca->ipz_hca_handle.handle,
 e_mr->ipz_mr_handle.handle,
 e_mr->ib.ib_mr.lkey);
-   ret = ehca_mrmw_map_hrc_rrpg_last(h_ret);
+   ret = ehca2ib_return_code(h_ret);
break;
} else
ret = 0;
@@ -1090,7 +1090,7 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
 e_mr->ib.ib_mr.lkey,
 shca->ipz_hca_handle.handle,
 e_mr->ipz_mr_handle.handle);
-   ret = ehca_mrmw_map_hrc_rrpg_notlast(h_ret);
+   ret = ehca2ib_return_code(h_ret);
break;
} else
ret = 0;
@@ -1254,7 +1254,7 @@ int ehca_rereg_mr(struct ehca_shca *shca,
 

IB/ehca: Use #define for "pages per register_rpage" instead of hardcoded value

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e4e74cae73325c9f8513fae3a5bd9f79458f4a7
Commit: 4e4e74cae73325c9f8513fae3a5bd9f79458f4a7
Parent: a1a6ff11006c3a056cda9e8b13e7388fba3e69a1
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:51:04 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:39 2007 -0700

IB/ehca: Use #define for "pages per register_rpage" instead of hardcoded 
value

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 7c1656a..1fe4f72 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -48,6 +48,9 @@
 #include "hcp_if.h"
 #include "hipz_hw.h"
 
+/* max number of rpages (per hcall register_rpages) */
+#define MAX_RPAGES 512
+
 static struct kmem_cache *mr_cache;
 static struct kmem_cache *mw_cache;
 
@@ -1027,14 +1030,14 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
}
 
/* max 512 pages per shot */
-   for (i = 0; i < ((pginfo->num_4k + 512 - 1) / 512); i++) {
+   for (i = 0; i < ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES); i++) {
 
-   if (i == ((pginfo->num_4k + 512 - 1) / 512) - 1) {
-   rnum = pginfo->num_4k % 512; /* last shot */
+   if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
+   rnum = pginfo->num_4k % MAX_RPAGES; /* last shot */
if (rnum == 0)
-   rnum = 512;  /* last shot is full */
+   rnum = MAX_RPAGES;  /* last shot is full */
} else
-   rnum = 512;
+   rnum = MAX_RPAGES;
 
if (rnum > 1) {
ret = ehca_set_pagebuf(e_mr, pginfo, rnum, kpage);
@@ -1066,7 +1069,7 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
 0, /* pagesize 4k */
 0, rpage, rnum);
 
-   if (i == ((pginfo->num_4k + 512 - 1) / 512) - 1) {
+   if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
/*
 * check for 'registration complete'==H_SUCCESS
 * and for 'page registered'==H_PAGE_REGISTERED
@@ -1215,7 +1218,7 @@ int ehca_rereg_mr(struct ehca_shca *shca,
int rereg_3_hcall = 0; /* 1: use 3 hipz calls for reregistration */
 
/* first determine reregistration hCall(s) */
-   if ((pginfo->num_4k > 512) || (e_mr->num_4k > 512) ||
+   if ((pginfo->num_4k > MAX_RPAGES) || (e_mr->num_4k > MAX_RPAGES) ||
(pginfo->num_4k > e_mr->num_4k)) {
ehca_dbg(&shca->ib_device, "Rereg3 case, pginfo->num_4k=%lx "
 "e_mr->num_4k=%x", pginfo->num_4k, e_mr->num_4k);
@@ -1306,7 +1309,7 @@ int ehca_unmap_one_fmr(struct ehca_shca *shca,
struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
 
/* first check if reregistration hCall can be used for unmap */
-   if (e_fmr->fmr_max_pages > 512) {
+   if (e_fmr->fmr_max_pages > MAX_RPAGES) {
rereg_1_hcall = 0;
rereg_3_hcall = 1;
}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/ehca: Fix HW level autodetection

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbb9318be4b6eba36482e1275729c5c3dfdf8156
Commit: fbb9318be4b6eba36482e1275729c5c3dfdf8156
Parent: 8fcea95a2a15444d5cc4bee174bb12233aa0a2aa
Author: Joachim Fenkes <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:47:45 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:39 2007 -0700

IB/ehca: Fix HW level autodetection

Autodetection was missing a few HW revisions, causing certain eHCA1
revisions to be treated like eHCA2.  Fixed.

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_main.c |   29 +
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_main.c 
b/drivers/infiniband/hw/ehca/ehca_main.c
index 28ba2dd..203d01f 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -263,22 +263,27 @@ int ehca_sense_attributes(struct ehca_shca *shca)
 
ehca_gen_dbg(" ... hardware version=%x:%x", hcaaver, revid);
 
-   if ((hcaaver == 1) && (revid == 0))
-   shca->hw_level = 0x11;
-   else if ((hcaaver == 1) && (revid == 1))
-   shca->hw_level = 0x12;
-   else if ((hcaaver == 1) && (revid == 2))
-   shca->hw_level = 0x13;
-   else if ((hcaaver == 2) && (revid == 0))
-   shca->hw_level = 0x21;
-   else if ((hcaaver == 2) && (revid == 0x10))
-   shca->hw_level = 0x22;
-   else {
+   if (hcaaver == 1) {
+   if (revid <= 3)
+   shca->hw_level = 0x10 | (revid + 1);
+   else
+   shca->hw_level = 0x14;
+   } else if (hcaaver == 2) {
+   if (revid == 0)
+   shca->hw_level = 0x21;
+   else if (revid == 0x10)
+   shca->hw_level = 0x22;
+   else if (revid == 0x20 || revid == 0x21)
+   shca->hw_level = 0x23;
+   }
+
+   if (!shca->hw_level) {
ehca_gen_warn("unknown hardware version"
  " - assuming default level");
shca->hw_level = 0x22;
}
-   }
+   } else
+   shca->hw_level = ehca_hw_level;
ehca_gen_dbg(" ... hardware level=%x", shca->hw_level);
 
shca->sport[0].rate = IB_RATE_30_GBPS;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/ehca: Fix memory leak in error path of ehca_get_dma_mr()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3df78f81e070c0e3330ae1bd40385e2f0d6fea2c
Commit: 3df78f81e070c0e3330ae1bd40385e2f0d6fea2c
Parent: fbb9318be4b6eba36482e1275729c5c3dfdf8156
Author: Hoang-Nam Nguyen <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:48:22 2007 +0200
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:39 2007 -0700

IB/ehca: Fix memory leak in error path of ehca_get_dma_mr()

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index add79bd..98f2531 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -111,6 +111,7 @@ struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int 
mr_access_flags)
 &e_maxmr->ib.ib_mr.lkey,
 &e_maxmr->ib.ib_mr.rkey);
if (ret) {
+   ehca_mr_delete(e_maxmr);
ib_mr = ERR_PTR(ret);
goto get_dma_mr_exit0;
}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mlx4: Take sizeof the correct pointer in call to memset()

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8fcea95a2a15444d5cc4bee174bb12233aa0a2aa
Commit: 8fcea95a2a15444d5cc4bee174bb12233aa0a2aa
Parent: 1c27cb71aa7d86df0271caadfcc196a0518f5e33
Author: Dotan Barak <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 15:00:09 2007 +0300
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:38 2007 -0700

IB/mlx4: Take sizeof the correct pointer in call to memset()

When clearing the ib_ah_attr parameter in to_ib_ah_attr(), use sizeof
*ib_ah_attr instead of sizeof *path.  This is the same bug as was
fixed for mthca in 99d4f22e ("IB/mthca: Use correct structure size in
call to memset()"), but the code was cut and pasted into mlx4 before the
fix was merged.

Signed-off-by: Dotan Barak <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mlx4/qp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index d10bd88..0793059 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1498,7 +1498,7 @@ static int to_ib_qp_access_flags(int mlx4_flags)
 static void to_ib_ah_attr(struct mlx4_dev *dev, struct ib_ah_attr *ib_ah_attr,
struct mlx4_qp_path *path)
 {
-   memset(ib_ah_attr, 0, sizeof *path);
+   memset(ib_ah_attr, 0, sizeof *ib_ah_attr);
ib_ah_attr->port_num  = path->sched_queue & 0x40 ? 2 : 1;
 
if (ib_ah_attr->port_num == 0 || ib_ah_attr->port_num > 
dev->caps.num_ports)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/mlx4: Fix flow label returned from query QP

2007-07-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=586bb586ae59c473393c09291e86042d263c3ddd
Commit: 586bb586ae59c473393c09291e86042d263c3ddd
Parent: 1b07db7079103961de64f75761639435e9082504
Author: Jack Morgenstein <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:38 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 18:37:38 2007 -0700

IB/mlx4: Fix flow label returned from query QP

Correct the mask used to get the flow label, since the field is 20 bits,
not 24 bits.

Found by Dotan Barak and Yaron Gepstein of Mellanox.

Signed-off-by: Jack Morgenstein <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mlx4/qp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 4004218..2d00b4e 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1515,7 +1515,7 @@ static void to_ib_ah_attr(struct mlx4_dev *dev, struct 
ib_ah_attr *ib_ah_attr,
ib_ah_attr->grh.traffic_class =
(be32_to_cpu(path->tclass_flowlabel) >> 20) & 0xff;
ib_ah_attr->grh.flow_label =
-   be32_to_cpu(path->tclass_flowlabel) & 0xff;
+   be32_to_cpu(path->tclass_flowlabel) & 0xf;
memcpy(ib_ah_attr->grh.dgid.raw,
path->rgid, sizeof ib_ah_attr->grh.dgid.raw);
}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   4   >