Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] TCP: removal of unused label
From: Stephen Hemminger @ 2006-06-05 23:02 UTC (permalink / raw)
  To: Francois Romieu; +Cc: David S. Miller, netdev
In-Reply-To: <20060605195549.GA14942@electric-eye.fr.zoreil.com>

On Mon, 5 Jun 2006 21:55:49 +0200
Francois Romieu <romieu@fr.zoreil.com> wrote:

> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> 
> diff --git a/net/ipv4/tcp_compound.c b/net/ipv4/tcp_compound.c
> index bc54f7e..a3c36c0 100644
> --- a/net/ipv4/tcp_compound.c
> +++ b/net/ipv4/tcp_compound.c
> @@ -401,6 +401,7 @@ static void tcp_compound_cong_avoid(stru
>  static void tcp_compound_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
>  {
>  	const struct compound *ca = inet_csk_ca(sk);
> +
>  	if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
>  		struct tcpvegas_info *info;
>  
> @@ -411,7 +412,6 @@ static void tcp_compound_get_info(struct
>  		info->tcpv_rttcnt = ca->cntRTT;
>  		info->tcpv_rtt = ca->baseRTT;
>  		info->tcpv_minrtt = ca->minRTT;
> -	rtattr_failure:;
>  	}
>  }
>  


rtattr_failure is used inside __RTA_PUT() macro. It's gross, but there are
those who love it..

^ permalink raw reply

* Re: [PATCH 2.6.18 2/3] tg3: Convert to non-LLTX
From: Stephen Hemminger @ 2006-06-05 22:58 UTC (permalink / raw)
  To: Michael Chan; +Cc: davem, herbert, jgarzik, netdev
In-Reply-To: <1149536852.13155.7.camel@rh4>

On Mon, 05 Jun 2006 12:47:32 -0700
"Michael Chan" <mchan@broadcom.com> wrote:

> Herbert Xu pointed out that it is unsafe to call netif_tx_disable()
> from LLTX drivers because it uses dev->xmit_lock to synchronize
> whereas LLTX drivers use private locks.
> 
> Convert tg3 to non-LLTX to fix this issue. tg3 is a lockless driver
> where hard_start_xmit and tx completion handling can run concurrently
> under normal conditions. A tx_lock is only needed to prevent
> netif_stop_queue and netif_wake_queue race condtions when the queue
> is full.
> 
> So whether we use LLTX or non-LLTX, it makes practically no
> difference.
> 
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Since you are going more lockless, you probably need memory barriers.

I don't feel although that comfortable with the lockless driver model as is.
Perhaps there is something simpler that could be done with a ring model and
some atomic primitives like cmpxchg()?

^ permalink raw reply

* Re: [PATCH 1/1] LSM-IPsec SELinux Authorize
From: James Morris @ 2006-06-05 22:32 UTC (permalink / raw)
  To: Catherine Zhang
  Cc: netdev, davem, chrisw, herbert, sds, tjaeger, latten, sergeh,
	gcwilson, czhang.us
In-Reply-To: <20060605195607.GA28030@jiayuguan.watson.ibm.com>

On Mon, 5 Jun 2006, Catherine Zhang wrote:


Looks ok to me, except for one minor nit:

> +	if (ctx) {
> +		rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
> +		SECCLASS_ASSOCIATION,
> +		ASSOCIATION__SETCONTEXT, NULL);
> +	}

you don't need the braces here (similar again further in the patch).


- James
-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply

* Please pull 'upstream' branch of wireless-2.6
From: John W. Linville @ 2006-06-05 21:55 UTC (permalink / raw)
  To: jeff; +Cc: netdev
In-Reply-To: <20060605215353.GA7381@tuxdriver.com>

[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]

This pull is intended for 2.6.18.

Thanks,

John

---

The following changes since commit f6882a0688ea83db5fc2f3491ac9fcdce0834cc7:
  John W. Linville:
        Merge branch 'upstream-fixes' into upstream

are found in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git upstream

Daniel Drake:
      softmac: complete shared key authentication
      softmac: Fix handling of authentication failure

Jason Lunz:
      bcm43xx: quiet down log spam from set_security

Joseph Jezak:
      softmac: unified capabilities computation

Pavel Machek:
      usb wifi: zd1201 cleanups
      wireless: move zd1201 where it belongs

Toralf Förster:
      ieee80211softmac_io.c: fix warning "defined but not used"

 drivers/net/wireless/Kconfig                   |   17 ++
 drivers/net/wireless/Makefile                  |    2 
 drivers/net/wireless/bcm43xx/bcm43xx_main.c    |   13 +-
 drivers/net/wireless/zd1201.c                  |   67 ++++------
 drivers/net/wireless/zd1201.h                  |    0 
 drivers/usb/net/Kconfig                        |   17 --
 drivers/usb/net/Makefile                       |    1 
 include/net/ieee80211.h                        |    3 
 include/net/ieee80211softmac.h                 |    2 
 net/ieee80211/ieee80211_tx.c                   |   25 +++-
 net/ieee80211/softmac/Kconfig                  |    1 
 net/ieee80211/softmac/ieee80211softmac_assoc.c |   22 +++
 net/ieee80211/softmac/ieee80211softmac_auth.c  |   12 +-
 net/ieee80211/softmac/ieee80211softmac_event.c |    5 +
 net/ieee80211/softmac/ieee80211softmac_io.c    |  169 +++++++++++-------------
 15 files changed, 180 insertions(+), 176 deletions(-)
 rename drivers/{usb/net/zd1201.c => net/wireless/zd1201.c} (98%)
 rename drivers/{usb/net/zd1201.h => net/wireless/zd1201.h} (100%)

Patch included as attachment "upstream.patch.bz2"
-- 
John W. Linville
linville@tuxdriver.com

[-- Attachment #2: upstream.patch.bz2 --]
[-- Type: application/x-bzip2, Size: 23158 bytes --]

^ permalink raw reply

* Please pull 'upstream-fixes' branch of wireless-2.6
From: John W. Linville @ 2006-06-05 21:53 UTC (permalink / raw)
  To: jeff; +Cc: netdev

This pull is intended for 2.6.17 if at all possible.

Thanks,

John

---

The following changes since commit 672c6108a51bf559d19595d9f8193dfd81f0f752:
  Linus Torvalds:
        Merge master.kernel.org:/.../jejb/scsi-rc-fixes-2.6

are found in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git upstream-fixes

Michael Buesch:
      bcm43xx: add DMA rx poll workaround to DMA4

 drivers/net/wireless/bcm43xx/bcm43xx_dma.c |   31 ++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
index bbecba0..d0318e5 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
@@ -624,25 +624,28 @@ err_destroy_tx0:
 static u16 generate_cookie(struct bcm43xx_dmaring *ring,
 			   int slot)
 {
-	u16 cookie = 0x0000;
+	u16 cookie = 0xF000;
 
 	/* Use the upper 4 bits of the cookie as
 	 * DMA controller ID and store the slot number
-	 * in the lower 12 bits
+	 * in the lower 12 bits.
+	 * Note that the cookie must never be 0, as this
+	 * is a special value used in RX path.
 	 */
 	switch (ring->mmio_base) {
 	default:
 		assert(0);
 	case BCM43xx_MMIO_DMA1_BASE:
+		cookie = 0xA000;
 		break;
 	case BCM43xx_MMIO_DMA2_BASE:
-		cookie = 0x1000;
+		cookie = 0xB000;
 		break;
 	case BCM43xx_MMIO_DMA3_BASE:
-		cookie = 0x2000;
+		cookie = 0xC000;
 		break;
 	case BCM43xx_MMIO_DMA4_BASE:
-		cookie = 0x3000;
+		cookie = 0xD000;
 		break;
 	}
 	assert(((u16)slot & 0xF000) == 0x0000);
@@ -660,16 +663,16 @@ struct bcm43xx_dmaring * parse_cookie(st
 	struct bcm43xx_dmaring *ring = NULL;
 
 	switch (cookie & 0xF000) {
-	case 0x0000:
+	case 0xA000:
 		ring = dma->tx_ring0;
 		break;
-	case 0x1000:
+	case 0xB000:
 		ring = dma->tx_ring1;
 		break;
-	case 0x2000:
+	case 0xC000:
 		ring = dma->tx_ring2;
 		break;
-	case 0x3000:
+	case 0xD000:
 		ring = dma->tx_ring3;
 		break;
 	default:
@@ -839,8 +842,18 @@ static void dma_rx(struct bcm43xx_dmarin
 		/* We received an xmit status. */
 		struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data;
 		struct bcm43xx_xmitstatus stat;
+		int i = 0;
 
 		stat.cookie = le16_to_cpu(hw->cookie);
+		while (stat.cookie == 0) {
+			if (unlikely(++i >= 10000)) {
+				assert(0);
+				break;
+			}
+			udelay(2);
+			barrier();
+			stat.cookie = le16_to_cpu(hw->cookie);
+		}
 		stat.flags = hw->flags;
 		stat.cnt1 = hw->cnt1;
 		stat.cnt2 = hw->cnt2;
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply related

* [PATCH 2.6.18 3/3] tg3: Add tg3_netif_stop() in vlan funtions
From: Michael Chan @ 2006-06-05 19:47 UTC (permalink / raw)
  To: davem; +Cc: herbert, jgarzik, netdev

Add tg3_netif_stop() when changing the vlgrp (vlan group) pointer. It
is necessary to quiesce the device before changing that pointer.

Update version to 3.60

Signed-off-by: Michael Chan <mchan@broadcom.com>


diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f085890..d97cded 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -69,8 +69,8 @@
 
 #define DRV_MODULE_NAME		"tg3"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"3.59"
-#define DRV_MODULE_RELDATE	"May 26, 2006"
+#define DRV_MODULE_VERSION	"3.60"
+#define DRV_MODULE_RELDATE	"June 5, 2006"
 
 #define TG3_DEF_MAC_MODE	0
 #define TG3_DEF_RX_MODE		0
@@ -8735,6 +8735,9 @@ static void tg3_vlan_rx_register(struct 
 {
 	struct tg3 *tp = netdev_priv(dev);
 
+	if (netif_running(dev))
+		tg3_netif_stop(tp);
+
 	tg3_full_lock(tp, 0);
 
 	tp->vlgrp = grp;
@@ -8743,16 +8746,25 @@ static void tg3_vlan_rx_register(struct 
 	__tg3_set_rx_mode(dev);
 
 	tg3_full_unlock(tp);
+
+	if (netif_running(dev))
+		tg3_netif_start(tp);
 }
 
 static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 {
 	struct tg3 *tp = netdev_priv(dev);
 
+	if (netif_running(dev))
+		tg3_netif_stop(tp);
+
 	tg3_full_lock(tp, 0);
 	if (tp->vlgrp)
 		tp->vlgrp->vlan_devices[vid] = NULL;
 	tg3_full_unlock(tp);
+
+	if (netif_running(dev))
+		tg3_netif_start(tp);
 }
 #endif
 



^ permalink raw reply related

* [PATCH 2.6.18 2/3] tg3: Convert to non-LLTX
From: Michael Chan @ 2006-06-05 19:47 UTC (permalink / raw)
  To: davem; +Cc: herbert, jgarzik, netdev

Herbert Xu pointed out that it is unsafe to call netif_tx_disable()
from LLTX drivers because it uses dev->xmit_lock to synchronize
whereas LLTX drivers use private locks.

Convert tg3 to non-LLTX to fix this issue. tg3 is a lockless driver
where hard_start_xmit and tx completion handling can run concurrently
under normal conditions. A tx_lock is only needed to prevent
netif_stop_queue and netif_wake_queue race condtions when the queue
is full.

So whether we use LLTX or non-LLTX, it makes practically no
difference.

Signed-off-by: Michael Chan <mchan@broadcom.com>


diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4cda2af..f085890 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3759,14 +3759,11 @@ static int tg3_start_xmit(struct sk_buff
 
 	len = skb_headlen(skb);
 
-	/* No BH disabling for tx_lock here.  We are running in BH disabled
-	 * context and TX reclaim runs via tp->poll inside of a software
+	/* We are running in BH disabled context with netif_tx_lock
+	 * and TX reclaim runs via tp->poll inside of a software
 	 * interrupt.  Furthermore, IRQ processing runs lockless so we have
 	 * no IRQ context deadlocks to worry about either.  Rejoice!
 	 */
-	if (!spin_trylock(&tp->tx_lock))
-		return NETDEV_TX_LOCKED;
-
 	if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
 		if (!netif_queue_stopped(dev)) {
 			netif_stop_queue(dev);
@@ -3775,7 +3772,6 @@ static int tg3_start_xmit(struct sk_buff
 			printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
 			       "queue awake!\n", dev->name);
 		}
-		spin_unlock(&tp->tx_lock);
 		return NETDEV_TX_BUSY;
 	}
 
@@ -3858,15 +3854,16 @@ static int tg3_start_xmit(struct sk_buff
 	tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry);
 
 	tp->tx_prod = entry;
-	if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) {
+	if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) {
+		spin_lock(&tp->tx_lock);
 		netif_stop_queue(dev);
 		if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH)
 			netif_wake_queue(tp->dev);
+		spin_unlock(&tp->tx_lock);
 	}
 
 out_unlock:
     	mmiowb();
-	spin_unlock(&tp->tx_lock);
 
 	dev->trans_start = jiffies;
 
@@ -3885,14 +3882,11 @@ static int tg3_start_xmit_dma_bug(struct
 
 	len = skb_headlen(skb);
 
-	/* No BH disabling for tx_lock here.  We are running in BH disabled
-	 * context and TX reclaim runs via tp->poll inside of a software
+	/* We are running in BH disabled context with netif_tx_lock
+	 * and TX reclaim runs via tp->poll inside of a software
 	 * interrupt.  Furthermore, IRQ processing runs lockless so we have
 	 * no IRQ context deadlocks to worry about either.  Rejoice!
 	 */
-	if (!spin_trylock(&tp->tx_lock))
-		return NETDEV_TX_LOCKED; 
-
 	if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
 		if (!netif_queue_stopped(dev)) {
 			netif_stop_queue(dev);
@@ -3901,7 +3895,6 @@ static int tg3_start_xmit_dma_bug(struct
 			printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
 			       "queue awake!\n", dev->name);
 		}
-		spin_unlock(&tp->tx_lock);
 		return NETDEV_TX_BUSY;
 	}
 
@@ -4039,15 +4032,16 @@ static int tg3_start_xmit_dma_bug(struct
 	tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry);
 
 	tp->tx_prod = entry;
-	if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) {
+	if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) {
+		spin_lock(&tp->tx_lock);
 		netif_stop_queue(dev);
 		if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH)
 			netif_wake_queue(tp->dev);
+		spin_unlock(&tp->tx_lock);
 	}
 
 out_unlock:
     	mmiowb();
-	spin_unlock(&tp->tx_lock);
 
 	dev->trans_start = jiffies;
 
@@ -11332,7 +11326,6 @@ static int __devinit tg3_init_one(struct
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
-	dev->features |= NETIF_F_LLTX;
 #if TG3_VLAN_TAG_USED
 	dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
 	dev->vlan_rx_register = tg3_vlan_rx_register;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 7f22559..6a067de 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2074,12 +2074,22 @@ struct tg3 {
 
 	/* SMP locking strategy:
 	 *
-	 * lock: Held during all operations except TX packet
-	 *       processing.
+	 * lock: Held during reset, PHY access, timer, and when
+	 *       updating tg3_flags and tg3_flags2.
 	 *
-	 * tx_lock: Held during tg3_start_xmit and tg3_tx
+	 * tx_lock: Held during tg3_start_xmit and tg3_tx only
+	 *          when calling netif_[start|stop]_queue.
+	 *          tg3_start_xmit is protected by netif_tx_lock.
 	 *
 	 * Both of these locks are to be held with BH safety.
+	 *
+	 * Because the IRQ handler, tg3_poll, and tg3_start_xmit
+	 * are running lockless, it is necessary to completely
+	 * quiesce the chip with tg3_netif_stop and tg3_full_lock
+	 * before reconfiguring the device.
+	 *
+	 * indirect_lock: Held when accessing registers indirectly
+	 *                with IRQ disabling.
 	 */
 	spinlock_t			lock;
 	spinlock_t			indirect_lock;



^ permalink raw reply related

* [PATCH 2.6.18 1/3] tg3: Remove unnecessary tx_lock
From: Michael Chan @ 2006-06-05 19:47 UTC (permalink / raw)
  To: davem; +Cc: herbert, jgarzik, netdev

Remove tx_lock where it is unnecessary. tg3 runs lockless and so it
requires interrupts to be disabled and sync'ed, netif_queue and NAPI
poll to be stopped before the device can be reconfigured. After
stopping everything, it is no longer necessary to get the tx_lock.

Signed-off-by: Michael Chan <mchan@broadcom.com>


diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f2382aa..4cda2af 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2984,9 +2984,7 @@ static void tg3_tx_recover(struct tg3 *t
 	       "and include system chipset information.\n", tp->dev->name);
 
 	spin_lock(&tp->lock);
-	spin_lock(&tp->tx_lock);
 	tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING;
-	spin_unlock(&tp->tx_lock);
 	spin_unlock(&tp->lock);
 }
 
@@ -3429,12 +3427,10 @@ static inline void tg3_full_lock(struct 
 	if (irq_sync)
 		tg3_irq_quiesce(tp);
 	spin_lock_bh(&tp->lock);
-	spin_lock(&tp->tx_lock);
 }
 
 static inline void tg3_full_unlock(struct tg3 *tp)
 {
-	spin_unlock(&tp->tx_lock);
 	spin_unlock_bh(&tp->lock);
 }
 



^ permalink raw reply related

* Re: [PATCH] Changes to ieee80211.h for user space regulatory daemon
From: Larry Finger @ 2006-06-05 21:10 UTC (permalink / raw)
  To: John Linville, netdev
In-Reply-To: <20060605185905.GH6068@tuxdriver.com>

John W. Linville wrote:
>> @@ -968,6 +968,7 @@ #define IEEE80211_52GHZ_CHANNELS (IEEE80
>>
>>  enum {
>> 	IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
>> +	IEEE80211_CH_80211H_RULES = (1 << 1),
>> 	IEEE80211_CH_B_ONLY = (1 << 2),
>> 	IEEE80211_CH_NO_IBSS = (1 << 3),
>> 	IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
> 
> Any idea why this "hole" was here to begin with?  Was there something
> else defined as (1 << 1) previously?  Is it safe to reuse this value?
> 
> John

The hole has been there as long as I have been reading the ieee80211 code. If you are not 
comfortable with plugging the hole, then we can use (1 << 5).

Larry


^ permalink raw reply

* Re: [PATCH 2/3] pci: bcm43xx avoid pci_find_device
From: Jiri Slaby @ 2006-06-05 21:09 UTC (permalink / raw)
  To: Greg KH
  Cc: Greg KH, Linux Kernel Mailing List, linux-pci, jgarzik, netdev,
	mb, st3, linville
In-Reply-To: <20060605205309.GA31061@kroah.com>

Greg KH napsal(a):
> On Mon, Jun 05, 2006 at 10:20:07PM +0200, Jiri Slaby wrote:
>> bcm43xx avoid pci_find_device
>>
>> Change pci_find_device to safer pci_get_device with support for more
>> devices.
>>
>> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
>>
>> ---
>> commit 4b73c16f5411d97360d5f26f292ffddeb670ff75
>> tree 6e43c8bd02498eb1ceec6bdc64277fa8408da9e2
>> parent d59f9ea8489749f59cd0c7333a4784cab964daa8
>> author Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
>> committer Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
>>
>>  drivers/net/wireless/bcm43xx/bcm43xx_main.c |   21 ++++++++++++++++-----
>>  1 files changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
>> index 22b8fa6..d1a9975 100644
>> --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
>> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
>> @@ -2133,6 +2133,13 @@ out:
>>  	return err;
>>  }
>>  
>> +#ifdef CONFIG_BCM947XX
>> +static struct pci_device_id bcm43xx_47xx_ids[] = {
>> +	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
>> +	{ 0 }
>> +};
>> +#endif
>> +
>>  static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
>>  {
>>  	int res;
>> @@ -2142,11 +2149,15 @@ static int bcm43xx_initialize_irq(struct
>>  	bcm->irq = bcm->pci_dev->irq;
>>  #ifdef CONFIG_BCM947XX
>>  	if (bcm->pci_dev->bus->number == 0) {
>> -		struct pci_dev *d = NULL;
>> -		/* FIXME: we will probably need more device IDs here... */
>> -		d = pci_find_device(PCI_VENDOR_ID_BROADCOM, 0x4324, NULL);
>> -		if (d != NULL) {
>> -			bcm->irq = d->irq;
>> +		struct pci_dev *d;
>> +		struct pci_device_id *id;
>> +		for (id = bcm43xx_47xx_ids; id->vendor; id++) {
>> +			d = pci_get_device(id->vendor, id->device, NULL);
>> +			if (d != NULL) {
>> +				bcm->irq = d->irq;
>> +				pci_dev_put(d);
>> +				break;
>> +			}
> 
> This will not work if you have more than one of the same devices in the
> system.
> 
> Well, the original code will not either :(
> 
> Why not just use the proper pci interface?  Why poke around in another
> pci device to steal an irq, when that irq might not even be valid?
> (irqs are not valid until pci_enable_device() is called on them...)
Ok, this is some bus or something, not "real" device, so no pci probing or
anything else could be done. There is only one in the system, if any, since
CONFIG_BCM947XX is set for some sort of embedded systems, but this would be
uttered by somebody more responsible.

Should I call pci_enable_device anyway, I am confused now :/? And then, should I
hold the reference all time until ifdown for this "some kind of parent"?

thanks,
-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E

^ permalink raw reply

* Re: [PATCH 3/3] pci: gt96100eth avoid pci_find_device
From: Jiri Slaby @ 2006-06-05 20:57 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Greg KH, Linux Kernel Mailing List, linux-pci, jgarzik, netdev,
	stevel, source
In-Reply-To: <448491ab.7fb59b32.690f.01c1SMTPIN_ADDED@mx.gmail.com>

Jiri Slaby napsal(a):
> gt96100eth avoid pci_find_device
> 
> Change pci_find_device to safer pci_get_device with support for more
> bridges.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> 
> ---
> commit fd863b81ac491faf783ff7f2dcf6032177c5ab7f
> tree d7eb59f897505230023754f19ad7227eec39e676
> parent 4b73c16f5411d97360d5f26f292ffddeb670ff75
> author Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:20 +0159
> committer Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:20 +0159
> 
>  drivers/net/gt96100eth.c |   23 ++++++++++++++++++-----
>  1 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c
> index 2d24354..3066c86 100644
> --- a/drivers/net/gt96100eth.c
> +++ b/drivers/net/gt96100eth.c
> @@ -600,6 +600,11 @@ disable_ether_irq(struct net_device *dev
>  	GT96100ETH_WRITE(gp, GT96100_ETH_INT_MASK, 0);
>  }
>  
> +static struct pci_device_id gt96100_ids[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT96100) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT96100A) },
> +	{ 0 }
> +};
>  
>  /*
>   * Init GT96100 ethernet controller driver
> @@ -607,16 +612,20 @@ disable_ether_irq(struct net_device *dev
>  static int gt96100_init_module(void)
>  {
>  	struct pci_dev *pci;
> +	struct pci_device_id *id;
>  	int i, retval=0;
>  	u32 cpuConfig;
>  
>  	/*
>  	 * Stupid probe because this really isn't a PCI device
>  	 */
> -	if (!(pci = pci_find_device(PCI_VENDOR_ID_MARVELL,
> -	                            PCI_DEVICE_ID_MARVELL_GT96100, NULL)) &&
> -	    !(pci = pci_find_device(PCI_VENDOR_ID_MARVELL,
> -		                    PCI_DEVICE_ID_MARVELL_GT96100A, NULL))) {
> +	for (id = gt96100_ids; id->vendor; id++) {
> +		pci = pci_get_device(id->vendor, id->device, NULL);
> +		if (pci != NULL)
> +			break;
> +	}
I wonder if this is even better:
while ((pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci)) != NULL)
    if (pci_match_id(gt96100_ids, pci) != NULL)
         break;
What do you think?
> +
> +	if (!id->vendor) {
>  		printk(KERN_ERR __FILE__ ": GT96100 not found!\n");
>  		return -ENODEV;
>  	}
> @@ -625,12 +634,16 @@ static int gt96100_init_module(void)
>  	if (cpuConfig & (1<<12)) {
>  		printk(KERN_ERR __FILE__
>  		       ": must be in Big Endian mode!\n");
> -		return -ENODEV;
> +		retval = -ENODEV;
> +		goto err_pput;
>  	}
>  
>  	for (i=0; i < NUM_INTERFACES; i++)
>  		retval |= gt96100_probe1(pci, i);
>  
> +err_pput:
> +	pci_dev_put(pci);
> +
>  	return retval;
>  }
>  
> 


-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E

^ permalink raw reply

* Re: [PATCH 2/3] pci: bcm43xx avoid pci_find_device
From: Greg KH @ 2006-06-05 20:53 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Greg KH, Linux Kernel Mailing List, linux-pci, jgarzik, netdev,
	mb, st3, linville
In-Reply-To: <20060605202007.B464FC7B73@atrey.karlin.mff.cuni.cz>

On Mon, Jun 05, 2006 at 10:20:07PM +0200, Jiri Slaby wrote:
> bcm43xx avoid pci_find_device
> 
> Change pci_find_device to safer pci_get_device with support for more
> devices.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> 
> ---
> commit 4b73c16f5411d97360d5f26f292ffddeb670ff75
> tree 6e43c8bd02498eb1ceec6bdc64277fa8408da9e2
> parent d59f9ea8489749f59cd0c7333a4784cab964daa8
> author Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
> committer Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
> 
>  drivers/net/wireless/bcm43xx/bcm43xx_main.c |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> index 22b8fa6..d1a9975 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> @@ -2133,6 +2133,13 @@ out:
>  	return err;
>  }
>  
> +#ifdef CONFIG_BCM947XX
> +static struct pci_device_id bcm43xx_47xx_ids[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
> +	{ 0 }
> +};
> +#endif
> +
>  static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
>  {
>  	int res;
> @@ -2142,11 +2149,15 @@ static int bcm43xx_initialize_irq(struct
>  	bcm->irq = bcm->pci_dev->irq;
>  #ifdef CONFIG_BCM947XX
>  	if (bcm->pci_dev->bus->number == 0) {
> -		struct pci_dev *d = NULL;
> -		/* FIXME: we will probably need more device IDs here... */
> -		d = pci_find_device(PCI_VENDOR_ID_BROADCOM, 0x4324, NULL);
> -		if (d != NULL) {
> -			bcm->irq = d->irq;
> +		struct pci_dev *d;
> +		struct pci_device_id *id;
> +		for (id = bcm43xx_47xx_ids; id->vendor; id++) {
> +			d = pci_get_device(id->vendor, id->device, NULL);
> +			if (d != NULL) {
> +				bcm->irq = d->irq;
> +				pci_dev_put(d);
> +				break;
> +			}

This will not work if you have more than one of the same devices in the
system.

Well, the original code will not either :(

Why not just use the proper pci interface?  Why poke around in another
pci device to steal an irq, when that irq might not even be valid?
(irqs are not valid until pci_enable_device() is called on them...)

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 2/3] pci: bcm43xx avoid pci_find_device
From: Jiri Slaby @ 2006-06-05 20:46 UTC (permalink / raw)
  To: Michael Buesch
  Cc: Greg KH, Linux Kernel Mailing List, linux-pci, jgarzik, netdev,
	st3, linville
In-Reply-To: <200606052235.28687.mb@bu3sch.de>

Michael Buesch napsal(a):
> On Monday 05 June 2006 22:18, Jiri Slaby wrote:
>> bcm43xx avoid pci_find_device
>>
>> Change pci_find_device to safer pci_get_device with support for more
>> devices.
> 
> I am wondering about the reference count.
> From docbook:
> 
> 256  * pci_get_device - begin or continue searching for a PCI device by vendor/device id
> 257  * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
> 258  * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
> 259  * @from: Previous PCI device found in search, or %NULL for new search.
> 260  *
> 261  * Iterates through the list of known PCI devices.  If a PCI device is
> 262  * found with a matching @vendor and @device, the reference count to the
>                                                       ^^^^^^^^^^^^^^^^^^^^^^
> 263  * device is incremented and a pointer to its device structure is returned.
>        ^^^^^^^^^^^^^^^^^^^^^
> 264  * Otherwise, %NULL is returned.  A new search is initiated by passing %NULL
> 265  * to the @from argument.  Otherwise if @from is not %NULL, searches continue
> 266  * from next device on the global list.  The reference count for @from is
> 267  * always decremented if it is not %NULL.
> 
> Who is going to decrement it, once the device is not used anymore.
> "not used anymore" is ifconfig down in the case of bcm43xx.
> You will call pci_get_device on each ifconfig up.
> 
>> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
>>
>> ---
>> commit 4b73c16f5411d97360d5f26f292ffddeb670ff75
>> tree 6e43c8bd02498eb1ceec6bdc64277fa8408da9e2
>> parent d59f9ea8489749f59cd0c7333a4784cab964daa8
>> author Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
>> committer Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
>>
>>  drivers/net/wireless/bcm43xx/bcm43xx_main.c |   21 ++++++++++++++++-----
>>  1 files changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
>> index 22b8fa6..d1a9975 100644
>> --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
>> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
>> @@ -2133,6 +2133,13 @@ out:
>>  	return err;
>>  }
>>  
>> +#ifdef CONFIG_BCM947XX
>> +static struct pci_device_id bcm43xx_47xx_ids[] = {
>> +	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
>> +	{ 0 }
>> +};
>> +#endif
>> +
>>  static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
>>  {
>>  	int res;
>> @@ -2142,11 +2149,15 @@ static int bcm43xx_initialize_irq(struct
>>  	bcm->irq = bcm->pci_dev->irq;
>>  #ifdef CONFIG_BCM947XX
>>  	if (bcm->pci_dev->bus->number == 0) {
>> -		struct pci_dev *d = NULL;
>> -		/* FIXME: we will probably need more device IDs here... */
>> -		d = pci_find_device(PCI_VENDOR_ID_BROADCOM, 0x4324, NULL);
>> -		if (d != NULL) {
>> -			bcm->irq = d->irq;
>> +		struct pci_dev *d;
>> +		struct pci_device_id *id;
>> +		for (id = bcm43xx_47xx_ids; id->vendor; id++) {
>> +			d = pci_get_device(id->vendor, id->device, NULL);
>> +			if (d != NULL) {
>> +				bcm->irq = d->irq;
>> +				pci_dev_put(d);
here?
>> +				break;
>> +			}
>>  		}
>>  	}
>>  #endif
>>
> 

regards,
-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E

^ permalink raw reply

* Re: [PATCH 2/3] pci: bcm43xx avoid pci_find_device
From: Michael Buesch @ 2006-06-05 20:35 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Greg KH, Linux Kernel Mailing List, linux-pci, jgarzik, netdev,
	mb, st3, linville
In-Reply-To: <20060605201818.1239938CE036@bu3sch.de>

On Monday 05 June 2006 22:18, Jiri Slaby wrote:
> bcm43xx avoid pci_find_device
> 
> Change pci_find_device to safer pci_get_device with support for more
> devices.

I am wondering about the reference count.
>From docbook:

256  * pci_get_device - begin or continue searching for a PCI device by vendor/device id
257  * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
258  * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
259  * @from: Previous PCI device found in search, or %NULL for new search.
260  *
261  * Iterates through the list of known PCI devices.  If a PCI device is
262  * found with a matching @vendor and @device, the reference count to the
                                                      ^^^^^^^^^^^^^^^^^^^^^^
263  * device is incremented and a pointer to its device structure is returned.
       ^^^^^^^^^^^^^^^^^^^^^
264  * Otherwise, %NULL is returned.  A new search is initiated by passing %NULL
265  * to the @from argument.  Otherwise if @from is not %NULL, searches continue
266  * from next device on the global list.  The reference count for @from is
267  * always decremented if it is not %NULL.

Who is going to decrement it, once the device is not used anymore.
"not used anymore" is ifconfig down in the case of bcm43xx.
You will call pci_get_device on each ifconfig up.

> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> 
> ---
> commit 4b73c16f5411d97360d5f26f292ffddeb670ff75
> tree 6e43c8bd02498eb1ceec6bdc64277fa8408da9e2
> parent d59f9ea8489749f59cd0c7333a4784cab964daa8
> author Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
> committer Jiri Slaby <ku@bellona.localdomain> Mon, 05 Jun 2006 22:01:03 +0159
> 
>  drivers/net/wireless/bcm43xx/bcm43xx_main.c |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> index 22b8fa6..d1a9975 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> @@ -2133,6 +2133,13 @@ out:
>  	return err;
>  }
>  
> +#ifdef CONFIG_BCM947XX
> +static struct pci_device_id bcm43xx_47xx_ids[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
> +	{ 0 }
> +};
> +#endif
> +
>  static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
>  {
>  	int res;
> @@ -2142,11 +2149,15 @@ static int bcm43xx_initialize_irq(struct
>  	bcm->irq = bcm->pci_dev->irq;
>  #ifdef CONFIG_BCM947XX
>  	if (bcm->pci_dev->bus->number == 0) {
> -		struct pci_dev *d = NULL;
> -		/* FIXME: we will probably need more device IDs here... */
> -		d = pci_find_device(PCI_VENDOR_ID_BROADCOM, 0x4324, NULL);
> -		if (d != NULL) {
> -			bcm->irq = d->irq;
> +		struct pci_dev *d;
> +		struct pci_device_id *id;
> +		for (id = bcm43xx_47xx_ids; id->vendor; id++) {
> +			d = pci_get_device(id->vendor, id->device, NULL);
> +			if (d != NULL) {
> +				bcm->irq = d->irq;
> +				pci_dev_put(d);
> +				break;
> +			}
>  		}
>  	}
>  #endif
> 

-- 
Greetings Michael.

^ permalink raw reply

* [PATCH 0/3 #3] avoid pci_find_device
From: Jiri Slaby @ 2006-06-05 20:16 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux Kernel Mailing List, linux-pci, jgarzik, netdev, khali,
	lm-sensors, stevel, source, mb, st3, linville

Hello,

there are some patches to avoid pci_find_device in drivers.
I will make a bcm43xx patch against wireless git too.

Take #3.

It's against 2.6.17-rc5-mm3 tree.

01-i2c-scx200-acb-avoid-pci-find-device.patch
02-bcm43xx-avoid-pci-find-device.patch
03-gt96100eth-avoid-pci-find-device.patch

 i2c/busses/scx200_acb.c             |    9 ++++++---
 net/gt96100eth.c                    |   23 ++++++++++++++++++-----
 net/wireless/bcm43xx/bcm43xx_main.c |   21 ++++++++++++++++-----
 3 files changed, 40 insertions(+), 13 deletions(-)

Thanks.

^ permalink raw reply

* Re: [PATCH,RFT] bcm43xx: use softmac-suggested TX rate
From: John W. Linville @ 2006-06-05 20:00 UTC (permalink / raw)
  To: Daniel Drake; +Cc: Michael Buesch, netdev
In-Reply-To: <44848A97.8040801@gentoo.org>

On Mon, Jun 05, 2006 at 08:48:39PM +0100, Daniel Drake wrote:
> Michael Buesch wrote:
> >On Monday 05 June 2006 21:17, John W. Linville wrote:
> >>OK, I will now 'officially' forget about this patch, and wait for you
> >>to endorse it by re-sending it to me. :-)
> >
> >Ok, but it depends on this patch, which does not seem to be in your tree, 
> >yet.
> >http://marc.theaimsgroup.com/?l=linux-netdev&m=114651996213569&q=raw
> >
> >I am not sure where it went, though... .
> 
> It's in the master branch.

There too... :-)

-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply

* [PATCH] TCP: removal of unused label
From: Francois Romieu @ 2006-06-05 19:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev
In-Reply-To: <20060605110331.0f058738@dxpl.pdx.osdl.net>


Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

diff --git a/net/ipv4/tcp_compound.c b/net/ipv4/tcp_compound.c
index bc54f7e..a3c36c0 100644
--- a/net/ipv4/tcp_compound.c
+++ b/net/ipv4/tcp_compound.c
@@ -401,6 +401,7 @@ static void tcp_compound_cong_avoid(stru
 static void tcp_compound_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
 {
 	const struct compound *ca = inet_csk_ca(sk);
+
 	if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
 		struct tcpvegas_info *info;
 
@@ -411,7 +412,6 @@ static void tcp_compound_get_info(struct
 		info->tcpv_rttcnt = ca->cntRTT;
 		info->tcpv_rtt = ca->baseRTT;
 		info->tcpv_minrtt = ca->minRTT;
-	rtattr_failure:;
 	}
 }
 

^ permalink raw reply related

* [PATCH 1/1] LSM-IPsec SELinux Authorize
From: Catherine Zhang @ 2006-06-05 19:56 UTC (permalink / raw)
  To: James Morris, netdev, davem, chrisw, herbert, sds, tjaeger
  Cc: latten, sergeh, gcwilson, czhang.us

Hi, 

This is resubmit of the LSM-IPsec fix patch rebased against 
Linux version 2.6.17-rc4-mm3.

As always, comments are welcome!

Catherine

---

This patch contains a fix for the previous patch that adds security
contexts to IPsec policies and security associations.  In the previous
patch, no authorization (besides the check for write permissions to
SAD and SPD) is required to delete IPsec policies and security
assocations with security contexts.  Thus a user authorized to change
SAD and SPD can bypass the IPsec policy authorization by simply
deleteing policies with security contexts.  To fix this security hole,
an additional authorization check is added for removing security
policies and security associations with security contexts.

Note that if no security context is supplied on add or present on
policy to be deleted, the SELinux module allows the change
unconditionally.  The hook is called on deletion when no context is
present, which we may want to change.  At present, I left it up to the
module.

LSM changes:

The patch adds two new LSM hooks: xfrm_policy_delete and
xfrm_state_delete.  The new hooks are necessary to authorize deletion
of IPsec policies that have security contexts.  The existing hooks
xfrm_policy_free and xfrm_state_free lack the context to do the
authorization, so I decided to split authorization of deletion and
memory management of security data, as is typical in the LSM
interface.

Use:

The new delete hooks are checked when xfrm_policy or xfrm_state are
deleted by either the xfrm_user interface (xfrm_get_policy,
xfrm_del_sa) or the pfkey interface (pfkey_spddelete, pfkey_delete).

SELinux changes:

The new policy_delete and state_delete functions are added.

Signed-off-by: Trent Jaeger <tjaeger@cse.psu.edu>

---

 include/linux/security.h        |   40 +++++++++++++++++++++++++++++++++------
 net/key/af_key.c                |   17 ++++++++++------
 net/xfrm/xfrm_user.c            |   19 +++++++++++-------
 security/dummy.c                |   12 +++++++++++
 security/selinux/hooks.c        |    2 +
 security/selinux/include/xfrm.h |    2 +
 security/selinux/xfrm.c         |   41 ++++++++++++++++++++++++++++++++++++----
 7 files changed, 110 insertions(+), 23 deletions(-)

diff -puN include/linux/security.h~lsm-secpeer-fix include/linux/security.h
--- linux-2.6.17-rc4-mm3/include/linux/security.h~lsm-secpeer-fix	2006-05-31 00:01:35.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/include/linux/security.h	2006-05-31 00:46:13.000000000 -0400
@@ -805,31 +805,37 @@ struct swap_info_struct;
  *	used by the XFRM system.
  *	@sec_ctx contains the security context information being provided by
  *	the user-level policy update program (e.g., setkey).
- *	Allocate a security structure to the xp->selector.security field.
+ *	Allocate a security structure to the xp->security field.
  *	The security field is initialized to NULL when the xfrm_policy is
  *	allocated.
  *	Return 0 if operation was successful (memory to allocate, legal context)
  * @xfrm_policy_clone_security:
  *	@old contains an existing xfrm_policy in the SPD.
  *	@new contains a new xfrm_policy being cloned from old.
- *	Allocate a security structure to the new->selector.security field
- *	that contains the information from the old->selector.security field.
+ *	Allocate a security structure to the new->security field
+ *	that contains the information from the old->security field.
  *	Return 0 if operation was successful (memory to allocate).
  * @xfrm_policy_free_security:
  *	@xp contains the xfrm_policy
- *	Deallocate xp->selector.security.
+ *	Deallocate xp->security.
+ * @xfrm_policy_delete_security:
+ *	@xp contains the xfrm_policy.
+ *	Authorize deletion of xp->security.
  * @xfrm_state_alloc_security:
  *	@x contains the xfrm_state being added to the Security Association
  *	Database by the XFRM system.
  *	@sec_ctx contains the security context information being provided by
  *	the user-level SA generation program (e.g., setkey or racoon).
- *	Allocate a security structure to the x->sel.security field.  The
+ *	Allocate a security structure to the x->security field.  The
  *	security field is initialized to NULL when the xfrm_state is
  *	allocated.
  *	Return 0 if operation was successful (memory to allocate, legal context).
  * @xfrm_state_free_security:
  *	@x contains the xfrm_state.
- *	Deallocate x>sel.security.
+ *	Deallocate x->security.
+ * @xfrm_state_delete_security:
+ *	@x contains the xfrm_state.
+ *	Authorize deletion of x->security.
  * @xfrm_policy_lookup:
  *	@xp contains the xfrm_policy for which the access control is being
  *	checked.
@@ -1298,8 +1304,10 @@ struct security_operations {
 	int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
 	int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
 	void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
+	int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
 	int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
 	void (*xfrm_state_free_security) (struct xfrm_state *x);
+	int (*xfrm_state_delete_security) (struct xfrm_state *x);
 	int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
 #endif	/* CONFIG_SECURITY_NETWORK_XFRM */
 
@@ -2934,11 +2942,21 @@ static inline void security_xfrm_policy_
 	security_ops->xfrm_policy_free_security(xp);
 }
 
+static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
+{
+	return security_ops->xfrm_policy_delete_security(xp);
+}
+
 static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
 {
 	return security_ops->xfrm_state_alloc_security(x, sec_ctx);
 }
 
+static inline int security_xfrm_state_delete(struct xfrm_state *x)
+{
+	return security_ops->xfrm_state_delete_security(x);
+}
+
 static inline void security_xfrm_state_free(struct xfrm_state *x)
 {
 	security_ops->xfrm_state_free_security(x);
@@ -2963,6 +2981,11 @@ static inline void security_xfrm_policy_
 {
 }
 
+static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
+{
+	return 0;
+}
+
 static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
 {
 	return 0;
@@ -2972,6 +2995,11 @@ static inline void security_xfrm_state_f
 {
 }
 
+static inline int security_xfrm_state_delete(struct xfrm_policy *xp)
+{
+	return 0;
+}
+
 static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
 {
 	return 0;
diff -puN net/key/af_key.c~lsm-secpeer-fix net/key/af_key.c
--- linux-2.6.17-rc4-mm3/net/key/af_key.c~lsm-secpeer-fix	2006-05-31 00:01:46.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/net/key/af_key.c	2006-05-31 00:04:22.000000000 -0400
@@ -1454,21 +1454,23 @@ static int pfkey_delete(struct sock *sk,
 	if (x == NULL)
 		return -ESRCH;
 
+	if ((err = security_xfrm_state_delete(x)))
+		goto out;
+
 	if (xfrm_state_kern(x)) {
-		xfrm_state_put(x);
-		return -EPERM;
+		err = -EPERM;
+		goto out;
 	}
 	
 	err = xfrm_state_delete(x);
-	if (err < 0) {
-		xfrm_state_put(x);
-		return err;
-	}
+	if (err < 0)
+		goto out;
 
 	c.seq = hdr->sadb_msg_seq;
 	c.pid = hdr->sadb_msg_pid;
 	c.event = XFRM_MSG_DELSA;
 	km_state_notify(x, &c);
+out:
 	xfrm_state_put(x);
 
 	return err;
@@ -2274,11 +2276,14 @@ static int pfkey_spddelete(struct sock *
 
 	err = 0;
 
+	if ((err = security_xfrm_policy_delete(xp)))
+		goto out;
 	c.seq = hdr->sadb_msg_seq;
 	c.pid = hdr->sadb_msg_pid;
 	c.event = XFRM_MSG_DELPOLICY;
 	km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c);
 
+out:
 	xfrm_pol_put(xp);
 	return err;
 }
diff -puN net/xfrm/xfrm_user.c~lsm-secpeer-fix net/xfrm/xfrm_user.c
--- linux-2.6.17-rc4-mm3/net/xfrm/xfrm_user.c~lsm-secpeer-fix	2006-05-31 00:01:54.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/net/xfrm/xfrm_user.c	2006-05-31 00:04:22.000000000 -0400
@@ -427,23 +427,25 @@ static int xfrm_del_sa(struct sk_buff *s
 	if (x == NULL)
 		return -ESRCH;
 
+	if (err = security_xfrm_state_delete(x))
+		goto out;
+
 	if (xfrm_state_kern(x)) {
-		xfrm_state_put(x);
-		return -EPERM;
+		err = -EPERM;
+		goto out;
 	}
 
 	err = xfrm_state_delete(x);
-	if (err < 0) {
-		xfrm_state_put(x);
-		return err;
-	}
+	if (err < 0)
+		goto out;
 
 	c.seq = nlh->nlmsg_seq;
 	c.pid = nlh->nlmsg_pid;
 	c.event = nlh->nlmsg_type;
 	km_state_notify(x, &c);
-	xfrm_state_put(x);
 
+out:
+	xfrm_state_put(x);
 	return err;
 }
 
@@ -1055,6 +1057,8 @@ static int xfrm_get_policy(struct sk_buf
 					      MSG_DONTWAIT);
 		}
 	} else {
+		if (err = security_xfrm_policy_delete(xp))
+			goto out;
 		c.data.byid = p->index;
 		c.event = nlh->nlmsg_type;
 		c.seq = nlh->nlmsg_seq;
@@ -1064,6 +1068,7 @@ static int xfrm_get_policy(struct sk_buf
 
 	xfrm_pol_put(xp);
 
+out:
 	return err;
 }
 
diff -puN security/dummy.c~lsm-secpeer-fix security/dummy.c
--- linux-2.6.17-rc4-mm3/security/dummy.c~lsm-secpeer-fix	2006-05-31 00:02:04.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/security/dummy.c	2006-05-31 00:04:22.000000000 -0400
@@ -810,6 +810,11 @@ static void dummy_xfrm_policy_free_secur
 {
 }
 
+static int dummy_xfrm_policy_delete_security(struct xfrm_policy *xp)
+{
+	return 0;
+}
+
 static int dummy_xfrm_state_alloc_security(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
 {
 	return 0;
@@ -819,6 +824,11 @@ static void dummy_xfrm_state_free_securi
 {
 }
 
+static int dummy_xfrm_state_delete_security(struct xfrm_state *x)
+{
+	return 0;
+}
+
 static int dummy_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
 {
 	return 0;
@@ -1024,8 +1034,10 @@ void security_fixup_ops (struct security
 	set_to_dummy_if_null(ops, xfrm_policy_alloc_security);
 	set_to_dummy_if_null(ops, xfrm_policy_clone_security);
 	set_to_dummy_if_null(ops, xfrm_policy_free_security);
+	set_to_dummy_if_null(ops, xfrm_policy_delete_security);
 	set_to_dummy_if_null(ops, xfrm_state_alloc_security);
 	set_to_dummy_if_null(ops, xfrm_state_free_security);
+	set_to_dummy_if_null(ops, xfrm_state_delete_security);
 	set_to_dummy_if_null(ops, xfrm_policy_lookup);
 #endif	/* CONFIG_SECURITY_NETWORK_XFRM */
 #ifdef CONFIG_KEYS
diff -puN security/selinux/hooks.c~lsm-secpeer-fix security/selinux/hooks.c
--- linux-2.6.17-rc4-mm3/security/selinux/hooks.c~lsm-secpeer-fix	2006-05-31 00:02:11.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/security/selinux/hooks.c	2006-05-31 00:04:22.000000000 -0400
@@ -4400,8 +4400,10 @@ static struct security_operations selinu
 	.xfrm_policy_alloc_security =	selinux_xfrm_policy_alloc,
 	.xfrm_policy_clone_security =	selinux_xfrm_policy_clone,
 	.xfrm_policy_free_security =	selinux_xfrm_policy_free,
+	.xfrm_policy_delete_security =	selinux_xfrm_policy_delete,
 	.xfrm_state_alloc_security =	selinux_xfrm_state_alloc,
 	.xfrm_state_free_security =	selinux_xfrm_state_free,
+	.xfrm_state_delete_security =	selinux_xfrm_state_delete,
 	.xfrm_policy_lookup = 		selinux_xfrm_policy_lookup,
 #endif
 };
diff -puN security/selinux/include/xfrm.h~lsm-secpeer-fix security/selinux/include/xfrm.h
--- linux-2.6.17-rc4-mm3/security/selinux/include/xfrm.h~lsm-secpeer-fix	2006-05-31 00:02:19.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/security/selinux/include/xfrm.h	2006-05-31 00:04:22.000000000 -0400
@@ -9,8 +9,10 @@
 int selinux_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
 int selinux_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new);
 void selinux_xfrm_policy_free(struct xfrm_policy *xp);
+int selinux_xfrm_policy_delete(struct xfrm_policy *xp);
 int selinux_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
 void selinux_xfrm_state_free(struct xfrm_state *x);
+int selinux_xfrm_state_delete(struct xfrm_state *x);
 int selinux_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
 
 /*
diff -puN security/selinux/xfrm.c~lsm-secpeer-fix security/selinux/xfrm.c
--- linux-2.6.17-rc4-mm3/security/selinux/xfrm.c~lsm-secpeer-fix	2006-05-31 00:02:28.000000000 -0400
+++ linux-2.6.17-rc4-mm3-cxzhang/security/selinux/xfrm.c	2006-05-31 00:43:38.000000000 -0400
@@ -132,10 +132,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
 		goto out;
 
 	/*
-	 * Does the subject have permission to set security or permission to
-	 * do the relabel?
-	 * Must be permitted to relabel from default socket type (process type)
-	 * to specified context
+	 * Does the subject have permission to set security context?
 	 */
 	rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
 			  SECCLASS_ASSOCIATION,
@@ -201,6 +198,24 @@ void selinux_xfrm_policy_free(struct xfr
 }
 
 /*
+ * LSM hook implementation that authorizes deletion of labeled policies.
+ */
+int selinux_xfrm_policy_delete(struct xfrm_policy *xp)
+{
+	struct task_security_struct *tsec = current->security;
+	struct xfrm_sec_ctx *ctx = xp->security;
+	int rc = 0;
+
+	if (ctx) {
+		rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
+		SECCLASS_ASSOCIATION,
+		ASSOCIATION__SETCONTEXT, NULL);
+	}
+
+	return rc;
+}
+
+/*
  * LSM hook implementation that allocs and transfers sec_ctx spec to
  * xfrm_state.
  */
@@ -292,6 +307,24 @@ u32 selinux_socket_getpeer_dgram(struct 
 	return SECSID_NULL;
 }
 
+ /*
+  * LSM hook implementation that authorizes deletion of labeled SAs.
+  */
+int selinux_xfrm_state_delete(struct xfrm_state *x)
+{
+	struct task_security_struct *tsec = current->security;
+	struct xfrm_sec_ctx *ctx = x->security;
+	int rc = 0;
+
+	if (ctx) {
+		rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
+			SECCLASS_ASSOCIATION,
+			ASSOCIATION__SETCONTEXT, NULL);
+	}
+
+	return rc;
+}
+
 /*
  * LSM hook that controls access to unlabelled packets.  If
  * a xfrm_state is authorizable (defined by macro) then it was
_

^ permalink raw reply

* Re: [PATCH,RFT] bcm43xx: use softmac-suggested TX rate
From: Daniel Drake @ 2006-06-05 19:48 UTC (permalink / raw)
  To: Michael Buesch; +Cc: John W. Linville, netdev
In-Reply-To: <200606052128.55416.mb@bu3sch.de>

Michael Buesch wrote:
> On Monday 05 June 2006 21:17, John W. Linville wrote:
>> OK, I will now 'officially' forget about this patch, and wait for you
>> to endorse it by re-sending it to me. :-)
> 
> Ok, but it depends on this patch, which does not seem to be in your tree, yet.
> http://marc.theaimsgroup.com/?l=linux-netdev&m=114651996213569&q=raw
> 
> I am not sure where it went, though... .

It's in the master branch.

Daniel


^ permalink raw reply

* Re: [PATCH 2.6.17-rc5] support for TSO over IPv6.
From: Stephen Hemminger @ 2006-06-05 19:43 UTC (permalink / raw)
  To: Ananda Raju
  Cc: netdev, jgarzik, leonid.grossman, ravinandan.arakali,
	rapuru.sriram, ananda.raju, sivakumar.subramani
In-Reply-To: <Pine.GSO.4.10.10606051458530.20246-100000@guinness>

On Mon, 5 Jun 2006 15:09:45 -0400 (EDT)
Ananda Raju <Ananda.Raju@neterion.com> wrote:

> Hi,
> 	Neterion Xframe adapter supports TSO over IPv6 but the linux kernel 
> 	don't support TSO over Ipv6. This patch will allow TCP
> 	Segmentation Offload (TSO) packets to be created over IPv6. 
> 	
> 	The following table shows there is significant improvement in
> 	throughput with normal frames and CPU usage for both normal and jumbo.
> 
>         --------------------------------------------------
>         |          |     1500        |      9600         |
>         |          ------------------|-------------------|
>         |          | thru     CPU    |  thru     CPU     |
>         --------------------------------------------------
>         | TSO OFF  | 1.80   2.0% id  |  5.53   1.0% id   |
>         --------------------------------------------------
>         | TSO ON   | 2.61   74.0 id  |  5.52   32.0% id  |
>         --------------------------------------------------
> 
> Please review the patch.

There is one problem that may mean you have to rethink this.

You ignore the possible case of hardware that can do any kind of checksum
(ie. IP_F_HW_CSUM).  So I think you need to add a new flag NETIF_F_TSO6
for those types of devices, rather than overloading NETIF_F_TSO to mean
"can do TCP segmentation offload for IPV4 or IPV6".

Your proposal:
	ipv4 sum   : NETIF_F_IP_CSUM
	ipv6 sum   : NETIF_F_IP6_CSUM
	hw sum     : NETIF_F_HW_CSUM
	tso, ipv4  : NETIF_F_IP_CSUM + NETIF_F_TSO
	tso, ipv6  : NETIF_F_IP6_CSUM + NETIF_F_TSO

My proposal:
	ipv4 sum   : NETIF_F_IP_CSUM
	ipv6 sum   : NETIF_F_IP6_CSUM
	hw sum     : NETIF_F_HW_CSUM
	tso, ipv4  : NETIF_F_IP_CSUM + NETIF_F_TSO
	tso, ipv6  : NETIF_F_IP6_CSUM + NETIF_F_TSO6
	tso, hw    : NETIF_F_HW_CSUM + NETIF_F_TSO6


^ permalink raw reply

* Re: [PATCH,RFT] bcm43xx: use softmac-suggested TX rate
From: John W. Linville @ 2006-06-05 19:42 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Daniel Drake, netdev
In-Reply-To: <200606052128.55416.mb@bu3sch.de>

On Mon, Jun 05, 2006 at 09:28:55PM +0200, Michael Buesch wrote:
> On Monday 05 June 2006 21:17, John W. Linville wrote:
> > OK, I will now 'officially' forget about this patch, and wait for you
> > to endorse it by re-sending it to me. :-)
> 
> Ok, but it depends on this patch, which does not seem to be in your tree, yet.
> http://marc.theaimsgroup.com/?l=linux-netdev&m=114651996213569&q=raw
> 
> I am not sure where it went, though... .

That is in the 'upstream' branch (stuff queued for 2.6.18) of wireless-2.6.

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply

* Re: [PATCH,RFT] bcm43xx: use softmac-suggested TX rate
From: Michael Buesch @ 2006-06-05 19:28 UTC (permalink / raw)
  To: John W. Linville; +Cc: Daniel Drake, netdev
In-Reply-To: <20060605191727.GJ6068@tuxdriver.com>

On Monday 05 June 2006 21:17, John W. Linville wrote:
> OK, I will now 'officially' forget about this patch, and wait for you
> to endorse it by re-sending it to me. :-)

Ok, but it depends on this patch, which does not seem to be in your tree, yet.
http://marc.theaimsgroup.com/?l=linux-netdev&m=114651996213569&q=raw

I am not sure where it went, though... .

-- 
Greetings Michael.

^ permalink raw reply

* Re: [PATCH] hush noisy ieee80211 CCMP printks
From: John W. Linville @ 2006-06-05 19:22 UTC (permalink / raw)
  To: Jason Lunz; +Cc: Jouni Malinen, netdev
In-Reply-To: <20060605160335.GB25688@knob.reflex>

On Mon, Jun 05, 2006 at 12:03:35PM -0400, Jason Lunz wrote:

> If the messages are actually useful, and unusual, then they should
> probably stay. But I get a LOT of them, and my wireless is working just
> fine.

I'm dropping this patch, based on Jouni's comments.  If you want to
reformulate a patch that make this output controlled by some sort of
debug option (runtime or compile-time), then please do so and post
it for consideration.

Thanks!

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply

* Re: [PATCH,RFT] bcm43xx: use softmac-suggested TX rate
From: John W. Linville @ 2006-06-05 19:17 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Daniel Drake, netdev
In-Reply-To: <200606052115.54366.mb@bu3sch.de>

On Mon, Jun 05, 2006 at 09:15:54PM +0200, Michael Buesch wrote:
> On Monday 05 June 2006 20:51, John W. Linville wrote:
> > On Fri, May 19, 2006 at 08:32:46PM +0200, Michael Buesch wrote:
> > > On Friday 19 May 2006 20:44, you wrote:
> > > > John W. Linville wrote:
> > > > > Do you intend for this to be merged?  Given recent miscommunication,
> > > > > I figured I should ask... :-)
> > > > 
> > > > Nobody has tested it yet, so no, but thanks for asking.
> > > > 
> > > > I figure it will be easier to find testers once the base patch (softmac 
> > > > suggest txrate) has been pushed by you into 2.6.18-rc1 ;)
> > > 
> > > Next time, please CC the maintainers, so they don't accidentally delete
> > > important mail. ;)
> > > Can you resend that patch to me in private and I will see if it
> > > is good.
> > 
> > Any more input on this patch?  Do we want it, or not?
> 
> I will test it now and send it to you afterwards.

OK, I will now 'officially' forget about this patch, and wait for you
to endorse it by re-sending it to me. :-)

Thanks,

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply

* Re: [PATCH,RFT] bcm43xx: use softmac-suggested TX rate
From: Michael Buesch @ 2006-06-05 19:15 UTC (permalink / raw)
  To: John W. Linville; +Cc: Daniel Drake, netdev
In-Reply-To: <20060605185147.GE6068@tuxdriver.com>

On Monday 05 June 2006 20:51, John W. Linville wrote:
> On Fri, May 19, 2006 at 08:32:46PM +0200, Michael Buesch wrote:
> > On Friday 19 May 2006 20:44, you wrote:
> > > John W. Linville wrote:
> > > > Do you intend for this to be merged?  Given recent miscommunication,
> > > > I figured I should ask... :-)
> > > 
> > > Nobody has tested it yet, so no, but thanks for asking.
> > > 
> > > I figure it will be easier to find testers once the base patch (softmac 
> > > suggest txrate) has been pushed by you into 2.6.18-rc1 ;)
> > 
> > Next time, please CC the maintainers, so they don't accidentally delete
> > important mail. ;)
> > Can you resend that patch to me in private and I will see if it
> > is good.
> 
> Any more input on this patch?  Do we want it, or not?

I will test it now and send it to you afterwards.

-- 
Greetings Michael.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox