* Re: [patch 1/3] natsemi: Add quirks for Aculab E1/T1 PMXc cPCI carrier cards
From: Jeff Garzik @ 2006-06-27 3:49 UTC (permalink / raw)
To: akpm; +Cc: netdev, broonie, jgarzik, thockin
In-Reply-To: <200606250844.k5P8iZkg020788@shell0.pdx.osdl.net>
akpm@osdl.org wrote:
> From: Mark Brown <broonie@sirena.org.uk>
>
> Aculab E1/T1 PMXc cPCI carrier card cards present a natsemi on the cPCI bus
> wired up in a non-standard fashion. This patch provides support in the
> natsemi driver for these cards by implementing a quirk mechanism and using
> that to configure appropriate settings for the card: forcing 100M full duplex,
> having a large EEPROM and using the MII port while ignoring PHYs.
>
> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
> Cc: Tim Hockin <thockin@hockin.org>
> Cc: Jeff Garzik <jgarzik@pobox.com>
>
> [akpm: this is a previously-nacked patch, but the problem is real]
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
>
> drivers/net/natsemi.c | 94 ++++++++++++++++++++++++--------------
> include/linux/pci_ids.h | 3 +
> 2 files changed, 63 insertions(+), 34 deletions(-)
I checked in a couple patches in preparation for merging this. Please
rediff and resend, and I'll apply.
Jeff
^ permalink raw reply
* Re: Please pull 'upstream' branch of wireless-2.6
From: Jeff Garzik @ 2006-06-27 3:50 UTC (permalink / raw)
To: Larry Finger; +Cc: John W. Linville, netdev, Bcm43xx-dev
In-Reply-To: <44A097AA.6080809@lwfinger.net>
Larry Finger wrote:
> Jeff Garzik wrote:
>> John W. Linville wrote:
>>> + assert(bcm->mac_suspended >= 0);
>>> + if (bcm->mac_suspended == 0) {
>>> + bcm43xx_power_saving_ctl_bits(bcm, -1, 1);
>>> + bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
>>> + bcm43xx_read32(bcm,
>>> BCM43xx_MMIO_STATUS_BITFIELD)
>>> + & ~BCM43xx_SBF_MAC_ENABLED);
>>> + bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy
>>> read */
>>> + for (i = 100000; i; i--) {
>>> + tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
>>> + if (tmp & BCM43xx_IRQ_READY)
>>> + goto out;
>>> + udelay(10);
>>> + }
>>> + printkl(KERN_ERR PFX "MAC suspend failed\n");
>>> }
>>
>>
>> NAK this super-long delay... should be done in a workqueue, looks like?
>>
>> ACK everything else.
>>
>
> That delay was set to try to accommodate my interface when it refused to
> suspend the MAC, which resulted in transmit errors. That problem has
> since been cured by reworking the periodic work handlers - thus such a
> long delay should not be needed. The original spec from the clean-room
> group was a delay loop of 1000. I'm currently testing that value now. If
> it passes the test, would a for (i=1000; i; i--) be acceptable?
That's acceptable, yes, but it sounds like the problem has since been cured?
Jeff
^ permalink raw reply
* Just published It will be great Enjoy
From: Hope @ 2006-06-27 3:50 UTC (permalink / raw)
To: netdev
How are u?
Enhanced male power and unlimited prowess with your girl The best products for the winning guys
Fill up your supplies with our secure ordering, cost saving and fast delivery.
These brands keep thousands and thousands of their customers pleased worldwide
Enter here: http://www.spaedna.com
We thank you for being our customer!
^ permalink raw reply
* [git patches] net driver updates
From: Jeff Garzik @ 2006-06-27 3:57 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds; +Cc: netdev, linux-kernel
Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
to receive the following updates:
drivers/net/3c59x.c | 79 +++++++++++++++----------------
drivers/net/dl2k.h | 12 +---
drivers/net/dm9000.c | 34 +++++++------
drivers/net/eepro100.c | 5 --
drivers/net/epic100.c | 20 +-------
drivers/net/fealnx.c | 10 ----
drivers/net/hamradio/dmascc.c | 2
drivers/net/natsemi.c | 100 +++++++++++++++++++---------------------
drivers/net/pcnet32.c | 6 --
drivers/net/phy/lxt.c | 8 +--
drivers/net/tulip/winbond-840.c | 26 ++--------
drivers/net/wan/c101.c | 2
drivers/net/wan/n2.c | 2
drivers/net/wan/pci200syn.c | 2
drivers/net/yellowfin.c | 24 ++-------
15 files changed, 133 insertions(+), 199 deletions(-)
Adrian Bunk:
drivers/net/hamradio/dmascc.c: fix section mismatch
Ben Dooks:
DM9000 - better checks for platform resources
DM9000 - check for MAC left in by bootloader
DM9000 - do no re-init spin lock
DM9000 - minor code cleanups
Jeff Garzik:
[netdrvr] natsemi: Separate out media initialization code
[netdrvr] natsemi: minor cleanups
[netdrvr] Remove long-unused bits from Becker template drivers
Krzysztof Halasa:
WAN: update info page for a bunch of my drivers
Uwe Zeisberger:
Fix phy id for LXT971A/LXT972A
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index e277789..b467c38 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -375,8 +375,7 @@ limit of 4K.
of the drivers, and will likely be provided by some future kernel.
*/
enum pci_flags_bit {
- PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
- PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
+ PCI_USES_MASTER=4,
};
enum { IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8,
@@ -446,95 +445,95 @@ static struct vortex_chip_info {
int io_size;
} vortex_info_tbl[] __devinitdata = {
{"3c590 Vortex 10Mbps",
- PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+ PCI_USES_MASTER, IS_VORTEX, 32, },
{"3c592 EISA 10Mbps Demon/Vortex", /* AKPM: from Don's 3c59x_cb.c 0.49H */
- PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+ PCI_USES_MASTER, IS_VORTEX, 32, },
{"3c597 EISA Fast Demon/Vortex", /* AKPM: from Don's 3c59x_cb.c 0.49H */
- PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+ PCI_USES_MASTER, IS_VORTEX, 32, },
{"3c595 Vortex 100baseTx",
- PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+ PCI_USES_MASTER, IS_VORTEX, 32, },
{"3c595 Vortex 100baseT4",
- PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+ PCI_USES_MASTER, IS_VORTEX, 32, },
{"3c595 Vortex 100base-MII",
- PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+ PCI_USES_MASTER, IS_VORTEX, 32, },
{"3c900 Boomerang 10baseT",
- PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
+ PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
{"3c900 Boomerang 10Mbps Combo",
- PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
+ PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
{"3c900 Cyclone 10Mbps TPO", /* AKPM: from Don's 0.99M */
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
{"3c900 Cyclone 10Mbps Combo",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
{"3c900 Cyclone 10Mbps TPC", /* AKPM: from Don's 0.99M */
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
{"3c900B-FL Cyclone 10base-FL",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
{"3c905 Boomerang 100baseTx",
- PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
+ PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
{"3c905 Boomerang 100baseT4",
- PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
+ PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
{"3c905B Cyclone 100baseTx",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
{"3c905B Cyclone 10/100/BNC",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
{"3c905B-FX Cyclone 100baseFx",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
{"3c905C Tornado",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
{"3c920B-EMB-WNM (ATI Radeon 9100 IGP)",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, },
{"3c980 Cyclone",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
{"3c980C Python-T",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
{"3cSOHO100-TX Hurricane",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
{"3c555 Laptop Hurricane",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|EEPROM_8BIT|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|EEPROM_8BIT|HAS_HWCKSM, 128, },
{"3c556 Laptop Tornado",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR|
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR|
HAS_HWCKSM, 128, },
{"3c556B Laptop Hurricane",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR|
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR|
WNO_XCVR_PWR|HAS_HWCKSM, 128, },
{"3c575 [Megahertz] 10/100 LAN CardBus",
- PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
+ PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
{"3c575 Boomerang CardBus",
- PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
+ PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
{"3CCFE575BT Cyclone CardBus",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|
INVERT_LED_PWR|HAS_HWCKSM, 128, },
{"3CCFE575CT Tornado CardBus",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
MAX_COLLISION_RESET|HAS_HWCKSM, 128, },
{"3CCFE656 Cyclone CardBus",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
INVERT_LED_PWR|HAS_HWCKSM, 128, },
{"3CCFEM656B Cyclone+Winmodem CardBus",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
INVERT_LED_PWR|HAS_HWCKSM, 128, },
{"3CXFEM656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
MAX_COLLISION_RESET|HAS_HWCKSM, 128, },
{"3c450 HomePNA Tornado", /* AKPM: from Don's 0.99Q */
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
{"3c920 Tornado",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
{"3c982 Hydra Dual Port A",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
{"3c982 Hydra Dual Port B",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
{"3c905B-T4",
- PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+ PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
{"3c920B-EMB-WNM Tornado",
- PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+ PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
{NULL,}, /* NULL terminated list. */
};
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 6e75482..5344920 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -683,11 +683,6 @@ struct netdev_private {
};
/* The station address location in the EEPROM. */
-#ifdef MEM_MAPPING
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)
-#else
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0)
-#endif
/* The struct pci_device_id consist of:
vendor, device Vendor and device ID to match (or PCI_ANY_ID)
subvendor, subdevice Subsystem vendor and device ID to match (or PCI_ANY_ID)
@@ -695,9 +690,10 @@ #endif
class_mask of the class are honored during the comparison.
driver_data Data private to the driver.
*/
-static struct pci_device_id rio_pci_tbl[] = {
- {0x1186, 0x4000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {0,}
+
+static const struct pci_device_id rio_pci_tbl[] = {
+ {0x1186, 0x4000, PCI_ANY_ID, PCI_ANY_ID, },
+ { }
};
MODULE_DEVICE_TABLE (pci, rio_pci_tbl);
#define TX_TIMEOUT (4*HZ)
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 24996da..7965a9b 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -410,10 +410,7 @@ dm9000_probe(struct platform_device *pde
if (pdev->num_resources < 2) {
ret = -ENODEV;
goto out;
- }
-
- switch (pdev->num_resources) {
- case 2:
+ } else if (pdev->num_resources == 2) {
base = pdev->resource[0].start;
if (!request_mem_region(base, 4, ndev->name)) {
@@ -423,17 +420,16 @@ dm9000_probe(struct platform_device *pde
ndev->base_addr = base;
ndev->irq = pdev->resource[1].start;
- db->io_addr = (void *)base;
- db->io_data = (void *)(base + 4);
-
- break;
+ db->io_addr = (void __iomem *)base;
+ db->io_data = (void __iomem *)(base + 4);
- case 3:
+ } else {
db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
db->irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (db->addr_res == NULL || db->data_res == NULL) {
+ if (db->addr_res == NULL || db->data_res == NULL ||
+ db->irq_res == NULL) {
printk(KERN_ERR PFX "insufficient resources\n");
ret = -ENOENT;
goto out;
@@ -482,7 +478,6 @@ dm9000_probe(struct platform_device *pde
/* ensure at least we have a default set of IO routines */
dm9000_set_io(db, iosize);
-
}
/* check to see if anything is being over-ridden */
@@ -564,6 +559,13 @@ #endif
for (i = 0; i < 6; i++)
ndev->dev_addr[i] = db->srom[i];
+ if (!is_valid_ether_addr(ndev->dev_addr)) {
+ /* try reading from mac */
+
+ for (i = 0; i < 6; i++)
+ ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
+ }
+
if (!is_valid_ether_addr(ndev->dev_addr))
printk("%s: Invalid ethernet MAC address. Please "
"set using ifconfig\n", ndev->name);
@@ -663,7 +665,6 @@ dm9000_init_dm9000(struct net_device *de
db->tx_pkt_cnt = 0;
db->queue_pkt_len = 0;
dev->trans_start = 0;
- spin_lock_init(&db->lock);
}
/*
@@ -767,7 +768,7 @@ dm9000_stop(struct net_device *ndev)
* receive the packet to upper layer, free the transmitted packet
*/
-void
+static void
dm9000_tx_done(struct net_device *dev, board_info_t * db)
{
int tx_status = ior(db, DM9000_NSR); /* Got TX status */
@@ -1187,13 +1188,14 @@ dm9000_drv_remove(struct platform_device
}
static struct platform_driver dm9000_driver = {
+ .driver = {
+ .name = "dm9000",
+ .owner = THIS_MODULE,
+ },
.probe = dm9000_probe,
.remove = dm9000_drv_remove,
.suspend = dm9000_drv_suspend,
.resume = dm9000_drv_resume,
- .driver = {
- .name = "dm9000",
- },
};
static int __init
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 467fc86..ecf5ad8 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -278,11 +278,6 @@ having to sign an Intel NDA when I'm hel
static int speedo_found1(struct pci_dev *pdev, void __iomem *ioaddr, int fnd_cnt, int acpi_idle_state);
-enum pci_flags_bit {
- PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
- PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
-};
-
/* Offsets to the various registers.
All accesses need not be longword aligned. */
enum speedo_offsets {
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 724d7dc..ee34a16 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -191,23 +191,10 @@ IVc. Errata
*/
-enum pci_id_flags_bits {
- /* Set PCI command register bits before calling probe1(). */
- PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
- /* Read and map the single following PCI BAR. */
- PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4,
- PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400,
-};
-
enum chip_capability_flags { MII_PWRDWN=1, TYPE2_INTR=2, NO_MII=4 };
#define EPIC_TOTAL_SIZE 0x100
#define USE_IO_OPS 1
-#ifdef USE_IO_OPS
-#define EPIC_IOTYPE PCI_USES_MASTER|PCI_USES_IO|PCI_ADDR0
-#else
-#define EPIC_IOTYPE PCI_USES_MASTER|PCI_USES_MEM|PCI_ADDR1
-#endif
typedef enum {
SMSC_83C170_0,
@@ -218,7 +205,6 @@ typedef enum {
struct epic_chip_info {
const char *name;
- enum pci_id_flags_bits pci_flags;
int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};
@@ -227,11 +213,11 @@ struct epic_chip_info {
/* indexed by chip_t */
static const struct epic_chip_info pci_id_tbl[] = {
{ "SMSC EPIC/100 83c170",
- EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN },
+ EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN },
{ "SMSC EPIC/100 83c170",
- EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR },
+ EPIC_TOTAL_SIZE, TYPE2_INTR },
{ "SMSC EPIC/C 83c175",
- EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR | MII_PWRDWN },
+ EPIC_TOTAL_SIZE, TYPE2_INTR | MII_PWRDWN },
};
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index a844926..13eca7e 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -126,16 +126,6 @@ MODULE_PARM_DESC(full_duplex, "fealnx fu
#define MIN_REGION_SIZE 136
-enum pci_flags_bit {
- PCI_USES_IO = 1,
- PCI_USES_MEM = 2,
- PCI_USES_MASTER = 4,
- PCI_ADDR0 = 0x10 << 0,
- PCI_ADDR1 = 0x10 << 1,
- PCI_ADDR2 = 0x10 << 2,
- PCI_ADDR3 = 0x10 << 3,
-};
-
/* A chip capabilities table, matching the entries in pci_tbl[] above. */
enum chip_capability_flags {
HAS_MII_XCVR,
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 0d5fccc..c9a46b8 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -436,7 +436,7 @@ static int __init dmascc_init(void)
module_init(dmascc_init);
module_exit(dmascc_exit);
-static void dev_setup(struct net_device *dev)
+static void __init dev_setup(struct net_device *dev)
{
dev->type = ARPHRD_AX25;
dev->hard_header_len = AX25_MAX_HEADER_LEN;
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 2e4eced..5657049 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -226,7 +226,6 @@ #define NATSEMI_NREGS (NATSEMI_PG0_NREG
NATSEMI_PG1_NREGS)
#define NATSEMI_REGS_VER 1 /* v1 added RFDR registers */
#define NATSEMI_REGS_SIZE (NATSEMI_NREGS * sizeof(u32))
-#define NATSEMI_DEF_EEPROM_SIZE 24 /* 12 16-bit values */
/* Buffer sizes:
* The nic writes 32-bit values, even if the upper bytes of
@@ -344,18 +343,6 @@ None characterised.
-enum pcistuff {
- PCI_USES_IO = 0x01,
- PCI_USES_MEM = 0x02,
- PCI_USES_MASTER = 0x04,
- PCI_ADDR0 = 0x08,
- PCI_ADDR1 = 0x10,
-};
-
-/* MMIO operations required */
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)
-
-
/*
* Support for fibre connections on Am79C874:
* This phy needs a special setup when connected to a fibre cable.
@@ -363,22 +350,25 @@ #define PCI_IOTYPE (PCI_USES_MASTER | PC
*/
#define PHYID_AM79C874 0x0022561b
-#define MII_MCTRL 0x15 /* mode control register */
-#define MII_FX_SEL 0x0001 /* 100BASE-FX (fiber) */
-#define MII_EN_SCRM 0x0004 /* enable scrambler (tp) */
+enum {
+ MII_MCTRL = 0x15, /* mode control register */
+ MII_FX_SEL = 0x0001, /* 100BASE-FX (fiber) */
+ MII_EN_SCRM = 0x0004, /* enable scrambler (tp) */
+};
/* array of board data directly indexed by pci_tbl[x].driver_data */
static const struct {
const char *name;
unsigned long flags;
+ unsigned int eeprom_size;
} natsemi_pci_info[] __devinitdata = {
- { "NatSemi DP8381[56]", PCI_IOTYPE },
+ { "NatSemi DP8381[56]", 0, 24 },
};
-static struct pci_device_id natsemi_pci_tbl[] = {
- { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_83815, PCI_ANY_ID, PCI_ANY_ID, },
- { 0, },
+static const struct pci_device_id natsemi_pci_tbl[] __devinitdata = {
+ { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+ { } /* terminate list */
};
MODULE_DEVICE_TABLE(pci, natsemi_pci_tbl);
@@ -813,6 +803,42 @@ static void move_int_phy(struct net_devi
udelay(1);
}
+static void __devinit natsemi_init_media (struct net_device *dev)
+{
+ struct netdev_private *np = netdev_priv(dev);
+ u32 tmp;
+
+ netif_carrier_off(dev);
+
+ /* get the initial settings from hardware */
+ tmp = mdio_read(dev, MII_BMCR);
+ np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10;
+ np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF;
+ np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE;
+ np->advertising= mdio_read(dev, MII_ADVERTISE);
+
+ if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL
+ && netif_msg_probe(np)) {
+ printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s "
+ "10%s %s duplex.\n",
+ pci_name(np->pci_dev),
+ (mdio_read(dev, MII_BMCR) & BMCR_ANENABLE)?
+ "enabled, advertise" : "disabled, force",
+ (np->advertising &
+ (ADVERTISE_100FULL|ADVERTISE_100HALF))?
+ "0" : "",
+ (np->advertising &
+ (ADVERTISE_100FULL|ADVERTISE_10FULL))?
+ "full" : "half");
+ }
+ if (netif_msg_probe(np))
+ printk(KERN_INFO
+ "natsemi %s: Transceiver status %#04x advertising %#04x.\n",
+ pci_name(np->pci_dev), mdio_read(dev, MII_BMSR),
+ np->advertising);
+
+}
+
static int __devinit natsemi_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -852,8 +878,7 @@ #endif
iosize = pci_resource_len(pdev, pcibar);
irq = pdev->irq;
- if (natsemi_pci_info[chip_idx].flags & PCI_USES_MASTER)
- pci_set_master(pdev);
+ pci_set_master(pdev);
dev = alloc_etherdev(sizeof (struct netdev_private));
if (!dev)
@@ -892,7 +917,7 @@ #endif
np->msg_enable = (debug >= 0) ? (1<<debug)-1 : NATSEMI_DEF_MSG;
np->hands_off = 0;
np->intr_status = 0;
- np->eeprom_size = NATSEMI_DEF_EEPROM_SIZE;
+ np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size;
/* Initial port:
* - If the nic was configured to use an external phy and if find_mii
@@ -957,34 +982,7 @@ #endif
if (mtu)
dev->mtu = mtu;
- netif_carrier_off(dev);
-
- /* get the initial settings from hardware */
- tmp = mdio_read(dev, MII_BMCR);
- np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10;
- np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF;
- np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE;
- np->advertising= mdio_read(dev, MII_ADVERTISE);
-
- if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL
- && netif_msg_probe(np)) {
- printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s "
- "10%s %s duplex.\n",
- pci_name(np->pci_dev),
- (mdio_read(dev, MII_BMCR) & BMCR_ANENABLE)?
- "enabled, advertise" : "disabled, force",
- (np->advertising &
- (ADVERTISE_100FULL|ADVERTISE_100HALF))?
- "0" : "",
- (np->advertising &
- (ADVERTISE_100FULL|ADVERTISE_10FULL))?
- "full" : "half");
- }
- if (netif_msg_probe(np))
- printk(KERN_INFO
- "natsemi %s: Transceiver status %#04x advertising %#04x.\n",
- pci_name(np->pci_dev), mdio_read(dev, MII_BMSR),
- np->advertising);
+ natsemi_init_media(dev);
/* save the silicon revision for later querying */
np->srr = readl(ioaddr + SiliconRev);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index fc08c4a..0e01c75 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -309,12 +309,6 @@ static int pcnet32_alloc_ring(struct net
static void pcnet32_free_ring(struct net_device *dev);
static void pcnet32_check_media(struct net_device *dev, int verbose);
-enum pci_flags_bit {
- PCI_USES_IO = 1, PCI_USES_MEM = 2, PCI_USES_MASTER = 4,
- PCI_ADDR0 = 0x10 << 0, PCI_ADDR1 = 0x10 << 1, PCI_ADDR2 =
- 0x10 << 2, PCI_ADDR3 = 0x10 << 3,
-};
-
static u16 pcnet32_wio_read_csr(unsigned long addr, int index)
{
outw(index, addr + PCNET32_WIO_RAP);
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c
index bef79e4..3f702c5 100644
--- a/drivers/net/phy/lxt.c
+++ b/drivers/net/phy/lxt.c
@@ -123,9 +123,9 @@ static int lxt971_config_intr(struct phy
}
static struct phy_driver lxt970_driver = {
- .phy_id = 0x07810000,
+ .phy_id = 0x78100000,
.name = "LXT970",
- .phy_id_mask = 0x0fffffff,
+ .phy_id_mask = 0xfffffff0,
.features = PHY_BASIC_FEATURES,
.flags = PHY_HAS_INTERRUPT,
.config_init = lxt970_config_init,
@@ -137,9 +137,9 @@ static struct phy_driver lxt970_driver =
};
static struct phy_driver lxt971_driver = {
- .phy_id = 0x0001378e,
+ .phy_id = 0x001378e0,
.name = "LXT971",
- .phy_id_mask = 0x0fffffff,
+ .phy_id_mask = 0xfffffff0,
.features = PHY_BASIC_FEATURES,
.flags = PHY_HAS_INTERRUPT,
.config_aneg = genphy_config_aneg,
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 8fea2aa..602a6e5 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -212,26 +212,15 @@ Test with 'ping -s 10000' on a fast comp
/*
PCI probe table.
*/
-enum pci_id_flags_bits {
- /* Set PCI command register bits before calling probe1(). */
- PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
- /* Read and map the single following PCI BAR. */
- PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4,
- PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400,
-};
enum chip_capability_flags {
- CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8,};
-#ifdef USE_IO_OPS
-#define W840_FLAGS (PCI_USES_IO | PCI_ADDR0 | PCI_USES_MASTER)
-#else
-#define W840_FLAGS (PCI_USES_MEM | PCI_ADDR1 | PCI_USES_MASTER)
-#endif
+ CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8,
+};
-static struct pci_device_id w840_pci_tbl[] = {
+static const struct pci_device_id w840_pci_tbl[] = {
{ 0x1050, 0x0840, PCI_ANY_ID, 0x8153, 0, 0, 0 },
{ 0x1050, 0x0840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
{ 0x11f6, 0x2011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 },
- { 0, }
+ { }
};
MODULE_DEVICE_TABLE(pci, w840_pci_tbl);
@@ -241,18 +230,17 @@ struct pci_id_info {
int pci, pci_mask, subsystem, subsystem_mask;
int revision, revision_mask; /* Only 8 bits. */
} id;
- enum pci_id_flags_bits pci_flags;
int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};
static struct pci_id_info pci_id_tbl[] = {
{"Winbond W89c840", /* Sometime a Level-One switch card. */
{ 0x08401050, 0xffffffff, 0x81530000, 0xffff0000 },
- W840_FLAGS, 128, CanHaveMII | HasBrokenTx | FDXOnNoMII},
+ 128, CanHaveMII | HasBrokenTx | FDXOnNoMII},
{"Winbond W89c840", { 0x08401050, 0xffffffff, },
- W840_FLAGS, 128, CanHaveMII | HasBrokenTx},
+ 128, CanHaveMII | HasBrokenTx},
{"Compex RL100-ATX", { 0x201111F6, 0xffffffff,},
- W840_FLAGS, 128, CanHaveMII | HasBrokenTx},
+ 128, CanHaveMII | HasBrokenTx},
{NULL,}, /* 0 terminated list. */
};
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
index b60ef02..c92ac9f 100644
--- a/drivers/net/wan/c101.c
+++ b/drivers/net/wan/c101.c
@@ -7,7 +7,7 @@
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
- * For information see http://hq.pm.waw.pl/hdlc/
+ * For information see <http://www.kernel.org/pub/linux/utils/net/hdlc/>
*
* Sources of information:
* Hitachi HD64570 SCA User's Manual
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c
index b7d88db..e013b81 100644
--- a/drivers/net/wan/n2.c
+++ b/drivers/net/wan/n2.c
@@ -7,7 +7,7 @@
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
- * For information see http://hq.pm.waw.pl/hdlc/
+ * For information see <http://www.kernel.org/pub/linux/utils/net/hdlc/>
*
* Note: integrated CSU/DSU/DDS are not supported by this driver
*
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index 670e8bd..24c3c57 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -7,7 +7,7 @@
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
- * For information see http://hq.pm.waw.pl/hdlc/
+ * For information see <http://www.kernel.org/pub/linux/utils/net/hdlc/>
*
* Sources of information:
* Hitachi HD64572 SCA-II User's Manual
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index ecec8e5..569305f 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -234,14 +234,6 @@ See Packet Engines confidential appendix
\f
-enum pci_id_flags_bits {
- /* Set PCI command register bits before calling probe1(). */
- PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
- /* Read and map the single following PCI BAR. */
- PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4,
- PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400,
- PCI_UNUSED_IRQ=0x800,
-};
enum capability_flags {
HasMII=1, FullTxStatus=2, IsGigabit=4, HasMulticastBug=8, FullRxStatus=16,
HasMACAddrBug=32, /* Only on early revs. */
@@ -249,11 +241,6 @@ enum capability_flags {
};
/* The PCI I/O space extent. */
#define YELLOWFIN_SIZE 0x100
-#ifdef USE_IO_OPS
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0)
-#else
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)
-#endif
struct pci_id_info {
const char *name;
@@ -261,24 +248,23 @@ struct pci_id_info {
int pci, pci_mask, subsystem, subsystem_mask;
int revision, revision_mask; /* Only 8 bits. */
} id;
- enum pci_id_flags_bits pci_flags;
int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};
static const struct pci_id_info pci_id_tbl[] = {
{"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
- PCI_IOTYPE, YELLOWFIN_SIZE,
+ YELLOWFIN_SIZE,
FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
{"Symbios SYM83C885", { 0x07011000, 0xffffffff},
- PCI_IOTYPE, YELLOWFIN_SIZE, HasMII | DontUseEeprom },
- {NULL,},
+ YELLOWFIN_SIZE, HasMII | DontUseEeprom },
+ { }
};
-static struct pci_device_id yellowfin_pci_tbl[] = {
+static const struct pci_device_id yellowfin_pci_tbl[] = {
{ 0x1000, 0x0702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0x1000, 0x0701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
- { 0, }
+ { }
};
MODULE_DEVICE_TABLE (pci, yellowfin_pci_tbl);
^ permalink raw reply related
* [Patch 1/1] AF_UNIX Datagram getpeersec
From: Catherine Zhang @ 2006-06-27 5:22 UTC (permalink / raw)
To: netdev, davem, jmorris, chrisw, herbert, sds, tjaeger, akpm
Cc: latten, sergeh, gcwilson, czhang.us
Hi,
One major change as per James' comment -- calls to get the security
context of a peer is done through the hook socket_getpeersec_dgram().
Again, comments are welcome!
thanks,
Catherine
--
From: cxzhang@watson.ibm.com
This patch implements an API whereby an application can determine the
label of its peer's Unix datagram sockets via the auxiliary data mechanism of
recvmsg.
Patch purpose:
This patch enables a security-aware application to retrieve the
security context of the peer of a Unix datagram socket. The application
can then use this security context to determine the security context for
processing on behalf of the peer who sent the packet.
Patch design and implementation:
The design and implementation is very similar to the UDP case for INET
sockets. Basically we build upon the existing Unix domain socket API for
retrieving user credentials. Linux offers the API for obtaining user
credentials via ancillary messages (i.e., out of band/control messages
that are bundled together with a normal message). To retrieve the security
context, the application first indicates to the kernel such desire by
setting the SO_PASSSEC option via getsockopt. Then the application
retrieves the security context using the auxiliary data mechanism.
An example server application for Unix datagram socket should look like this:
toggle = 1;
toggle_len = sizeof(toggle);
setsockopt(sockfd, SOL_SOCKET, SO_PASSSEC, &toggle, &toggle_len);
recvmsg(sockfd, &msg_hdr, 0);
if (msg_hdr.msg_controllen > sizeof(struct cmsghdr)) {
cmsg_hdr = CMSG_FIRSTHDR(&msg_hdr);
if (cmsg_hdr->cmsg_len <= CMSG_LEN(sizeof(scontext)) &&
cmsg_hdr->cmsg_level == SOL_SOCKET &&
cmsg_hdr->cmsg_type == SCM_SECURITY) {
memcpy(&scontext, CMSG_DATA(cmsg_hdr), sizeof(scontext));
}
}
sock_setsockopt is enhanced with a new socket option SOCK_PASSSEC to allow
a server socket to receive security context of the peer.
Testing:
We have tested the patch by setting up Unix datagram client and server
applications. We verified that the server can retrieve the security context
using the auxiliary data mechanism of recvmsg.
---
include/asm-alpha/socket.h | 1 +
include/asm-arm/socket.h | 1 +
include/asm-arm26/socket.h | 1 +
include/asm-cris/socket.h | 1 +
include/asm-frv/socket.h | 1 +
include/asm-h8300/socket.h | 1 +
include/asm-i386/socket.h | 1 +
include/asm-ia64/socket.h | 1 +
include/asm-m32r/socket.h | 1 +
include/asm-m68k/socket.h | 1 +
include/asm-mips/socket.h | 1 +
include/asm-parisc/socket.h | 1 +
include/asm-powerpc/socket.h | 1 +
include/asm-s390/socket.h | 1 +
include/asm-sh/socket.h | 1 +
include/asm-sparc/socket.h | 1 +
include/asm-sparc64/socket.h | 1 +
include/asm-v850/socket.h | 1 +
include/asm-x86_64/socket.h | 1 +
include/asm-xtensa/socket.h | 1 +
include/linux/net.h | 1 +
include/linux/selinux.h | 15 +++++++++++++++
include/net/af_unix.h | 2 ++
include/net/scm.h | 4 ++++
net/core/sock.c | 11 +++++++++++
net/unix/af_unix.c | 5 +++++
security/selinux/exports.c | 11 +++++++++++
security/selinux/hooks.c | 8 +++++++-
28 files changed, 76 insertions(+), 1 deletion(-)
diff -puN include/asm-i386/socket.h~lsm-secpeer-unix include/asm-i386/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-i386/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-i386/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-x86_64/socket.h~lsm-secpeer-unix include/asm-x86_64/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-x86_64/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-x86_64/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-ia64/socket.h~lsm-secpeer-unix include/asm-ia64/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-ia64/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-ia64/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -57,5 +57,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_IA64_SOCKET_H */
diff -puN include/asm-powerpc/socket.h~lsm-secpeer-unix include/asm-powerpc/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-powerpc/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-powerpc/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -55,5 +55,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_POWERPC_SOCKET_H */
diff -puN include/asm-h8300/socket.h~lsm-secpeer-unix include/asm-h8300/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-h8300/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-h8300/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-s390/socket.h~lsm-secpeer-unix include/asm-s390/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-s390/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-s390/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -56,5 +56,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-mips/socket.h~lsm-secpeer-unix include/asm-mips/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-mips/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-mips/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -69,6 +69,7 @@ To add: #define SO_REUSEPORT 0x0200 /* A
#define SO_PEERSEC 30
#define SO_SNDBUFFORCE 31
#define SO_RCVBUFFORCE 33
+#define SO_PASSSEC 34
#ifdef __KERNEL__
diff -puN include/asm-alpha/socket.h~lsm-secpeer-unix include/asm-alpha/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-alpha/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-alpha/socket.h 2006-06-16 16:02:55.000000000 -0400
@@ -51,6 +51,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 30
+#define SO_PASSSEC 34
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 19
diff -puN include/asm-v850/socket.h~lsm-secpeer-unix include/asm-v850/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-v850/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-v850/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* __V850_SOCKET_H__ */
diff -puN include/asm-sh/socket.h~lsm-secpeer-unix include/asm-sh/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-sh/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-sh/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* __ASM_SH_SOCKET_H */
diff -puN include/asm-m68k/socket.h~lsm-secpeer-unix include/asm-m68k/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-m68k/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-m68k/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-arm/socket.h~lsm-secpeer-unix include/asm-arm/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-arm/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-arm/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-cris/socket.h~lsm-secpeer-unix include/asm-cris/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-cris/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-cris/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -50,6 +50,7 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-arm26/socket.h~lsm-secpeer-unix include/asm-arm26/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-arm26/socket.h~lsm-secpeer-unix 2006-06-12 17:56:06.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-arm26/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-frv/socket.h~lsm-secpeer-unix include/asm-frv/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-frv/socket.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-frv/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,6 +48,7 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-xtensa/socket.h~lsm-secpeer-unix include/asm-xtensa/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-xtensa/socket.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-xtensa/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -59,5 +59,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _XTENSA_SOCKET_H */
diff -puN include/asm-m32r/socket.h~lsm-secpeer-unix include/asm-m32r/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-m32r/socket.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-m32r/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_M32R_SOCKET_H */
diff -puN include/asm-parisc/socket.h~lsm-secpeer-unix include/asm-parisc/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-parisc/socket.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-parisc/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 0x401c
#define SO_PEERSEC 0x401d
+#define SO_PASSSEC 0x401e
#endif /* _ASM_SOCKET_H */
diff -puN include/asm-sparc/socket.h~lsm-secpeer-unix include/asm-sparc/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-sparc/socket.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-sparc/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,6 +48,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 0x001e
+#define SO_PASSSEC 0x001f
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff -puN include/asm-sparc64/socket.h~lsm-secpeer-unix include/asm-sparc64/socket.h
--- linux-2.6.17-rc6-mm2/include/asm-sparc64/socket.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/asm-sparc64/socket.h 2006-06-13 15:45:34.000000000 -0400
@@ -48,6 +48,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 0x001e
+#define SO_PASSSEC 0x001f
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff -puN include/linux/net.h~lsm-secpeer-unix include/linux/net.h
--- linux-2.6.17-rc6-mm2/include/linux/net.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/linux/net.h 2006-06-13 15:45:34.000000000 -0400
@@ -61,6 +61,7 @@ typedef enum {
#define SOCK_ASYNC_WAITDATA 1
#define SOCK_NOSPACE 2
#define SOCK_PASSCRED 3
+#define SOCK_PASSSEC 4
#ifndef ARCH_HAS_SOCKET_TYPES
/**
diff -puN include/net/af_unix.h~lsm-secpeer-unix include/net/af_unix.h
--- linux-2.6.17-rc6-mm2/include/net/af_unix.h~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/net/af_unix.h 2006-06-26 16:05:06.000000000 -0400
@@ -53,10 +53,12 @@ struct unix_address {
struct unix_skb_parms {
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+ char *secdata; /* Security context */
};
#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
+#define UNIXSEC(skb) (&UNIXCB((skb)).secdata)
#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
diff -puN net/core/sock.c~lsm-secpeer-unix net/core/sock.c
--- linux-2.6.17-rc6-mm2/net/core/sock.c~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/net/core/sock.c 2006-06-13 15:45:34.000000000 -0400
@@ -565,6 +565,13 @@ set_rcvbuf:
ret = -ENONET;
break;
+ case SO_PASSSEC:
+ if (valbool)
+ set_bit(SOCK_PASSSEC, &sock->flags);
+ else
+ clear_bit(SOCK_PASSSEC, &sock->flags);
+ break;
+
/* We implement the SO_SNDLOWAT etc to
not be settable (1003.1g 5.3) */
default:
@@ -723,6 +730,10 @@ int sock_getsockopt(struct socket *sock,
v.val = sk->sk_state == TCP_LISTEN;
break;
+ case SO_PASSSEC:
+ v.val = test_bit(SOCK_PASSSEC, &sock->flags) ? 1 : 0;
+ break;
+
case SO_PEERSEC:
return security_socket_getpeersec_stream(sock, optval, optlen, len);
diff -puN net/unix/af_unix.c~lsm-secpeer-unix net/unix/af_unix.c
--- linux-2.6.17-rc6-mm2/net/unix/af_unix.c~lsm-secpeer-unix 2006-06-12 17:56:07.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/net/unix/af_unix.c 2006-06-26 17:42:45.000000000 -0400
@@ -1251,6 +1251,7 @@ static int unix_dgram_sendmsg(struct kio
struct sk_buff *skb;
long timeo;
struct scm_cookie tmp_scm;
+ int seclen = 0;
if (NULL == siocb->scm)
siocb->scm = &tmp_scm;
@@ -1290,6 +1291,9 @@ static int unix_dgram_sendmsg(struct kio
memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
if (siocb->scm->fp)
unix_attach_fds(siocb->scm, skb);
+ err = security_socket_getpeersec_dgram(skb, UNIXSEC(skb), &seclen);
+ if (err)
+ *(UNIXSEC(skb)) = NULL;
skb->h.raw = skb->data;
err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
@@ -1570,6 +1574,7 @@ static int unix_dgram_recvmsg(struct kio
memset(&tmp_scm, 0, sizeof(tmp_scm));
}
siocb->scm->creds = *UNIXCREDS(skb);
+ siocb->scm->secdata = *UNIXSEC(skb);
if (!(flags & MSG_PEEK))
{
diff -puN security/selinux/exports.c~lsm-secpeer-unix security/selinux/exports.c
--- linux-2.6.17-rc6-mm2/security/selinux/exports.c~lsm-secpeer-unix 2006-06-18 01:14:50.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/security/selinux/exports.c 2006-06-18 01:15:19.000000000 -0400
@@ -17,6 +17,7 @@
#include <linux/selinux.h>
#include <linux/fs.h>
#include <linux/ipc.h>
+#include <net/sock.h>
#include "security.h"
#include "objsec.h"
@@ -72,6 +73,16 @@ void selinux_get_task_sid(struct task_st
*sid = 0;
}
+void selinux_get_sock_sid(const struct socket *sock, u32 *sid)
+{
+ if (selinux_enabled) {
+ const struct inode *inode = SOCK_INODE(sock);
+ selinux_get_inode_sid(inode, sid);
+ return;
+ }
+ *sid = 0;
+}
+
int selinux_string_to_sid(char *str, u32 *sid)
{
if (selinux_enabled)
diff -puN include/linux/selinux.h~lsm-secpeer-unix include/linux/selinux.h
--- linux-2.6.17-rc6-mm2/include/linux/selinux.h~lsm-secpeer-unix 2006-06-18 01:44:44.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/linux/selinux.h 2006-06-18 01:29:36.000000000 -0400
@@ -18,6 +18,7 @@ struct selinux_audit_rule;
struct audit_context;
struct inode;
struct kern_ipc_perm;
+struct socket;
#ifdef CONFIG_SECURITY_SELINUX
@@ -119,6 +120,15 @@ void selinux_get_ipc_sid(const struct ke
void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
/**
+ * selinux_get_sock_sid - return the SID of socket
+ * @sock: the socket whose SID will be returned
+ * @sid: pointer to security context ID to be filled in.
+ *
+ * Returns nothing
+ */
+void selinux_get_sock_sid(const struct socket *sock, u32 *sid);
+
+/**
* selinux_string_to_sid - map a security context string to a security ID
* @str: the security context string to be mapped
* @sid: ID value returned via this.
@@ -193,6 +203,11 @@ static inline void selinux_get_task_sid(
*sid = 0;
}
+static inline void selinux_get_sock_sid(struct socket *sock, u32 *sid)
+{
+ *sid = 0;
+}
+
static inline int selinux_string_to_sid(const char *str, u32 *sid)
{
*sid = 0;
diff -puN include/net/scm.h~lsm-secpeer-unix include/net/scm.h
--- linux-2.6.17-rc6-mm2/include/net/scm.h~lsm-secpeer-unix 2006-06-26 16:16:35.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/include/net/scm.h 2006-06-26 23:07:11.000000000 -0400
@@ -19,6 +19,7 @@ struct scm_cookie
{
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+ char *secdata; /* Security context */
unsigned long seq; /* Connection seqno */
};
@@ -62,6 +63,9 @@ static __inline__ void scm_recv(struct s
if (test_bit(SOCK_PASSCRED, &sock->flags))
put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
+ if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
+ put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, strlen(scm->secdata)+1, scm->secdata);
+
if (!scm->fp)
return;
diff -puN security/selinux/hooks.c~lsm-secpeer-unix security/selinux/hooks.c
--- linux-2.6.17-rc6-mm2/security/selinux/hooks.c~lsm-secpeer-unix 2006-06-26 17:05:49.000000000 -0400
+++ linux-2.6.17-rc6-mm2-cxzhang/security/selinux/hooks.c 2006-06-26 17:42:12.000000000 -0400
@@ -69,6 +69,7 @@
#include <linux/sysctl.h>
#include <linux/audit.h>
#include <linux/string.h>
+#include <linux/selinux.h>
#include "avc.h"
#include "objsec.h"
@@ -3396,7 +3397,12 @@ out:
static int selinux_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, u32 *seclen)
{
int err = 0;
- u32 peer_sid = selinux_socket_getpeer_dgram(skb);
+ u32 peer_sid;
+
+ if (skb->sk->sk_family == PF_UNIX)
+ selinux_get_sock_sid(skb->sk->sk_socket, &peer_sid);
+ else
+ peer_sid = selinux_socket_getpeer_dgram(skb);
if (peer_sid == SECSID_NULL)
return -EINVAL;
_
^ permalink raw reply
* Re: [PATCH 0/2] NET: Accurate packet scheduling for ATM/ADSL
From: Russell Stuart @ 2006-06-27 6:19 UTC (permalink / raw)
To: Patrick McHardy
Cc: Russell Stuart, hadi, Alan Cox, Stephen Hemminger, netdev,
Jesper Dangaard Brouer
In-Reply-To: <449FC0AF.1050904@trash.net>
On 26/06/2006 9:10 PM, Patrick McHardy wrote:
>>5. We still did have to modify the kernel for ATM. That was
>> because of its rather unusual characteristics. However,
>> it you look at the size of modifications made to the kernel
>> verses the size made to the user space tool, (37 lines
>> versus 303 lines,) the bulk of the work was does in user
>> space.
>
> I'm sorry, but arguing that a limited special case solution is
> better because it needs slightly less code is just not reasonable.
Without seeing your actual proposal it is difficult to
judge whether this is a reasonable trade-off or not.
Hopefully we will see your code soon. Do you have any
idea when?
^ permalink raw reply
* Re: ipsec tunnel asymmetrical mtu
From: Marco Berizzi @ 2006-06-27 6:45 UTC (permalink / raw)
To: herbert; +Cc: netdev
In-Reply-To: <BAY103-F5BDFFFFDAB4CFB03007D9B2A60@phx.gbl>
>>Herbert Xu wrote:
>>
>>>However, the fact that the tcpdump causes more chunky packets to
>>>make it through could be an indication that there is a bug somewhere
>>>in our NAT/IPsec code or at least a suboptimal memory allocation
>>>strategy that's somehow avoided when AF_PACKET pins the skb down.
JFYI: same problem with 2.6.17-git10 (tcpdump 'resolves' the
problem)
^ permalink raw reply
* Re: [RFC][patch 1/4] Network namespaces: cleanup of dev_base list use
From: Kirill Korotaev @ 2006-06-27 6:59 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Andrey Savochkin, dlezcano, linux-kernel, netdev, serue, haveblue,
clg, Andrew Morton, herbert, devel, sam, viro
In-Reply-To: <m1odwguez3.fsf@ebiederm.dsl.xmission.com>
>>Cleanup of dev_base list use, with the aim to make device list per-namespace.
>>In almost every occasion, use of dev_base variable and dev->next pointer
>>could be easily replaced by for_each_netdev loop.
>>A few most complicated places were converted to using
>>first_netdev()/next_netdev().
>
>
> As a proof of concept patch this is ok.
>
> As a real world patch this is much too big, which prevents review.
> Plus it takes a few actions that are more than replace just
> iterators through the device list.
Mmm, actually it is a whole changeset and should go as a one patch. I
didn't find it to be big and my review took only 5-10mins..
I also don't think that mailing each driver maintainer is a good idea.
Only if we want to make some buzz :)
Kirill
^ permalink raw reply
* Re: [Patch 1/1] AF_UNIX Datagram getpeersec [Updated]
From: James Morris @ 2006-06-27 7:14 UTC (permalink / raw)
To: Catherine Zhang
Cc: netdev, David S. Miller, jmorris, chrisw, Herbert Xu,
Stephen Smalley, tjaeger, Andrew Morton, latten, sergeh, gcwilson,
czhang.us
In-Reply-To: <20060627052255.GA1311@jiayuguan.watson.ibm.com>
On Tue, 27 Jun 2006, Catherine Zhang wrote:
> Again, comments are welcome!
Got this warning while compiling.
security/selinux/exports.c: In function #selinux_get_sock_sid#:
security/selinux/exports.c:79: warning: passing argument 1 of #SOCK_INODE# discards qualifiers from pointer target type
In the interests of time, I've fixed that warning in an updated version of
your patch below.
Also, you've added a security field to a core kernel structure with no
#ifdefs and also added unconditional security related code to core
networking code.
I'll address that in a patch to follow. Could you please test these
updated patches? Thanks.
If they look ok to everyone and pass your testing, I'll submit them to
DaveM.
---
diff -purN -X dontdiff linux-2.6.p/include/asm-alpha/socket.h linux-2.6.w/include/asm-alpha/socket.h
--- linux-2.6.p/include/asm-alpha/socket.h 2006-06-21 00:02:08.000000000 -0400
+++ linux-2.6.w/include/asm-alpha/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -51,6 +51,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 30
+#define SO_PASSSEC 34
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 19
diff -purN -X dontdiff linux-2.6.p/include/asm-arm/socket.h linux-2.6.w/include/asm-arm/socket.h
--- linux-2.6.p/include/asm-arm/socket.h 2006-06-21 00:02:10.000000000 -0400
+++ linux-2.6.w/include/asm-arm/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-arm26/socket.h linux-2.6.w/include/asm-arm26/socket.h
--- linux-2.6.p/include/asm-arm26/socket.h 2006-06-21 00:02:10.000000000 -0400
+++ linux-2.6.w/include/asm-arm26/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-cris/socket.h linux-2.6.w/include/asm-cris/socket.h
--- linux-2.6.p/include/asm-cris/socket.h 2006-06-21 00:02:11.000000000 -0400
+++ linux-2.6.w/include/asm-cris/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -50,6 +50,7 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-frv/socket.h linux-2.6.w/include/asm-frv/socket.h
--- linux-2.6.p/include/asm-frv/socket.h 2006-06-21 00:02:11.000000000 -0400
+++ linux-2.6.w/include/asm-frv/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,6 +48,7 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-h8300/socket.h linux-2.6.w/include/asm-h8300/socket.h
--- linux-2.6.p/include/asm-h8300/socket.h 2006-06-21 00:02:11.000000000 -0400
+++ linux-2.6.w/include/asm-h8300/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-i386/socket.h linux-2.6.w/include/asm-i386/socket.h
--- linux-2.6.p/include/asm-i386/socket.h 2006-06-21 00:02:12.000000000 -0400
+++ linux-2.6.w/include/asm-i386/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-ia64/socket.h linux-2.6.w/include/asm-ia64/socket.h
--- linux-2.6.p/include/asm-ia64/socket.h 2006-06-21 00:02:12.000000000 -0400
+++ linux-2.6.w/include/asm-ia64/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -57,5 +57,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_IA64_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-m32r/socket.h linux-2.6.w/include/asm-m32r/socket.h
--- linux-2.6.p/include/asm-m32r/socket.h 2006-06-21 00:02:13.000000000 -0400
+++ linux-2.6.w/include/asm-m32r/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_M32R_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-m68k/socket.h linux-2.6.w/include/asm-m68k/socket.h
--- linux-2.6.p/include/asm-m68k/socket.h 2006-06-21 00:02:13.000000000 -0400
+++ linux-2.6.w/include/asm-m68k/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-mips/socket.h linux-2.6.w/include/asm-mips/socket.h
--- linux-2.6.p/include/asm-mips/socket.h 2006-06-21 00:02:15.000000000 -0400
+++ linux-2.6.w/include/asm-mips/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -69,6 +69,7 @@ To add: #define SO_REUSEPORT 0x0200 /* A
#define SO_PEERSEC 30
#define SO_SNDBUFFORCE 31
#define SO_RCVBUFFORCE 33
+#define SO_PASSSEC 34
#ifdef __KERNEL__
diff -purN -X dontdiff linux-2.6.p/include/asm-parisc/socket.h linux-2.6.w/include/asm-parisc/socket.h
--- linux-2.6.p/include/asm-parisc/socket.h 2006-06-21 00:02:15.000000000 -0400
+++ linux-2.6.w/include/asm-parisc/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 0x401c
#define SO_PEERSEC 0x401d
+#define SO_PASSSEC 0x401e
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-powerpc/socket.h linux-2.6.w/include/asm-powerpc/socket.h
--- linux-2.6.p/include/asm-powerpc/socket.h 2006-06-21 00:02:16.000000000 -0400
+++ linux-2.6.w/include/asm-powerpc/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -55,5 +55,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_POWERPC_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-s390/socket.h linux-2.6.w/include/asm-s390/socket.h
--- linux-2.6.p/include/asm-s390/socket.h 2006-06-21 00:02:17.000000000 -0400
+++ linux-2.6.w/include/asm-s390/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -56,5 +56,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-sh/socket.h linux-2.6.w/include/asm-sh/socket.h
--- linux-2.6.p/include/asm-sh/socket.h 2006-06-21 00:02:17.000000000 -0400
+++ linux-2.6.w/include/asm-sh/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* __ASM_SH_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-sparc/socket.h linux-2.6.w/include/asm-sparc/socket.h
--- linux-2.6.p/include/asm-sparc/socket.h 2006-06-21 00:02:18.000000000 -0400
+++ linux-2.6.w/include/asm-sparc/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,6 +48,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 0x001e
+#define SO_PASSSEC 0x001f
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff -purN -X dontdiff linux-2.6.p/include/asm-sparc64/socket.h linux-2.6.w/include/asm-sparc64/socket.h
--- linux-2.6.p/include/asm-sparc64/socket.h 2006-06-21 00:02:19.000000000 -0400
+++ linux-2.6.w/include/asm-sparc64/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,6 +48,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 0x001e
+#define SO_PASSSEC 0x001f
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff -purN -X dontdiff linux-2.6.p/include/asm-v850/socket.h linux-2.6.w/include/asm-v850/socket.h
--- linux-2.6.p/include/asm-v850/socket.h 2006-06-21 00:02:20.000000000 -0400
+++ linux-2.6.w/include/asm-v850/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* __V850_SOCKET_H__ */
diff -purN -X dontdiff linux-2.6.p/include/asm-x86_64/socket.h linux-2.6.w/include/asm-x86_64/socket.h
--- linux-2.6.p/include/asm-x86_64/socket.h 2006-06-21 00:02:20.000000000 -0400
+++ linux-2.6.w/include/asm-x86_64/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/asm-xtensa/socket.h linux-2.6.w/include/asm-xtensa/socket.h
--- linux-2.6.p/include/asm-xtensa/socket.h 2006-06-21 00:02:21.000000000 -0400
+++ linux-2.6.w/include/asm-xtensa/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -59,5 +59,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _XTENSA_SOCKET_H */
diff -purN -X dontdiff linux-2.6.p/include/linux/net.h linux-2.6.w/include/linux/net.h
--- linux-2.6.p/include/linux/net.h 2006-06-21 00:02:23.000000000 -0400
+++ linux-2.6.w/include/linux/net.h 2006-06-27 02:08:49.000000000 -0400
@@ -61,6 +61,7 @@ typedef enum {
#define SOCK_ASYNC_WAITDATA 1
#define SOCK_NOSPACE 2
#define SOCK_PASSCRED 3
+#define SOCK_PASSSEC 4
#ifndef ARCH_HAS_SOCKET_TYPES
/**
diff -purN -X dontdiff linux-2.6.p/include/linux/selinux.h linux-2.6.w/include/linux/selinux.h
--- linux-2.6.p/include/linux/selinux.h 2006-06-21 00:02:23.000000000 -0400
+++ linux-2.6.w/include/linux/selinux.h 2006-06-27 02:18:47.000000000 -0400
@@ -18,6 +18,7 @@ struct selinux_audit_rule;
struct audit_context;
struct inode;
struct kern_ipc_perm;
+struct socket;
#ifdef CONFIG_SECURITY_SELINUX
@@ -119,6 +120,15 @@ void selinux_get_ipc_sid(const struct ke
void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
/**
+ * selinux_get_sock_sid - return the SID of socket
+ * @sock: the socket whose SID will be returned
+ * @sid: pointer to security context ID to be filled in.
+ *
+ * Returns nothing
+ */
+void selinux_get_sock_sid(struct socket *sock, u32 *sid);
+
+/**
* selinux_string_to_sid - map a security context string to a security ID
* @str: the security context string to be mapped
* @sid: ID value returned via this.
@@ -193,6 +203,11 @@ static inline void selinux_get_task_sid(
*sid = 0;
}
+static inline void selinux_get_sock_sid(struct socket *sock, u32 *sid)
+{
+ *sid = 0;
+}
+
static inline int selinux_string_to_sid(const char *str, u32 *sid)
{
*sid = 0;
diff -purN -X dontdiff linux-2.6.p/include/net/af_unix.h linux-2.6.w/include/net/af_unix.h
--- linux-2.6.p/include/net/af_unix.h 2006-06-21 00:02:24.000000000 -0400
+++ linux-2.6.w/include/net/af_unix.h 2006-06-27 02:08:49.000000000 -0400
@@ -53,10 +53,12 @@ struct unix_address {
struct unix_skb_parms {
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+ char *secdata; /* Security context */
};
#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
+#define UNIXSEC(skb) (&UNIXCB((skb)).secdata)
#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
diff -purN -X dontdiff linux-2.6.p/include/net/scm.h linux-2.6.w/include/net/scm.h
--- linux-2.6.p/include/net/scm.h 2006-06-21 00:02:24.000000000 -0400
+++ linux-2.6.w/include/net/scm.h 2006-06-27 02:08:49.000000000 -0400
@@ -19,6 +19,7 @@ struct scm_cookie
{
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+ char *secdata; /* Security context */
unsigned long seq; /* Connection seqno */
};
@@ -62,6 +63,9 @@ static __inline__ void scm_recv(struct s
if (test_bit(SOCK_PASSCRED, &sock->flags))
put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
+ if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
+ put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, strlen(scm->secdata)+1, scm->secdata);
+
if (!scm->fp)
return;
diff -purN -X dontdiff linux-2.6.p/net/core/sock.c linux-2.6.w/net/core/sock.c
--- linux-2.6.p/net/core/sock.c 2006-06-21 00:02:27.000000000 -0400
+++ linux-2.6.w/net/core/sock.c 2006-06-27 02:08:49.000000000 -0400
@@ -565,6 +565,13 @@ set_rcvbuf:
ret = -ENONET;
break;
+ case SO_PASSSEC:
+ if (valbool)
+ set_bit(SOCK_PASSSEC, &sock->flags);
+ else
+ clear_bit(SOCK_PASSSEC, &sock->flags);
+ break;
+
/* We implement the SO_SNDLOWAT etc to
not be settable (1003.1g 5.3) */
default:
@@ -723,6 +730,10 @@ int sock_getsockopt(struct socket *sock,
v.val = sk->sk_state == TCP_LISTEN;
break;
+ case SO_PASSSEC:
+ v.val = test_bit(SOCK_PASSSEC, &sock->flags) ? 1 : 0;
+ break;
+
case SO_PEERSEC:
return security_socket_getpeersec_stream(sock, optval, optlen, len);
diff -purN -X dontdiff linux-2.6.p/net/unix/af_unix.c linux-2.6.w/net/unix/af_unix.c
--- linux-2.6.p/net/unix/af_unix.c 2006-06-21 00:02:30.000000000 -0400
+++ linux-2.6.w/net/unix/af_unix.c 2006-06-27 02:08:49.000000000 -0400
@@ -1251,6 +1251,7 @@ static int unix_dgram_sendmsg(struct kio
struct sk_buff *skb;
long timeo;
struct scm_cookie tmp_scm;
+ int seclen = 0;
if (NULL == siocb->scm)
siocb->scm = &tmp_scm;
@@ -1290,6 +1291,9 @@ static int unix_dgram_sendmsg(struct kio
memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
if (siocb->scm->fp)
unix_attach_fds(siocb->scm, skb);
+ err = security_socket_getpeersec_dgram(skb, UNIXSEC(skb), &seclen);
+ if (err)
+ *(UNIXSEC(skb)) = NULL;
skb->h.raw = skb->data;
err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
@@ -1570,6 +1574,7 @@ static int unix_dgram_recvmsg(struct kio
memset(&tmp_scm, 0, sizeof(tmp_scm));
}
siocb->scm->creds = *UNIXCREDS(skb);
+ siocb->scm->secdata = *UNIXSEC(skb);
if (!(flags & MSG_PEEK))
{
diff -purN -X dontdiff linux-2.6.p/security/selinux/exports.c linux-2.6.w/security/selinux/exports.c
--- linux-2.6.p/security/selinux/exports.c 2006-06-21 00:02:31.000000000 -0400
+++ linux-2.6.w/security/selinux/exports.c 2006-06-27 02:19:16.000000000 -0400
@@ -17,6 +17,7 @@
#include <linux/selinux.h>
#include <linux/fs.h>
#include <linux/ipc.h>
+#include <net/sock.h>
#include "security.h"
#include "objsec.h"
@@ -72,6 +73,16 @@ void selinux_get_task_sid(struct task_st
*sid = 0;
}
+void selinux_get_sock_sid(struct socket *sock, u32 *sid)
+{
+ if (selinux_enabled) {
+ const struct inode *inode = SOCK_INODE(sock);
+ selinux_get_inode_sid(inode, sid);
+ return;
+ }
+ *sid = 0;
+}
+
int selinux_string_to_sid(char *str, u32 *sid)
{
if (selinux_enabled)
diff -purN -X dontdiff linux-2.6.p/security/selinux/hooks.c linux-2.6.w/security/selinux/hooks.c
--- linux-2.6.p/security/selinux/hooks.c 2006-06-26 14:47:31.000000000 -0400
+++ linux-2.6.w/security/selinux/hooks.c 2006-06-27 02:08:49.000000000 -0400
@@ -69,6 +69,7 @@
#include <linux/sysctl.h>
#include <linux/audit.h>
#include <linux/string.h>
+#include <linux/selinux.h>
#include "avc.h"
#include "objsec.h"
@@ -3418,7 +3419,12 @@ out:
static int selinux_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, u32 *seclen)
{
int err = 0;
- u32 peer_sid = selinux_socket_getpeer_dgram(skb);
+ u32 peer_sid;
+
+ if (skb->sk->sk_family == PF_UNIX)
+ selinux_get_sock_sid(skb->sk->sk_socket, &peer_sid);
+ else
+ peer_sid = selinux_socket_getpeer_dgram(skb);
if (peer_sid == SECSID_NULL)
return -EINVAL;
^ permalink raw reply
* RE: [Repost PATCH 6/6] PMC MSP85x0 gigabit ethernet driver
From: Kiran Thota @ 2006-06-27 7:15 UTC (permalink / raw)
To: 'Francois Romieu'
Cc: 'Yoichi Yuasa', linux-mips, netdev, Raj Palani, ralf
Francois,
Thanks for your comments. I have absorbed almost all of your suggestions. You skimmed through 33% of the file before you dozed off... Waiting for the rest!
Kiran
-----Original Message-----
From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On Behalf Of Francois Romieu
Sent: Monday, June 26, 2006 3:31 PM
To: Kiran Thota
Cc: 'Yoichi Yuasa'; linux-mips@linux-mips.org; netdev@vger.kernel.org; Raj Palani; ralf@linux-mips.org
Subject: Re: [Repost PATCH 6/6] PMC MSP85x0 gigabit ethernet driver
Kiran Thota <Kiran_Thota@pmc-sierra.com> :
[...]
> - Based on linux-2.6.12 from
>
> http://www.linux-mips.org/pub/linux/mips/kernel/v2.6/linux-2.6.12.tar.
> gz
Is there a reason why the patch is not diffed against a more recent version of the mips tree ?
The patch includes ~130 lines ending with a tab or space delimiter.
They could be removed.
[...]
> diff -Naur a/drivers/net/msp85x0_ge.c b/drivers/net/msp85x0_ge.c
> --- a/drivers/net/msp85x0_ge.c 1969-12-31 16:00:00.000000000 -0800
> +++ b/drivers/net/msp85x0_ge.c 2006-06-26 12:12:39.000000000 -0700
[...]
> +/* Static Function Declarations */
> +static int msp85x0_ge_eth_open(struct net_device *); static int
> +msp85x0_ge_eth_reopen(struct net_device *netdev); static void
> +msp85x0_ge_eth_stop(struct net_device *); static struct
> +net_device_stats *msp85x0_ge_get_stats(struct net_device *); static
> +int msp85x0_ge_init_rx_desc_ring(msp85x0_ge_port_info *, int, int,
> + unsigned long, unsigned long,
> + unsigned long);
> +static int msp85x0_ge_init_tx_desc_ring(msp85x0_ge_port_info *, int,
> + unsigned long, unsigned long);
> +
> +static int msp85x0_ge_open(struct net_device *); static int
> +msp85x0_ge_start_xmit(struct sk_buff *, struct net_device *); static
> +int msp85x0_ge_stop(struct net_device *);
> +
> +static unsigned int msp85x0_ge_tx_coal(int);
> +
> +static void msp85x0_ge_port_reset(unsigned int); static int
> +msp85x0_ge_free_tx_queue(struct net_device *); static int
> +msp85x0_ge_rx_task(struct net_device *, msp85x0_ge_port_info *);
> +static int msp85x0_ge_port_start(struct net_device *); static int
> +msp85x0_eth_setup_tx_rx_fifo(struct net_device *dev); static int
> +msp85x0_ge_xdma_reset(void);
You should be able to remove the forward declarations by correctly reordering the code.
[...]
> +static struct platform_device *msp85x0_ge_device[NO_PORTS]; static
> +struct net_device *msp85x0_eth[NO_PORTS]; static unsigned int
> +msp85x0_ge_sram; static unsigned int port_number;
The way it is used, port_number should be a local variable.
> +
> +/*
> + * The MSP85x0 GE has two alignment requirements:
> + * -> skb->data to be cacheline aligned (32 byte)
> + * -> IP header alignment to 16 bytes
> + *
> + * The latter is not implemented. So, that results in an extra copy
> +on
> + * the Rx. This is a big performance hog. For the former case, the
> + * dev_alloc_skb() has been replaced with msp85x0_ge_alloc_skb(). The
> +size
> + * requested is calculated:
> + *
> + * Ethernet Frame Size : 1518
> + * Ethernet Header : 14
> + * Future MSP85x0 change for IP header alignment : 2
> + *
> + * Hence, we allocate (1518 + 14 + 2+ 64) = 1580 bytes. For IP
> +header
> + * alignment, we use skb_reserve().
> + */
> +#define ALIGNED_RX_SKB_ADDR(addr) \
> + ((((unsigned long)(addr) + (32UL - 1UL)) \
> + & ~(32UL - 1UL)) - (unsigned long)(addr)) #define
> +msp85x0_ge_alloc_skb(__length, __gfp_flags) \
> +({ struct sk_buff *__skb; \
> + __skb = alloc_skb((__length),(__gfp_flags)); \
> + if(__skb){ \
> + int __offset = (int) ALIGNED_RX_SKB_ADDR(__skb->data); \
> + if(__offset) \
> + skb_reserve(__skb, __offset); \
> + } \
> + __skb; \
> +})
Please use a function for msp85x0_ge_alloc_skb.
> +
> +int increment_tx_pkt_count(unsigned int port)
static
> +{
> + unsigned int flags;
> + spin_lock_irqsave(&msp85x0_lock,flags);
> + if(port==0){
CodingStyle: if (port == 0) {
(or 'if (!port)')
> + port0_pkt_count++;
> + }
> + else{
} else {
> + port1_pkt_count++;
> + }
> + spin_unlock_irqrestore(&msp85x0_lock,flags);
increment_tx_pkt_count() is only issued from msp85x0_ge_tx_queue(), itself only issued from msp85x0_ge_start_xmit and xmit handlers run with irq enabled. The save/restore is not needed.
> + return 0;
Useless return.
> +}
> +
> +unsigned int get_tx_pkt_count(unsigned int port)
static
> +{
> + unsigned int flags,pktCount,tx_pending_pkt;
Mixed case can be avoided here.
> + spin_lock_irqsave(&msp85x0_lock,flags);
See above.
> + tx_pending_pkt=MSP85x0_GE_READ(MSP85x0_GE_CHANNEL0_TX_DMA_STS + (port << XDMA_PORT_OFFSET));
> + if(port==0){
> + pktCount=port0_pkt_count - tx_pending_pkt;
> + }
> + else{
Sic.
> + pktCount=port1_pkt_count - tx_pending_pkt;
> + }
> + spin_unlock_irqrestore(&msp85x0_lock,flags);
> + return pktCount;
> +}
> +
> +unsigned int decrement_tx_pkt_count(unsigned int port)
static
[...]
> +void msp85x0_bringup_sequence(int port)
static
> +{
> + unsigned int reg_data;
> +
> + /* SDQPF */
> + reg_data=MSP85x0_GE_READ(MSP85x0_GE_SDQPF_RXFIFO_CTL + (port << 8));
reg_data = MSP85x0_GE_READ(MSP85x0_GE_...
[...]
> +static void msp85x0_ge_gmii_config(int port_num) {
[...]
> + if (phy_reg & 0x8000) {
> + if (phy_reg & 0x2000) {
> + /* Full Duplex and 1000 Mbps */
> + MSP85x0_GE_WRITE((MSP85x0_GE_GMII_CONFIG_MODE +
> + (port_num << MII_PORT_OFFSET)), 0x201);
> + } else {
> + /* Half Duplex and 1000 Mbps */
> + MSP85x0_GE_WRITE((MSP85x0_GE_GMII_CONFIG_MODE +
> + (port_num << MII_PORT_OFFSET)), 0x2201);
> + }
> + }
:o(
mode = (phy_reg & 0x2000) ? 0x0201 : 0x2201;
MSP85x0_GE_WRITE((MSP85x0_GE_GMII_CONFIG_MODE +
(port_num << MII_PORT_OFFSET)), mode);
> + if (phy_reg & 0x4000) {
> + if (phy_reg & 0x2000) {
> + /* Full Duplex and 100 Mbps */
> + MSP85x0_GE_WRITE((MSP85x0_GE_GMII_CONFIG_MODE +
> + (port_num << MII_PORT_OFFSET)), 0x100);
> + } else {
> + /* Half Duplex and 100 Mbps */
> + MSP85x0_GE_WRITE((MSP85x0_GE_GMII_CONFIG_MODE +
> + (port_num << MII_PORT_OFFSET)), 0x2100);
> + }
> + }
I'd bet you could make a single MSP85x0_GE_WRITE for this one and the two above.
[...]
> +static void msp85x0_ge_update_afx(msp85x0_ge_port_info *
> +msp85x0_ge_eth) {
> + int port = msp85x0_ge_eth->port_num;
> + unsigned int i;
> + volatile unsigned long reg_data = 0;
Mantra: volatile is not the answer.
Now, what's the question ? :o)
[...]
> +static void msp85x0_ge_tx_timeout_task(struct net_device *netdev) {
> + msp85x0_ge_port_info *msp85x0_ge_eth = netdev_priv(netdev);
> + int port = msp85x0_ge_eth->port_num;
> +
> + printk("MSP85x0 GE: Transmit timed out. Resetting ... \n");
Missing KERN_xyz
[...]
> +static int msp85x0_ge_change_mtu(struct net_device *netdev, int
> +new_mtu) {
[...]
> + if (netif_running(netdev)) {
> + msp85x0_ge_eth_stop(netdev);
> + MSP85x0_GE_WRITE((MSP85x0_GE_RMAC_MAX_FRAME_LEN +
> +(msp85x0_ge_eth->port_num << MAC_PORT_OFFSET)), new_mtu + 2); // for
> +the padded bytes
> +
> + if (msp85x0_ge_eth_reopen(netdev) != 0) {
> + printk(KERN_ERR
> + "%s: Fatal error on opening device\n",
> + netdev->name);
> + spin_unlock_irqrestore(&msp85x0_ge_eth->lock, flags);
> + return -1;
Please use -Esomething.
You may consider goto to balance spin_{lock/unlock}.
[...]
> +static irqreturn_t msp85x0_ge_sequoia_int_handler(int irq, void *dev_id,
> + struct pt_regs *regs)
> +{
> + struct net_device *netdev = (struct net_device *) dev_id;
Useless cast from void *.
[...]
> + /* Handle the Rx next */
> + if (eth_int_cause1 & (RX_INT << (port_num * 16))) {
> + clear_xdma_interrupts(port_num,RX_INT);
> + if (netif_rx_schedule_prep(netdev)) {
> + msp85x0_ge_disable_rx_int(port_num);
> + __netif_rx_schedule(netdev);
The indentation went badly wrong.
[...]
> +static int msp85x0_ge_open(struct net_device *netdev) {
> + msp85x0_ge_port_info *msp85x0_ge_eth = netdev_priv(netdev);
> + unsigned int port_num = msp85x0_ge_eth->port_num;
> + unsigned int irq;
> + int retval;
> +
> + spin_lock_irq(&(msp85x0_ge_eth->lock));
> +
> + if (msp85x0_ge_eth_open(netdev) != MSP85x0_OK) {
> + spin_unlock_irq(&(msp85x0_ge_eth->lock));
> + printk("%s: Error opening interface \n", netdev->name);
Missing KERN_xyz
> + free_irq(netdev->irq, netdev);
request_irq() comes later.
> + return -EBUSY;
Why not propagate an usual return status code from msp85x0_ge_eth_open ?
> + }
> +
> + spin_unlock_irq(&(msp85x0_ge_eth->lock));
> +
> + irq = MSP85x0_ETH_PORT_IRQ;
> +
> + retval = request_irq(irq, INTERRUPT_HANDLER,
> + SA_SAMPLE_RANDOM | SA_SHIRQ, netdev->name, netdev);
> +
> + if (retval != 0) {
> + printk(KERN_ERR "Cannot assign IRQ number to MSP85x0 GE \n");
> + return -1;
- msp85x0_ge_eth_open() should be balanced a bit (stop queuing for instance) ;
- no need to throw away retval.
(some sleep needed here, sorry)
--
Ueimor
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [Patch 1/1] AF_UNIX Datagram getpeersec [Updated #2]
From: James Morris @ 2006-06-27 7:16 UTC (permalink / raw)
To: Catherine Zhang
Cc: netdev, David S. Miller, jmorris, chrisw, Herbert Xu,
Stephen Smalley, tjaeger, Andrew Morton, latten, sergeh, gcwilson,
czhang.us
In-Reply-To: <Pine.LNX.4.64.0606270311210.30073@d.namei>
On Tue, 27 Jun 2006, James Morris wrote:
> I'll address that in a patch to follow. Could you please test these
> updated patches? Thanks.
>
Below is a relative patch which only compiles this stuff into the core
networking code when appropriate kernel config is selected.
Please review.
---
diff -purN -X dontdiff linux-2.6.p/include/net/scm.h linux-2.6.w/include/net/scm.h
--- linux-2.6.p/include/net/scm.h 2006-06-27 02:26:02.000000000 -0400
+++ linux-2.6.w/include/net/scm.h 2006-06-27 03:03:30.000000000 -0400
@@ -19,7 +19,9 @@ struct scm_cookie
{
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+#ifdef CONFIG_SECURITY_NETWORK
char *secdata; /* Security context */
+#endif
unsigned long seq; /* Connection seqno */
};
@@ -49,6 +51,17 @@ static __inline__ int scm_send(struct so
return __scm_send(sock, msg, scm);
}
+#ifdef CONFIG_SECURITY_NETWORK
+static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
+{
+ if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
+ put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, strlen(scm->secdata)+1, scm->secdata);
+}
+#else
+static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
+{ }
+#endif /* CONFIG_SECURITY_NETWORK */
+
static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
struct scm_cookie *scm, int flags)
{
@@ -63,8 +76,7 @@ static __inline__ void scm_recv(struct s
if (test_bit(SOCK_PASSCRED, &sock->flags))
put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
- if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
- put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, strlen(scm->secdata)+1, scm->secdata);
+ scm_passec(sock, msg, scm);
if (!scm->fp)
return;
diff -purN -X dontdiff linux-2.6.p/net/unix/af_unix.c linux-2.6.w/net/unix/af_unix.c
--- linux-2.6.p/net/unix/af_unix.c 2006-06-27 02:26:02.000000000 -0400
+++ linux-2.6.w/net/unix/af_unix.c 2006-06-27 03:03:29.000000000 -0400
@@ -128,6 +128,28 @@ static atomic_t unix_nr_socks = ATOMIC_I
#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
+#ifdef CONFIG_SECURITY_NETWORKING
+static void unix_get_peersec_dgram(struct sk_buff *skb)
+{
+ int tmp = 0;
+
+ err = security_socket_getpeersec_dgram(skb, UNIXSEC(skb), &tmp);
+ if (err)
+ *(UNIXSEC(skb)) = NULL;
+}
+
+static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
+{
+ scm->secdata = *UNIXSEC(skb);
+}
+#else
+static void unix_get_peersec_dgram(struct sk_buff *skb)
+{ }
+
+static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
+{ }
+#endif /* CONFIG_SECURITY_NETWORKING */
+
/*
* SMP locking strategy:
* hash table is protected with spinlock unix_table_lock
@@ -1251,7 +1273,6 @@ static int unix_dgram_sendmsg(struct kio
struct sk_buff *skb;
long timeo;
struct scm_cookie tmp_scm;
- int seclen = 0;
if (NULL == siocb->scm)
siocb->scm = &tmp_scm;
@@ -1291,9 +1312,8 @@ static int unix_dgram_sendmsg(struct kio
memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
if (siocb->scm->fp)
unix_attach_fds(siocb->scm, skb);
- err = security_socket_getpeersec_dgram(skb, UNIXSEC(skb), &seclen);
- if (err)
- *(UNIXSEC(skb)) = NULL;
+
+ unix_get_peersec_dgram(skb);
skb->h.raw = skb->data;
err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
@@ -1574,7 +1594,7 @@ static int unix_dgram_recvmsg(struct kio
memset(&tmp_scm, 0, sizeof(tmp_scm));
}
siocb->scm->creds = *UNIXCREDS(skb);
- siocb->scm->secdata = *UNIXSEC(skb);
+ unix_set_secdata(siocb->scm, skb);
if (!(flags & MSG_PEEK))
{
^ permalink raw reply
* Re: [PATCH 06/21] e1000: add smart power down code
From: Florian Reitmeir @ 2006-06-27 8:49 UTC (permalink / raw)
To: Jeff Garzik, netdev
In-Reply-To: <44A08D35.7090007@pobox.com>
On Mon, 26 Jun 2006, Jeff Garzik wrote:
> Kok, Auke wrote:
> >Smart Power Down is a power saving feature in newer e1000 hardware. We
> >disable it because it causes time to link to be long, but make it a
> >user choice.
> >
> >Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> >Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
> >---
> >
> > drivers/net/e1000/e1000.h | 1 +
> > drivers/net/e1000/e1000_main.c | 15 +++++++++++++++
> > drivers/net/e1000/e1000_param.c | 25 +++++++++++++++++++++++++
> > 3 files changed, 41 insertions(+), 0 deletions(-)
>
> Since it's not default, who will actually use this? Particularly since
> it is only a module option, and not supported through ethtool (frown).
i would use it, i always wanted the feature on my laptop (ibm thinkpad)
--
Florian Reitmeir
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Andrey Savochkin @ 2006-06-27 9:09 UTC (permalink / raw)
To: Herbert Poetzl
Cc: Eric W. Biederman, Daniel Lezcano, linux-kernel, netdev, serue,
haveblue, clg, Andrew Morton, dev, devel, sam, viro,
Alexey Kuznetsov
In-Reply-To: <20060626200225.GA5330@MAIL.13thfloor.at>
Herbert,
On Mon, Jun 26, 2006 at 10:02:25PM +0200, Herbert Poetzl wrote:
>
> keep in mind that you actually have three kinds
> of network traffic on a typical host/guest system:
>
> - traffic between unit and outside
> - host traffic should be quite minimal
> - guest traffic will be quite high
>
> - traffic between host and guest
> probably minimal too (only for shared services)
>
> - traffic between guests
> can be as high (or even higher) than the
> outbound traffic, just think web guest and
> database guest
My experience with host-guest systems tells me the opposite:
outside traffic is a way higher than traffic between guests.
People put web server and database in different guests not more frequent than
they put them on separate physical server.
Unless people are building a really huge system when 1 server can't take the
whole load, web and database live together and benefit from communications
over UNIX sockets.
Guests are usually comprised of web-db pairs, and people place many such
guests on a single computer.
>
> > The routing between network namespaces does have the potential to be
> > more expensive than just a packet trivially coming off the wire into a
> > socket.
>
> IMHO the routing between network namespaces should
> not require more than the current local traffic
> does (i.e. you should be able to achieve loopback
> speed within an insignificant tolerance) and not
> nearly the time required for on-wire stuff ...
I'd like to caution about over-optimizing communications between different
network namespaces.
Many optimizations of local traffic (such as high MTU) don't look so
appealing when you start to think about live migration of namespaces.
Regards
Andrey
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Andrey Savochkin @ 2006-06-27 9:11 UTC (permalink / raw)
To: Daniel Lezcano
Cc: linux-kernel, netdev, serue, haveblue, clg, Andrew Morton, dev,
herbert, devel, sam, ebiederm, viro, Alexey Kuznetsov
In-Reply-To: <44A00215.2040608@fr.ibm.com>
Daniel,
On Mon, Jun 26, 2006 at 05:49:41PM +0200, Daniel Lezcano wrote:
>
> > Then you lose the ability for each namespace to have its own routing entries.
> > Which implies that you'll have difficulties with devices that should exist
> > and be visible in one namespace only (like tunnels), as they require IP
> > addresses and route.
>
> I mean instead of having the route tables private to the namespace, the
> routes have the information to which namespace they are associated.
I think I understand what you're talking about: you want to make routing
responsible for determining destination namespace ID in addition to route
type (local, unicast etc), nexthop information, and so on. Right?
My point is that if you make namespace tagging at routing time, and
your packets are being routed only once, you lose the ability
to have separate routing tables in each namespace.
Andrey
^ permalink raw reply
* Re: [patch 3/4] Network namespaces: IPv4 FIB/routing in namespaces
From: Andrey Savochkin @ 2006-06-27 9:25 UTC (permalink / raw)
To: Herbert Poetzl
Cc: Daniel Lezcano, linux-kernel, netdev, serue, haveblue, clg,
Andrew Morton, dev, devel, sam, ebiederm, viro
In-Reply-To: <20060626200513.GB5330@MAIL.13thfloor.at>
On Mon, Jun 26, 2006 at 10:05:14PM +0200, Herbert Poetzl wrote:
> On Mon, Jun 26, 2006 at 04:56:46PM +0200, Daniel Lezcano wrote:
> > Andrey Savochkin wrote:
> > >Structures related to IPv4 rounting (FIB and routing cache)
> > >are made per-namespace.
> >
> > How do you handle ICMP_REDIRECT ?
>
> and btw. how do you handle the beloved 'ping'
> (i.e. ICMP_ECHO_REQUEST/REPLY for and from
> guests?
I don't need to do anything special. They are just IP packets.
If packets are local in the current net namespace, they are delivered to
socket or handled by icmp_rcv.
Certainly, packet/raw sockets shouldn't see packets they aren't supposed to
see. For raw sockets, it implies making socket lookup aware of namespaces,
exactly like for TCP or UDP.
Andrey
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Daniel Lezcano @ 2006-06-27 9:34 UTC (permalink / raw)
To: Andrey Savochkin
Cc: linux-kernel, netdev, serue, haveblue, clg, Andrew Morton, dev,
herbert, devel, sam, ebiederm, viro, Alexey Kuznetsov
In-Reply-To: <20060627131136.B13959@castle.nmd.msu.ru>
Andrey Savochkin wrote:
> Daniel,
>
> On Mon, Jun 26, 2006 at 05:49:41PM +0200, Daniel Lezcano wrote:
>
>>>Then you lose the ability for each namespace to have its own routing entries.
>>>Which implies that you'll have difficulties with devices that should exist
>>>and be visible in one namespace only (like tunnels), as they require IP
>>>addresses and route.
>>
>>I mean instead of having the route tables private to the namespace, the
>>routes have the information to which namespace they are associated.
>
>
> I think I understand what you're talking about: you want to make routing
> responsible for determining destination namespace ID in addition to route
> type (local, unicast etc), nexthop information, and so on. Right?
Yes.
>
> My point is that if you make namespace tagging at routing time, and
> your packets are being routed only once, you lose the ability
> to have separate routing tables in each namespace.
Right. What is the advantage of having separate the routing tables ?
^ permalink raw reply
* Re: ipsec tunnel asymmetrical mtu
From: Herbert Xu @ 2006-06-27 8:37 UTC (permalink / raw)
To: Marco Berizzi; +Cc: netdev
In-Reply-To: <BAY103-F48CEDE1C901D0DF661A82B27E0@phx.gbl>
On Tue, Jun 27, 2006 at 08:45:52AM +0200, Marco Berizzi wrote:
>
> >>Herbert Xu wrote:
> >>
> >>>However, the fact that the tcpdump causes more chunky packets to
> >>>make it through could be an indication that there is a bug somewhere
> >>>in our NAT/IPsec code or at least a suboptimal memory allocation
> >>>strategy that's somehow avoided when AF_PACKET pins the skb down.
>
> JFYI: same problem with 2.6.17-git10 (tcpdump 'resolves' the
> problem)
Hey I thought your problem went away because your hardware is gone!
Just kidding :)
Seriously, I should have some time to spend on this soon once I push out
the current batch of Xen and crypto patches.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Andrey Savochkin @ 2006-06-27 9:38 UTC (permalink / raw)
To: Daniel Lezcano
Cc: linux-kernel, netdev, serue, haveblue, clg, Andrew Morton, dev,
herbert, devel, sam, ebiederm, viro, Alexey Kuznetsov
In-Reply-To: <44A0FBAC.7020107@fr.ibm.com>
On Tue, Jun 27, 2006 at 11:34:36AM +0200, Daniel Lezcano wrote:
> Andrey Savochkin wrote:
> > Daniel,
> >
> > On Mon, Jun 26, 2006 at 05:49:41PM +0200, Daniel Lezcano wrote:
> >
> >>>Then you lose the ability for each namespace to have its own routing entries.
> >>>Which implies that you'll have difficulties with devices that should exist
> >>>and be visible in one namespace only (like tunnels), as they require IP
> >>>addresses and route.
> >>
> >>I mean instead of having the route tables private to the namespace, the
> >>routes have the information to which namespace they are associated.
> >
> >
> > I think I understand what you're talking about: you want to make routing
> > responsible for determining destination namespace ID in addition to route
> > type (local, unicast etc), nexthop information, and so on. Right?
>
> Yes.
>
> >
> > My point is that if you make namespace tagging at routing time, and
> > your packets are being routed only once, you lose the ability
> > to have separate routing tables in each namespace.
>
> Right. What is the advantage of having separate the routing tables ?
Routing is everything.
For example, I want namespaces to have their private tunnel devices.
It means that namespaces should be allowed have private routes of local type,
private default routes, and so on...
Andrey
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Kirill Korotaev @ 2006-06-27 9:54 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Andrey Savochkin, linux-kernel, netdev, serue, haveblue, clg,
Andrew Morton, herbert, devel, sam, ebiederm, viro,
Alexey Kuznetsov
In-Reply-To: <44A0FBAC.7020107@fr.ibm.com>
>> My point is that if you make namespace tagging at routing time, and
>> your packets are being routed only once, you lose the ability
>> to have separate routing tables in each namespace.
>
>
> Right. What is the advantage of having separate the routing tables ?
it is impossible to have bridged networking, tun/tap and many other
features without it. I even doubt that it is possible to introduce
private netfilter rules w/o virtualization of routing.
The question is do we want to have fully featured namespaces which allow
to create isolated virtual environments with semantics and behaviour of
standalone linux box or do we want to introduce some hacks with new
rules/restrictions to meet ones goals only?
From my POV, fully virtualized namespaces are the future. It is what
makes virtualization solution usable (w/o apps modifications), provides
all the features and doesn't require much efforts from people to be used.
Thanks,
Kirill
^ permalink raw reply
* Re: [PATCH 2/3] [VLAN]: Update iif when receiving via VLAN device
From: Thomas Graf @ 2006-06-27 10:03 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David Miller, netdev
In-Reply-To: <44A05FE0.7070203@trash.net>
* Patrick McHardy <kaber@trash.net> 2006-06-27 00:29
> Doesn't sound too silly (actually quite nifty in my opinion),
> but I'm not sure I understand correctly, binding to ifb doesn't
> work since it changes both skb->dev and skb->input_dev.
I don't understand this concern. So far the mirred action
updates iif but that can be made configurable.
* Patrick McHardy <kaber@trash.net> 2006-06-27 00:49
> Small clarification: with queueing at ingress I mean queueing after
> the bottleneck. It might work if you introduce a virtual bottleneck,
> but in that case in my experience the bandwidth limit you have to use
> is dependant on the number of TCP flows, so usually you can't specify
> a limit that will always work, and its wasteful if there is a smaller
> number of TCP flows. The reason why you would do it, limiting or
> prioritizing incoming traffic on the _real_ bottleneck, is not
> achievable of course. Also noteworthy is that policers don't behave
> any better, and any other schemes I've tried (I also experienced a
> lot of with TCP rate control) have similar or related problems.
My interest in ingress queueing is mainly on a local delivery
case where skb->tstamp can be modified to control tcp metrics.
I agree that a lot of wrong expectations have developed with
IMQ and similiar devices.
^ permalink raw reply
* Re: [PATCH Round 2 0/2][RFC] Network Event Notifier Mechanism
From: David Miller @ 2006-06-27 10:09 UTC (permalink / raw)
To: swise; +Cc: netdev
In-Reply-To: <20060626203638.19083.71231.stgit@stevo-desktop>
From: Steve Wise <swise@opengridcomputing.com>
Date: Mon, 26 Jun 2006 15:36:38 -0500
> Round 2 Changes:
>
> - cleaned up event structures per review feedback.
> - began integration with netlink (see neighbour changes in patch 2).
> - added IPv6 support.
Yes, ipv6 support is the main think I saw lacking.
Especially the neighbour stuff.
How will you interpret the neighbour object properly, by
looking at neigh->ops->family?
> Questions:
>
> - this patch is enabling some of the functionality that was under
> CONFIG_ARPD. Should I remove the CONFIG_ARPD stuff, leave it as-is
> or what?
I think how you changed it is fine.
> - what about support for other afs? Should I hook AF_DECnet? IPX? Or is
> AF_INET and AF_INET6 sufficient?
Probably this should be done on an as-needed basis.
> - I added a new RTM type in rtnetlink.h for neighbour change netlink
> messages. I suspect I did it wrong...
The low 3-bits of rtnetlink commands indicate the "kind".
So you have to be careful. See rtnetlink_rcv_msg() for details.
You also have to update the tables in net/core/rtnetlink.c when
you add new values. In particular rt_min[].
^ permalink raw reply
* Re: -git: Why is drivers/net/wan/hdlc_generic.c:hdlc_setup() exported?
From: David Boggs @ 2006-06-27 11:09 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Krzysztof Halasa, netdev
In March I posted a request for comments on a rewrite of
the LMC wan driver (see ftp.isc.org/pub/other/lmc).
I designed the LMC wan cards.
The new driver works with Linux, FreeBSD, NetBSD, OpenBSD
and BSD/OS. FreeBSD and NetBSD have adopted it; OpenBSD is
still thinking about it (their principal comments mirrored
the Linux comments: remove the code for other OSs and adopt
their kernel coding style). Before I resubmit the new driver
for more Linux comments I will do this. BTW: FreeBSD and
NetBSD did not insist on this -- an interesting policy
contrast. Nobody objected to the code for other OSs and
only one person cleared his throat about coding style.
Anyway, the new driver deals with FIVE line protocol stacks:
Generic-HDLC and SyncPPP (Linux), SPPP (FreeBSD, NetBSD, OpenBSD)
Netgraph (FreeBSD), and P2P (BSD/OS). Linux's SyncPPP stack is
a renamed version of SPPP, with different interfaces to drivers
and the kernel. SyncPPP implements PPP and Cisco-HDLC.
Generic-HDLC uses the PPP part but implements its own version
of Cisco-HDLC.
The Linux version of my driver, can be configured to use
Generic-HDLC or SyncPPP, or both with the choice made at
run-time. Configuring only SyncPPP avoids loading the
Generic-HDLC module if all you need is PPP or Cisco-HDLC.
The driver can switch from one line protocol stack to another
at run time. This requires detaching from the current stack
and attaching to another. There is a way to detach Generic-HDLC
but there is no way to reattach it because the initialization
code is called from within alloc_hdlcdev() and is not exported.
I have been working around this by duplicating the code in
hdlc_setup() in my driver. This is ugly and requires that
the driver know "private" things about Generic-HDLC. While
studying Generic-HDLC, I noticed that register_hdlc_device() had
some redundant code which had been subsumed by register_netdev().
I pointed this out to Krzysztof Halasa, the maintainer of
Generic-HDLC, and at the same time I asked him to export
hdlc_setup() so that I could remove the duplicate code in
my driver, which he graciously did recently.
I've subscribed to the netdev list since March and I've
read the archives back a year or two. Whenever I see
something relevant to my new driver, I change it to conform.
Right now I'm busy booting Linux on a PPC inside a Xilinx chip
so I haven't done the final testing and documentation updates
necessary before resubmitting the driver to Linux, but I
promise I will do so Real Soon Now -- before mid-August.
/David Boggs
^ permalink raw reply
* Re: [RFC][patch 1/4] Network namespaces: cleanup of dev_base list use
From: Eric W. Biederman @ 2006-06-27 11:13 UTC (permalink / raw)
To: Kirill Korotaev
Cc: Andrey Savochkin, dlezcano, linux-kernel, netdev, serue, haveblue,
clg, Andrew Morton, herbert, devel, sam, viro
In-Reply-To: <44A0D755.5090204@sw.ru>
Kirill Korotaev <dev@sw.ru> writes:
>>>Cleanup of dev_base list use, with the aim to make device list per-namespace.
>>>In almost every occasion, use of dev_base variable and dev->next pointer
>>>could be easily replaced by for_each_netdev loop.
>>>A few most complicated places were converted to using
>>>first_netdev()/next_netdev().
>> As a proof of concept patch this is ok.
>> As a real world patch this is much too big, which prevents review.
>> Plus it takes a few actions that are more than replace just
>> iterators through the device list.
> Mmm, actually it is a whole changeset and should go as a one patch. I didn't
> find it to be big and my review took only 5-10mins..
> I also don't think that mailing each driver maintainer is a good idea.
> Only if we want to make some buzz :)
Thanks for supporting my case. You reviewed it and missed the obvious typo.
I do agree that a patchset doing it all should happen at once.
As for not mailing the maintainers of the code we are changing. That
would just be irresponsible.
Eric
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Daniel Lezcano @ 2006-06-27 11:21 UTC (permalink / raw)
To: Andrey Savochkin
Cc: linux-kernel, netdev, serue, haveblue, clg, Andrew Morton, dev,
herbert, devel, sam, ebiederm, viro, Alexey Kuznetsov
In-Reply-To: <20060627133849.E13959@castle.nmd.msu.ru>
>>>My point is that if you make namespace tagging at routing time, and
>>>your packets are being routed only once, you lose the ability
>>>to have separate routing tables in each namespace.
>>
>>Right. What is the advantage of having separate the routing tables ?
>
>
> Routing is everything.
> For example, I want namespaces to have their private tunnel devices.
> It means that namespaces should be allowed have private routes of local type,
> private default routes, and so on...
>
Ok, we are talking about the same things. We do it only in a different way:
* separate routing table :
namespace
|
\--- route_tables
|
\---routes
* tagged routing table :
route_tables
|
\---routes
|
\---namespace
When using routes private to the namespace, globally the logic of the ip
stack is not changed, it manipulates only differents variables. It is
more clean than tagging the route for the reasons mentioned by Eric.
When using route tagging, the logic is changed because when doing lookup
on the routes table which is global, the namespace is used to match the
route and make it visible.
I use the second method, because I think it is more effecient and reduce
the overhead. But the isolation is minimalist and only aims to avoid the
application using ressources outside of the container (aka namespace)
without taking care of the system. For example, I didn't take care of
network devices, because as far as see I can't imagine an administrator
wanting to change the network device name while there are hundred of
containers running. Concerning tunnel devices for example, they should
be created inside the container.
I think, private network ressources method is more elegant and involves
more network ressources, but there is probably a significant overhead
and some difficulties to have __lightweight__ container (aka application
container), make nfs working well, etc... I did some tests with tbench
and the loopback with the private namespace and there is roughly an
overhead of 4 % without the isolation since with the tagging method
there is 1 % with the isolation.
The network namespace aims the isolation for now, but the container
based on the namespaces will probably need checkpoint/restart and
migration ability. The migration is needed not only for servers but for
HPC jobs too.
So I don't know what level of isolation/virtualization is really needed
by users, what should be acceptable (strong isolation and overhead /
weak isolation and efficiency). I don't know if people wanting strong
isolation will not prefer Xen (cleary with much more overhead than your
patches ;) )
Regards
-- Daniel
^ permalink raw reply
* Re: [patch 2/3] drivers/net/ns83820.c: add paramter to disable autonegotiation
From: Dan Faerch @ 2006-06-27 11:43 UTC (permalink / raw)
To: Benjamin LaHaise; +Cc: akpm, jeff, netdev, dan, jgarzik
In-Reply-To: <20060626162928.GA22614@kvack.org>
On Mon, 2006-06-26 at 12:29 -0400, Benjamin LaHaise wrote:
> This part is good, although doing something for copper cards needs doing,
> which probably means poking around to support the phy properly.
I Agree. But i dont have a copper card, nor the knowledge to do this. I
was actually hoping that someone could "fill in the blanks".
> > Also added a "disable_autoneg" module argument to completely disable
> > autoneg on all cards using this driver.
>
> This is the part I disagree with. Are you sure it isn't a bug in the
> link autonegotiation state machine for fibre cards? It should be defaulting
> to 1Gbit/full duplex if no autonegotiation is happening, and if it isn't
> then that should be fixed instead of papering over things with a config
> option.
In my setup, we use several fibercards on passive fiber-taps (tx only),
thus there is no link partner. If i dont disable autoneg, i simply cant
sniff traffic.
Skipping the initial autoneg solved the problem. Adding ethtool support
was just an extra courtesy upon request.
After adding ethtool support, i kept the disable_autoneg option to allow
one to operate with default autoneg disabled, and enabling autoneg
through ethtool where needed. Sort of a "reverse operation" mode.
If there IS a bug in the autoneg statemachine i would have no idea how
to fix it. My knowledge of hardware & drivers is unfortunately extremely
limited.
- Dan
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox