* [RESEND PATCH] virtio-net: init link state correctly
From: Jason Wang @ 2010-11-05 9:47 UTC (permalink / raw)
To: netdev, rusty, linux-kernel, davem; +Cc: markmc, kvm, mst
For device that supports VIRTIO_NET_F_STATUS, there's no need to
assume the link is up and we need to call nerif_carrier_off() before
querying device status, otherwise we may get wrong operstate after
diver was loaded because the link watch event was not fired as
expected.
For device that does not support VIRITO_NET_F_STATUS, we could not get
its status through virtnet_update_status() and what we can only do is
always assuming the link is up.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/virtio_net.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index bb6b67f..b6d4028 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -986,9 +986,15 @@ static int virtnet_probe(struct virtio_device *vdev)
goto unregister;
}
- vi->status = VIRTIO_NET_S_LINK_UP;
- virtnet_update_status(vi);
- netif_carrier_on(dev);
+ /* Assume link up if device can't report link status,
+ otherwise get link status from config. */
+ if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
+ netif_carrier_off(dev);
+ virtnet_update_status(vi);
+ } else {
+ vi->status = VIRTIO_NET_S_LINK_UP;
+ netif_carrier_on(dev);
+ }
pr_debug("virtnet: registered device %s\n", dev->name);
return 0;
^ permalink raw reply related
* [PATCH] via-rhine: hardware VLAN support
From: Roger Luethi @ 2010-11-05 10:43 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller
This patch adds VLAN hardware support for Rhine chips.
The driver uses up to 3 additional bytes of buffer space when extracting
802.1Q headers; PKT_BUF_SZ should still be sufficient.
The initial code was provided by David Lv. I reworked it to use standard
kernel facilities. Coding style clean up mostly follows via-velocity.
Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Signed-off-by: Roger Luethi <rl@hellgate.ch>
drivers/net/via-rhine.c | 351 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 337 insertions(+), 14 deletions(-)
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 4930f9d..67afc48 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -30,8 +30,8 @@
*/
#define DRV_NAME "via-rhine"
-#define DRV_VERSION "1.4.3"
-#define DRV_RELDATE "2007-03-06"
+#define DRV_VERSION "1.5.0"
+#define DRV_RELDATE "2010-10-09"
/* A few user-configurable values.
@@ -100,6 +100,7 @@ static const int multicast_filter_limit = 32;
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/crc32.h>
+#include <linux/if_vlan.h>
#include <linux/bitops.h>
#include <linux/workqueue.h>
#include <asm/processor.h> /* Processor type for cache alignment. */
@@ -133,6 +134,9 @@ MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)");
MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)");
+#define MCAM_SIZE 32
+#define VCAM_SIZE 32
+
/*
Theory of Operation
@@ -279,15 +283,16 @@ MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
/* Offsets to the device registers. */
enum register_offsets {
StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08,
- ChipCmd1=0x09,
+ ChipCmd1=0x09, TQWake=0x0A,
IntrStatus=0x0C, IntrEnable=0x0E,
MulticastFilter0=0x10, MulticastFilter1=0x14,
RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54,
- MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E,
+ MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E, PCIBusConfig1=0x6F,
MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74,
ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B,
RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81,
StickyHW=0x83, IntrStatus2=0x84,
+ CamMask=0x88, CamCon=0x92, CamAddr=0x93,
WOLcrSet=0xA0, PwcfgSet=0xA1, WOLcgSet=0xA3, WOLcrClr=0xA4,
WOLcrClr1=0xA6, WOLcgClr=0xA7,
PwrcsrSet=0xA8, PwrcsrSet1=0xA9, PwrcsrClr=0xAC, PwrcsrClr1=0xAD,
@@ -299,6 +304,40 @@ enum backoff_bits {
BackCaptureEffect=0x04, BackRandom=0x08
};
+/* Bits in the TxConfig (TCR) register */
+enum tcr_bits {
+ TCR_PQEN=0x01,
+ TCR_LB0=0x02, /* loopback[0] */
+ TCR_LB1=0x04, /* loopback[1] */
+ TCR_OFSET=0x08,
+ TCR_RTGOPT=0x10,
+ TCR_RTFT0=0x20,
+ TCR_RTFT1=0x40,
+ TCR_RTSF=0x80,
+};
+
+/* Bits in the CamCon (CAMC) register */
+enum camcon_bits {
+ CAMC_CAMEN=0x01,
+ CAMC_VCAMSL=0x02,
+ CAMC_CAMWR=0x04,
+ CAMC_CAMRD=0x08,
+};
+
+/* Bits in the PCIBusConfig1 (BCR1) register */
+enum bcr1_bits {
+ BCR1_POT0=0x01,
+ BCR1_POT1=0x02,
+ BCR1_POT2=0x04,
+ BCR1_CTFT0=0x08,
+ BCR1_CTFT1=0x10,
+ BCR1_CTSF=0x20,
+ BCR1_TXQNOBK=0x40, /* for VT6105 */
+ BCR1_VIDFR=0x80, /* for VT6105 */
+ BCR1_MED0=0x40, /* for VT6102 */
+ BCR1_MED1=0x80, /* for VT6102 */
+};
+
#ifdef USE_MMIO
/* Registers we check that mmio and reg are the same. */
static const int mmio_verify_registers[] = {
@@ -356,6 +395,11 @@ enum desc_status_bits {
DescOwn=0x80000000
};
+/* Bits in *_desc.*_length */
+enum desc_length_bits {
+ DescTag=0x00010000
+};
+
/* Bits in ChipCmd. */
enum chip_cmd_bits {
CmdInit=0x01, CmdStart=0x02, CmdStop=0x04, CmdRxOn=0x08,
@@ -365,6 +409,7 @@ enum chip_cmd_bits {
};
struct rhine_private {
+ struct vlan_group *vlgrp;
/* Descriptor rings */
struct rx_desc *rx_ring;
struct tx_desc *tx_ring;
@@ -391,6 +436,9 @@ struct rhine_private {
spinlock_t lock;
struct work_struct reset_task;
+ u32 mCAMmask; /* 32 CAMs each (6105M and better) */
+ u32 vCAMmask;
+
/* Frequently used values: keep some adjacent for cache effect. */
u32 quirks;
struct rx_desc *rx_head_desc;
@@ -405,6 +453,22 @@ struct rhine_private {
void __iomem *base;
};
+#define BYTE_REG_BITS_ON(x, p) do { iowrite8((ioread8((p))|(x)), (p)); } while (0)
+#define WORD_REG_BITS_ON(x, p) do { iowrite16((ioread16((p))|(x)), (p)); } while (0)
+#define DWORD_REG_BITS_ON(x, p) do { iowrite32((ioread32((p))|(x)), (p)); } while (0)
+
+#define BYTE_REG_BITS_IS_ON(x, p) (ioread8((p)) & (x))
+#define WORD_REG_BITS_IS_ON(x, p) (ioread16((p)) & (x))
+#define DWORD_REG_BITS_IS_ON(x, p) (ioread32((p)) & (x))
+
+#define BYTE_REG_BITS_OFF(x, p) do { iowrite8(ioread8((p)) & (~(x)), (p)); } while (0)
+#define WORD_REG_BITS_OFF(x, p) do { iowrite16(ioread16((p)) & (~(x)), (p)); } while (0)
+#define DWORD_REG_BITS_OFF(x, p) do { iowrite32(ioread32((p)) & (~(x)), (p)); } while (0)
+
+#define BYTE_REG_BITS_SET(x, m, p) do { iowrite8((ioread8((p)) & (~(m)))|(x), (p)); } while (0)
+#define WORD_REG_BITS_SET(x, m, p) do { iowrite16((ioread16((p)) & (~(m)))|(x), (p)); } while (0)
+#define DWORD_REG_BITS_SET(x, m, p) do { iowrite32((ioread32((p)) & (~(m)))|(x), (p)); } while (0)
+
static int mdio_read(struct net_device *dev, int phy_id, int location);
static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
static int rhine_open(struct net_device *dev);
@@ -422,6 +486,15 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static const struct ethtool_ops netdev_ethtool_ops;
static int rhine_close(struct net_device *dev);
static void rhine_shutdown (struct pci_dev *pdev);
+static void rhine_vlan_rx_register(struct net_device *dev, struct vlan_group *grp);
+static void rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid);
+static void rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid);
+static void rhine_set_cam(void __iomem *ioaddr, int idx, u8 *addr);
+static void rhine_set_vlan_cam(void __iomem *ioaddr, int idx, u8 *addr);
+static void rhine_set_cam_mask(void __iomem *ioaddr, u32 mask);
+static void rhine_set_vlan_cam_mask(void __iomem *ioaddr, u32 mask);
+static void rhine_init_cam_filter(struct net_device *dev);
+static void rhine_update_vcam(struct rhine_private *rp);
#define RHINE_WAIT_FOR(condition) do { \
int i=1024; \
@@ -629,6 +702,9 @@ static const struct net_device_ops rhine_netdev_ops = {
.ndo_set_mac_address = eth_mac_addr,
.ndo_do_ioctl = netdev_ioctl,
.ndo_tx_timeout = rhine_tx_timeout,
+ .ndo_vlan_rx_add_vid = rhine_vlan_rx_add_vid,
+ .ndo_vlan_rx_kill_vid = rhine_vlan_rx_kill_vid,
+ .ndo_vlan_rx_register = rhine_vlan_rx_register,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = rhine_poll,
#endif
@@ -795,6 +871,10 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
if (rp->quirks & rqRhineI)
dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
+ if (pdev->revision >= VT6105M)
+ dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
+ NETIF_F_HW_VLAN_FILTER;
+
/* dev->name not defined before register_netdev()! */
rc = register_netdev(dev);
if (rc)
@@ -1040,6 +1120,190 @@ static void rhine_set_carrier(struct mii_if_info *mii)
netif_carrier_ok(mii->dev));
}
+/**
+ * rhine_set_cam - set CAM multicast filters
+ * @ioaddr: register block of this Rhine
+ * @idx: multicast CAM index [0..MCAM_SIZE-1]
+ * @addr: multicast address (6 bytes)
+ *
+ * Load addresses into multicast filters.
+ */
+static void rhine_set_cam(void __iomem *ioaddr, int idx, u8 *addr)
+{
+ int i;
+
+ iowrite8(CAMC_CAMEN, ioaddr + CamCon);
+ wmb();
+
+ /* Paranoid -- idx out of range should never happen */
+ idx &= (MCAM_SIZE - 1);
+
+ iowrite8((u8) idx, ioaddr + CamAddr);
+
+ for (i = 0; i < 6; i++, addr++)
+ iowrite8(*addr, ioaddr + MulticastFilter0 + i);
+ udelay(10);
+ wmb();
+
+ iowrite8(CAMC_CAMWR | CAMC_CAMEN, ioaddr + CamCon);
+ udelay(10);
+
+ iowrite8(0, ioaddr + CamCon);
+}
+
+/**
+ * rhine_set_vlan_cam - set CAM VLAN filters
+ * @ioaddr: register block of this Rhine
+ * @idx: VLAN CAM index [0..VCAM_SIZE-1]
+ * @addr: VLAN ID (2 bytes)
+ *
+ * Load addresses into VLAN filters.
+ */
+static void rhine_set_vlan_cam(void __iomem *ioaddr, int idx, u8 *addr)
+{
+ iowrite8(CAMC_CAMEN | CAMC_VCAMSL, ioaddr + CamCon);
+ wmb();
+
+ /* Paranoid -- idx out of range should never happen */
+ idx &= (VCAM_SIZE - 1);
+
+ iowrite8((u8) idx, ioaddr + CamAddr);
+
+ iowrite16(*((u16 *) addr), ioaddr + MulticastFilter0 + 6);
+ udelay(10);
+ wmb();
+
+ iowrite8(CAMC_CAMWR | CAMC_CAMEN, ioaddr + CamCon);
+ udelay(10);
+
+ iowrite8(0, ioaddr + CamCon);
+}
+
+/**
+ * rhine_set_cam_mask - set multicast CAM mask
+ * @ioaddr: register block of this Rhine
+ * @mask: multicast CAM mask
+ *
+ * Mask sets multicast filters active/inactive.
+ */
+static void rhine_set_cam_mask(void __iomem *ioaddr, u32 mask)
+{
+ iowrite8(CAMC_CAMEN, ioaddr + CamCon);
+ wmb();
+
+ /* write mask */
+ iowrite32(mask, ioaddr + CamMask);
+
+ /* disable CAMEN */
+ iowrite8(0, ioaddr + CamCon);
+}
+
+/**
+ * rhine_set_vlan_cam_mask - set VLAN CAM mask
+ * @ioaddr: register block of this Rhine
+ * @mask: VLAN CAM mask
+ *
+ * Mask sets VLAN filters active/inactive.
+ */
+static void rhine_set_vlan_cam_mask(void __iomem *ioaddr, u32 mask)
+{
+ iowrite8(CAMC_CAMEN | CAMC_VCAMSL, ioaddr + CamCon);
+ wmb();
+
+ /* write mask */
+ iowrite32(mask, ioaddr + CamMask);
+
+ /* disable CAMEN */
+ iowrite8(0, ioaddr + CamCon);
+}
+
+/**
+ * rhine_init_cam_filter - initialize CAM filters
+ * @dev: network device
+ *
+ * Initialize (disable) hardware VLAN and multicast support on this
+ * Rhine.
+ */
+static void rhine_init_cam_filter(struct net_device *dev)
+{
+ struct rhine_private *rp = netdev_priv(dev);
+ void __iomem *ioaddr = rp->base;
+
+ /* Disable all CAMs */
+ rp->vCAMmask = 0;
+ rp->mCAMmask = 0;
+ rhine_set_vlan_cam_mask(ioaddr, rp->vCAMmask);
+ rhine_set_cam_mask(ioaddr, rp->mCAMmask);
+
+ /* disable hardware VLAN support */
+ BYTE_REG_BITS_OFF(TCR_PQEN, ioaddr + TxConfig);
+ BYTE_REG_BITS_OFF(BCR1_VIDFR, ioaddr + PCIBusConfig1);
+}
+
+/**
+ * rhine_update_vcam - update VLAN CAM filters
+ * @rp: rhine_private data of this Rhine
+ *
+ * Update VLAN CAM filters to match configuration change.
+ */
+static void rhine_update_vcam(struct rhine_private *rp)
+{
+ void __iomem *ioaddr = rp->base;
+
+ rp->mCAMmask = 0;
+
+ if (rp->vlgrp) {
+ unsigned int vid, i = 0;
+
+ for (vid = 1; (vid < VLAN_VID_MASK); vid++) {
+ if (vlan_group_get_device(rp->vlgrp, vid)) {
+ rhine_set_vlan_cam(ioaddr, i, (u8 *)&vid);
+ rp->vCAMmask |= 1 << i;
+ if (++i >= VCAM_SIZE)
+ break;
+ }
+ }
+ rhine_set_vlan_cam_mask(ioaddr, rp->vCAMmask);
+ }
+}
+
+static void rhine_vlan_rx_register(struct net_device *dev,
+ struct vlan_group *grp)
+{
+ struct rhine_private *rp = netdev_priv(dev);
+ void __iomem *ioaddr = rp->base;
+
+ rp->vlgrp = grp;
+ if (grp) {
+ BYTE_REG_BITS_ON(TCR_PQEN, ioaddr + TxConfig);
+ /* enable VLAN receive filtering */
+ if (!(dev->flags & IFF_PROMISC))
+ BYTE_REG_BITS_ON(BCR1_VIDFR, ioaddr + PCIBusConfig1);
+ } else {
+ BYTE_REG_BITS_OFF(TCR_PQEN, ioaddr + TxConfig);
+ BYTE_REG_BITS_OFF(BCR1_VIDFR, ioaddr + PCIBusConfig1);
+ }
+}
+
+static void rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
+{
+ struct rhine_private *rp = netdev_priv(dev);
+
+ spin_lock_irq(&rp->lock);
+ rhine_update_vcam(rp);
+ spin_unlock_irq(&rp->lock);
+}
+
+static void rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
+{
+ struct rhine_private *rp = netdev_priv(dev);
+
+ spin_lock_irq(&rp->lock);
+ vlan_group_set_device(rp->vlgrp, vid, NULL);
+ rhine_update_vcam(rp);
+ spin_unlock_irq(&rp->lock);
+}
+
static void init_registers(struct net_device *dev)
{
struct rhine_private *rp = netdev_priv(dev);
@@ -1061,6 +1325,9 @@ static void init_registers(struct net_device *dev)
rhine_set_rx_mode(dev);
+ if (rp->pdev->revision >= VT6105M)
+ rhine_init_cam_filter(dev);
+
napi_enable(&rp->napi);
/* Enable interrupts by setting the interrupt mask. */
@@ -1276,16 +1543,28 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb,
rp->tx_ring[entry].desc_length =
cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
+ if (unlikely(rp->vlgrp && vlan_tx_tag_present(skb))) {
+ rp->tx_ring[entry].tx_status = cpu_to_le32((vlan_tx_tag_get(skb)) << 16);
+ /* request tagging */
+ rp->tx_ring[entry].desc_length |= cpu_to_le32(0x020000);
+ }
+ else
+ rp->tx_ring[entry].tx_status = 0;
+
/* lock eth irq */
spin_lock_irqsave(&rp->lock, flags);
wmb();
- rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
+ rp->tx_ring[entry].tx_status |= cpu_to_le32(DescOwn);
wmb();
rp->cur_tx++;
/* Non-x86 Todo: explicitly flush cache lines here. */
+ if (rp->vlgrp && vlan_tx_tag_present(skb))
+ /* Tx queues are bits 7-0 (first Tx queue: bit 7) */
+ BYTE_REG_BITS_ON(1 << 7, ioaddr + TQWake);
+
/* Wake the potentially-idle transmit channel */
iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand,
ioaddr + ChipCmd1);
@@ -1437,6 +1716,21 @@ static void rhine_tx(struct net_device *dev)
spin_unlock(&rp->lock);
}
+/**
+ * rhine_get_vlan_tci - extract TCI from Rx data buffer
+ * @skb: pointer to sk_buff
+ * @data_size: used data area of the buffer including CRC
+ *
+ * If hardware VLAN tag extraction is enabled and the chip indicates a 802.1Q
+ * packet, the extracted 802.1Q header (2 bytes TPID + 2 bytes TCI) is 4-byte
+ * aligned following the CRC.
+ */
+static inline u16 rhine_get_vlan_tci(struct sk_buff *skb, int data_size)
+{
+ u8 *trailer = (u8 *)skb->data + ((data_size + 3) & ~3) + 2;
+ return ntohs(*(u16 *)trailer);
+}
+
/* Process up to limit frames from receive ring */
static int rhine_rx(struct net_device *dev, int limit)
{
@@ -1454,6 +1748,7 @@ static int rhine_rx(struct net_device *dev, int limit)
for (count = 0; count < limit; ++count) {
struct rx_desc *desc = rp->rx_head_desc;
u32 desc_status = le32_to_cpu(desc->rx_status);
+ u32 desc_length = le32_to_cpu(desc->desc_length);
int data_size = desc_status >> 16;
if (desc_status & DescOwn)
@@ -1498,6 +1793,7 @@ static int rhine_rx(struct net_device *dev, int limit)
struct sk_buff *skb = NULL;
/* Length should omit the CRC */
int pkt_len = data_size - 4;
+ u16 vlan_tci = 0;
/* Check if the packet is long enough to accept without
copying to a minimally-sized skbuff. */
@@ -1532,8 +1828,16 @@ static int rhine_rx(struct net_device *dev, int limit)
rp->rx_buf_sz,
PCI_DMA_FROMDEVICE);
}
+
+ if (unlikely(rp->vlgrp && (desc_length & DescTag)))
+ vlan_tci = rhine_get_vlan_tci(skb, data_size);
+
skb->protocol = eth_type_trans(skb, dev);
- netif_receive_skb(skb);
+
+ if (unlikely(rp->vlgrp && (desc_length & DescTag)))
+ vlan_hwaccel_receive_skb(skb, rp->vlgrp, vlan_tci);
+ else
+ netif_receive_skb(skb);
dev->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
}
@@ -1596,6 +1900,11 @@ static void rhine_restart_tx(struct net_device *dev) {
iowrite8(ioread8(ioaddr + ChipCmd) | CmdTxOn,
ioaddr + ChipCmd);
+
+ if (rp->tx_ring[entry].desc_length & cpu_to_le32(0x020000))
+ /* Tx queues are bits 7-0 (first Tx queue: bit 7) */
+ BYTE_REG_BITS_ON(1 << 7, ioaddr + TQWake);
+
iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand,
ioaddr + ChipCmd1);
IOSYNC;
@@ -1631,7 +1940,7 @@ static void rhine_error(struct net_device *dev, int intr_status)
}
if (intr_status & IntrTxUnderrun) {
if (rp->tx_thresh < 0xE0)
- iowrite8(rp->tx_thresh += 0x20, ioaddr + TxConfig);
+ BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig);
if (debug > 1)
printk(KERN_INFO "%s: Transmitter underrun, Tx "
"threshold now %2.2x.\n",
@@ -1646,7 +1955,7 @@ static void rhine_error(struct net_device *dev, int intr_status)
(intr_status & (IntrTxAborted |
IntrTxUnderrun | IntrTxDescRace)) == 0) {
if (rp->tx_thresh < 0xE0) {
- iowrite8(rp->tx_thresh += 0x20, ioaddr + TxConfig);
+ BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig);
}
if (debug > 1)
printk(KERN_INFO "%s: Unspecified error. Tx "
@@ -1688,7 +1997,8 @@ static void rhine_set_rx_mode(struct net_device *dev)
struct rhine_private *rp = netdev_priv(dev);
void __iomem *ioaddr = rp->base;
u32 mc_filter[2]; /* Multicast hash filter */
- u8 rx_mode; /* Note: 0x02=accept runt, 0x01=accept errs */
+ u8 rx_mode = 0x0C; /* Note: 0x02=accept runt, 0x01=accept errs */
+ struct netdev_hw_addr *ha;
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
rx_mode = 0x1C;
@@ -1699,10 +2009,17 @@ static void rhine_set_rx_mode(struct net_device *dev)
/* Too many to match, or accept all multicasts. */
iowrite32(0xffffffff, ioaddr + MulticastFilter0);
iowrite32(0xffffffff, ioaddr + MulticastFilter1);
- rx_mode = 0x0C;
+ } else if (rp->pdev->revision >= VT6105M) {
+ int i = 0;
+ netdev_for_each_mc_addr(ha, dev) {
+ if (i == MCAM_SIZE)
+ break;
+ rhine_set_cam(ioaddr, i, ha->addr);
+ rp->mCAMmask |= 1 << i;
+ i++;
+ }
+ rhine_set_cam_mask(ioaddr, rp->mCAMmask);
} else {
- struct netdev_hw_addr *ha;
-
memset(mc_filter, 0, sizeof(mc_filter));
netdev_for_each_mc_addr(ha, dev) {
int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
@@ -1711,9 +2028,15 @@ static void rhine_set_rx_mode(struct net_device *dev)
}
iowrite32(mc_filter[0], ioaddr + MulticastFilter0);
iowrite32(mc_filter[1], ioaddr + MulticastFilter1);
- rx_mode = 0x0C;
}
- iowrite8(rp->rx_thresh | rx_mode, ioaddr + RxConfig);
+ /* enable/disable VLAN receive filtering */
+ if (rp->pdev->revision >= VT6105M) {
+ if (dev->flags & IFF_PROMISC || !rp->vlgrp)
+ BYTE_REG_BITS_OFF(BCR1_VIDFR, ioaddr + PCIBusConfig1);
+ else
+ BYTE_REG_BITS_ON(BCR1_VIDFR, ioaddr + PCIBusConfig1);
+ }
+ BYTE_REG_BITS_ON(rx_mode, ioaddr + RxConfig);
}
static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
--
1.7.2.2
^ permalink raw reply related
* 2.6.36 vlans & bridge crash - status?
From: Nikola Ciprich @ 2010-11-05 10:35 UTC (permalink / raw)
To: netdev list; +Cc: nikola.ciprich
Hello,
I would like to ask if somebody is trying to solve
https://bugzilla.kernel.org/show_bug.cgi?id=20462
and if needed, could I provide some help, testing etc?
thanks a lot in advance!
with best regards
nik
--
-------------------------------------
Ing. Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava
tel.: +420 596 603 142
fax: +420 596 621 273
mobil: +420 777 093 799
www.linuxbox.cz
mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz
-------------------------------------
^ permalink raw reply
* [PATCH] xfrm: update flowi saddr in icmp_send if unset
From: Ulrich Weber @ 2010-11-05 11:39 UTC (permalink / raw)
To: davem; +Cc: netdev
otherwise xfrm_lookup will fail to find correct policy
Signed-off-by: Ulrich Weber <uweber@astaro.com>
---
net/ipv4/icmp.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 96bc7f9..e5d1a44 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -569,6 +569,9 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
/* No need to clone since we're just using its address. */
rt2 = rt;
+ if (!fl.nl_u.ip4_u.saddr)
+ fl.nl_u.ip4_u.saddr = rt->rt_src;
+
err = xfrm_lookup(net, (struct dst_entry **)&rt, &fl, NULL, 0);
switch (err) {
case 0:
--
1.7.1
^ permalink raw reply related
* [PATCH] ipv6: fix overlap check for fragments
From: Shan Wei @ 2010-11-05 11:56 UTC (permalink / raw)
To: nicolas.dichtel, David Miller; +Cc: netdev@vger.kernel.org, Patrick McHardy
The type of FRAG6_CB(prev)->offset is int, skb->len is *unsigned* int,
and offset is int.
Without this patch, type conversion occurred to this expression, when
(FRAG6_CB(prev)->offset + prev->len) is less than offset.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
net/ipv6/reassembly.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index c7ba314..0f27664 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -349,7 +349,7 @@ found:
/* Check for overlap with preceding fragment. */
if (prev &&
- (FRAG6_CB(prev)->offset + prev->len) - offset > 0)
+ (FRAG6_CB(prev)->offset + prev->len) > offset)
goto discard_fq;
/* Look for overlap with succeeding segment. */
--
1.6.3.3
^ permalink raw reply related
* [PATCH] netfilter: ipv6: fix overlap check for fragments
From: Shan Wei @ 2010-11-05 11:56 UTC (permalink / raw)
To: nicolas.dichtel, David Miller, netdev@vger.kernel.org,
netfilter-devel, Patrick McHardy
The type of FRAG6_CB(prev)->offset is int, skb->len is *unsigned* int,
and offset is int.
Without this patch, type conversion occurred to this expression, when
(FRAG6_CB(prev)->offset + prev->len) is less than offset.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
net/ipv6/netfilter/nf_conntrack_reasm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 3a3f129..79d43aa 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -286,7 +286,7 @@ found:
/* Check for overlap with preceding fragment. */
if (prev &&
- (NFCT_FRAG6_CB(prev)->offset + prev->len) - offset > 0)
+ (NFCT_FRAG6_CB(prev)->offset + prev->len) > offset)
goto discard_fq;
/* Look for overlap with succeeding segment. */
--
1.6.3.3
^ permalink raw reply related
* RE: [PATCH 23/49] drivers/net/igbvf: Use vzalloc
From: Rose, Gregory V @ 2010-11-05 11:58 UTC (permalink / raw)
To: Joe Perches, Jiri Kosina
Cc: Kirsher, Jeffrey T, Brandeburg, Jesse, Allan, Bruce W,
Wyborny, Carolyn, Skidmore, Donald C, Waskiewicz Jr, Peter P,
Duyck, Alexander H, Ronciak, John,
e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <9f8b974fadf646f9227bd1d5fe8e448081ec9b2b.1288925424.git.joe@perches.com>
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Thursday, November 04, 2010 8:08 PM
> To: Jiri Kosina
> Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Wyborny,
> Carolyn; Skidmore, Donald C; Rose, Gregory V; Waskiewicz Jr, Peter P;
> Duyck, Alexander H; Ronciak, John; e1000-devel@lists.sourceforge.net;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 23/49] drivers/net/igbvf: Use vzalloc
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/net/igbvf/netdev.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
> index 28af019..08e7459 100644
> --- a/drivers/net/igbvf/netdev.c
> +++ b/drivers/net/igbvf/netdev.c
> @@ -429,10 +429,9 @@ int igbvf_setup_tx_resources(struct igbvf_adapter
> *adapter,
> int size;
>
> size = sizeof(struct igbvf_buffer) * tx_ring->count;
> - tx_ring->buffer_info = vmalloc(size);
> + tx_ring->buffer_info = vzalloc(size);
> if (!tx_ring->buffer_info)
> goto err;
> - memset(tx_ring->buffer_info, 0, size);
>
> /* round up to nearest 4K */
> tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
> @@ -469,10 +468,9 @@ int igbvf_setup_rx_resources(struct igbvf_adapter
> *adapter,
> int size, desc_len;
>
> size = sizeof(struct igbvf_buffer) * rx_ring->count;
> - rx_ring->buffer_info = vmalloc(size);
> + rx_ring->buffer_info = vzalloc(size);
> if (!rx_ring->buffer_info)
> goto err;
> - memset(rx_ring->buffer_info, 0, size);
>
> desc_len = sizeof(union e1000_adv_rx_desc);
>
> --
> 1.7.3.1.g432b3.dirty
Acked By: Greg Rose <Gregory.v.rose@intel.com>
^ permalink raw reply
* Re: [PATCH 26/49] drivers/net/ixgbevf: Use vzalloc
From: Rose, Gregory V @ 2010-11-05 11:59 UTC (permalink / raw)
To: Joe Perches, Jiri Kosina
Cc: e1000-devel@lists.sourceforge.net, Allan, Bruce W,
Brandeburg, Jesse, linux-kernel@vger.kernel.org, Ronciak, John,
Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <79b773f5012cba15686c4048d48cbbef6a13b049.1288925425.git.joe@perches.com>
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Thursday, November 04, 2010 8:08 PM
> To: Jiri Kosina
> Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Wyborny,
> Carolyn; Skidmore, Donald C; Rose, Gregory V; Waskiewicz Jr, Peter P;
> Duyck, Alexander H; Ronciak, John; e1000-devel@lists.sourceforge.net;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 26/49] drivers/net/ixgbevf: Use vzalloc
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/net/ixgbevf/ixgbevf_main.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ixgbevf/ixgbevf_main.c
> b/drivers/net/ixgbevf/ixgbevf_main.c
> index dc03c96..6aeaf54 100644
> --- a/drivers/net/ixgbevf/ixgbevf_main.c
> +++ b/drivers/net/ixgbevf/ixgbevf_main.c
> @@ -2488,10 +2488,9 @@ int ixgbevf_setup_tx_resources(struct
> ixgbevf_adapter *adapter,
> int size;
>
> size = sizeof(struct ixgbevf_tx_buffer) * tx_ring->count;
> - tx_ring->tx_buffer_info = vmalloc(size);
> + tx_ring->tx_buffer_info = vzalloc(size);
> if (!tx_ring->tx_buffer_info)
> goto err;
> - memset(tx_ring->tx_buffer_info, 0, size);
>
> /* round up to nearest 4K */
> tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
> @@ -2555,14 +2554,13 @@ int ixgbevf_setup_rx_resources(struct
> ixgbevf_adapter *adapter,
> int size;
>
> size = sizeof(struct ixgbevf_rx_buffer) * rx_ring->count;
> - rx_ring->rx_buffer_info = vmalloc(size);
> + rx_ring->rx_buffer_info = vzalloc(size);
> if (!rx_ring->rx_buffer_info) {
> hw_dbg(&adapter->hw,
> "Unable to vmalloc buffer memory for "
> "the receive descriptor ring\n");
> goto alloc_failed;
> }
> - memset(rx_ring->rx_buffer_info, 0, size);
>
> /* Round up to nearest 4K */
> rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
> --
> 1.7.3.1.g432b3.dirty
Acked By: Greg Rose <Gregory.v.rose@intel.com>
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply
* Re: [PATCH 0/15] RFC: create drivers/net/legacy for ISA, EISA, MCA drivers
From: Paul Gortmaker @ 2010-11-05 12:51 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: Joe Perches, davem@davemloft.net, netdev@vger.kernel.org
In-Reply-To: <AANLkTim2yH7eAqqYQW+JVC5GtFR5mX4uZnMa02+yubFk@mail.gmail.com>
On 10-11-04 10:28 PM, Jeff Kirsher wrote:
> On Thu, Nov 4, 2010 at 14:20, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>> On 10-10-29 08:01 PM, Jeff Kirsher wrote:
>>> On Fri, 2010-10-29 at 15:08 -0700, Joe Perches wrote:
>>>> On Fri, 2010-10-29 at 17:26 -0400, Paul Gortmaker wrote:
>>>>> On 10-10-28 09:48 PM, Joe Perches wrote:
>>>>>> On Thu, 2010-10-28 at 21:19 -0400, Paul Gortmaker wrote:
>>>>>>> The drivers/net dir has a lot of files - originally there were
>>>>>>> no subdirs, but at least now subdirs are being used effectively.
>>>>>>> But the original drivers from 10+ years ago are still right
>>>>>>> there at the top. This series creates a drivers/net/legacy dir.
>>>>>> I like this idea.
>>>>>> I suggest a bit of a further grouping by using a
>>>>>> drivers/net/ethernet directory and putting those
>>>>>> legacy drivers in a new subdirectory
>>>>>> drivers/net/ethernet/legacy.
>>>>> That is a substantially larger change, since you'd now be
>>>>> relocating nearly every remaining driver, i.e. all the
>>>>> relatively modern 100M and GigE drivers.
>>>>
>>>
>>> I am not particularly a fan of making a "legacy" directory and moving
>>> old drivers into it. Just because this is very subjective, if you say
>>> "drivers which are X years old and not used much" is vague and depending
>>> on who you ask would get varying results. But if you were to were to
>>> define legacy as all ISA, EISA and MCA drivers (not based on their use)
>>> would be better.
>>
>> I think that being subjective can be an advantage. There may
>> be some debate on whether X is legacy or not, but I see no harm
>> in that. On the other hand, I see binding ourselves to concrete
>> inflexible rules as a disadvantage.
>>
>
> I am not disagreeing that we need to be flexible, and to organize the
> directory structure in a logical way does not equate to "concrete and
> inflexible".
>
> I brought the topic of organizing the /drivers/net directory up at
> NetConf/Plumbers and here is what came about the discussion...
Thanks for the update, I wasn't aware that happened.
>
> Joe and I are working to organize the drivers into
> /drivers/net/<technology> directories and to cleanup the Kconfig to
> reflect the organization. Ethernet drivers will be in
> /drivers/net/ethernet, and so on. I brought up your suggestion to
> making a "legacy" directory and those present did not like the idea.
Interesting. I would have not came to that conclusion based on
the feedback on netdev@vger alone. Oh well, if that was the
consensus then I'm not going to argue with it.
> In short, there is no advantage to this type of organization and
> having the drivers reside in their current location or in the model of
> /drivers/net/<technology> does not cause any problems
[...]
>>>>
>>>> There are arch specific directories under various drivers/...
>>>> so I don't see a need to move directories like drivers/net/arm
>>>> or drivers/s390.
>>>
>>> I agree with Joe.
>>
>> I don't think there is any disagreement here on this point.
>> Moving stuff that is already in an appropriate subdir was
>> never part of what I was proposing with drivers/legacy.
>>
>> But if we create subdirs with concrete definitions, then
>> people will most likely be expecting all drivers that match
>> to be in that specific subdir.
>
> Correct, although I would use "logical organization" versus "concrete
> definitions" and we are working on patches to do the clean up so that
> Ethernet drivers are under /drivers/net/ethernet/*, as well as the
If you do get agreement on subcategories under ethernet for one
reason or another (i.e. vendor grouping), then I'd suggest using
ns8390 as a grouping category - it would lend itself well to
coalescing a lot of legacy drivers in itself.
> other technologies. For the drivers like vlan, 8021q, bridging, etc
> we will place those in /drivers/net/sw/. That is the plan at least...
>
>>
>>>
>>>>
>>>>> With this, I tried to aim for a significant gain (close to 1/3
>>>>> less files) within what I felt was a reasonable sized change
>>>>> set that had a chance of getting an overall OK from folks.
>>>>> Giant "flag-day" type mammoth changesets are a PITA for all.
>>>>
>>>> I believe there's no need for a flag-day.
>>>> File renames could happen gradually or not at all.
>>>>
>>>>
>>>
>>> Again I agree with Joe.
>>
>> Sure, renames can be async, and driven by the individual
>> maintainers of the files, but typically when conversion
>> like events are left open ended (timewise) they tend
>> to drag on for longer times than necessary. At least in
>> my experience. If I had sent the RFC with one patch that
>> amounted to a "mkdir", and no actual file moves, I wouldn't
>> have expected much other than a bagful of scorn in return. :)
>> Putting it to use and showing a real cleanup is where the
>> value became really apparent, I think.
>>
>
> We are hoping not to drag this out and plan on getting this into
> 2.6.38 (net-next) within the couple of weeks.
Sounds good. In the end, the one thing I was hoping to see
happen was a bit more organization in drivers/net - and both
solutions should be able to provide this.
Paul.
>
>> In any case, I still think this is worthwhile, and in the
>> absence of an alternate proposal that gets a higher level
>> of universal agreement, I'm hoping we can still do this.
>> I've got a follow on commit ready that factors a lot of
>> the legacy related probe code out of Space.c too.
>>
>> Regardless of which way it goes, thanks for the feedback.
>> Paul.
>> --
>> 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
* ping -I eth1 ....
From: Joakim Tjernlund @ 2010-11-05 13:14 UTC (permalink / raw)
To: netdev
If I do busybox ping -I eth1 x.x.y.y i see
socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
getuid() = 0
setuid(0) = 0
setsockopt(3, SOL_SOCKET, SO_BINDTODEVICE, "eth1\0\0\0\0\0\0\0\0\0\0\0\0\20\0[l\0\0\0\2\20\7\354(\0"..., 32) = 0
setsockopt(3, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [7280], 4) = 0
......
then this in a loop:
--- SIGALRM (Alarm clock) @ 0 (0) ---
clock_gettime(CLOCK_MONOTONIC, {1238, 116470107}) = 0
sendto(3, "\10\0\203\345\1\326\0\2I\314(v\0\0\0\0\0\0\0\0\0\0\0\0"..., 64, 0, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("1.1.1.1")}, 16) = 64
rt_sigaction(SIGALRM, {0x10017034, [ALRM], SA_RESTART}, {0x10017034, [ALRM], SA_RESTART}, 8) = 0
alarm(1) = 0
sigreturn() = ? (mask now [ILL ABRT FPE KILL ALRM STKFLT CONT STOP TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR RTMIN])
recvfrom(3, 0xbfe6a620, 192, 0, 0xbfe6a6f0, 0xbfe6a70c) = ? ERESTARTSYS (To be restarted)
Then I do ifconfig eth1 down
and I still see the same. Should not
sendto and/or revcfrom return some error as
the interface is down?
kernel 2.6.35
Jocke
^ permalink raw reply
* Re: ping -I eth1 ....
From: Eric Dumazet @ 2010-11-05 13:36 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: netdev
In-Reply-To: <OF339BCA8A.B674D6AE-ONC12577D2.00481B5E-C12577D2.0048B214@transmode.se>
Le vendredi 05 novembre 2010 à 14:14 +0100, Joakim Tjernlund a écrit :
> If I do busybox ping -I eth1 x.x.y.y i see
> socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
> getuid() = 0
> setuid(0) = 0
> setsockopt(3, SOL_SOCKET, SO_BINDTODEVICE, "eth1\0\0\0\0\0\0\0\0\0\0\0\0\20\0[l\0\0\0\2\20\7\354(\0"..., 32) = 0
> setsockopt(3, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
> setsockopt(3, SOL_SOCKET, SO_RCVBUF, [7280], 4) = 0
>
> ......
> then this in a loop:
> --- SIGALRM (Alarm clock) @ 0 (0) ---
> clock_gettime(CLOCK_MONOTONIC, {1238, 116470107}) = 0
> sendto(3, "\10\0\203\345\1\326\0\2I\314(v\0\0\0\0\0\0\0\0\0\0\0\0"..., 64, 0, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("1.1.1.1")}, 16) = 64
> rt_sigaction(SIGALRM, {0x10017034, [ALRM], SA_RESTART}, {0x10017034, [ALRM], SA_RESTART}, 8) = 0
> alarm(1) = 0
> sigreturn() = ? (mask now [ILL ABRT FPE KILL ALRM STKFLT CONT STOP TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR RTMIN])
> recvfrom(3, 0xbfe6a620, 192, 0, 0xbfe6a6f0, 0xbfe6a70c) = ? ERESTARTSYS (To be restarted)
>
> Then I do ifconfig eth1 down
> and I still see the same. Should not
> sendto and/or revcfrom return some error as
> the interface is down?
Hmm, this reminds me one patch, yes...
Search for " ipv4: remove all rt cache entries on UNREGISTER event"
http://permalink.gmane.org/gmane.linux.network/173391
I guess I should respin it for net-next-2.6
^ permalink raw reply
* [RFC] ipvs: allow transmit of GRO aggregated skbs
From: Simon Horman @ 2010-11-05 13:52 UTC (permalink / raw)
To: lvs-devel, netdev; +Cc: Julian Anastasov
This is a first attempt at allowing LVS to transmit
skbs of greater than MTU length that have been aggregated by GRO.
I have lightly tested the ip_vs_dr_xmit() portion of this patch and
although it seems to work I am unsure that netif_needs_gso() is the correct
test to use.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
LRO is still an outstanding issue, but as its deprecated in favour
of GRO perhaps it doesn't need to be solved.
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index 93c15a1..93a782e 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -246,7 +246,8 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF))) {
+ if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF)) &&
+ !netif_needs_gso(rt->u.dst.dev, skb)) {
ip_rt_put(rt);
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
@@ -310,7 +311,7 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if (skb->len > mtu) {
+ if (skb->len > mtu && !netif_needs_gso(rt->u.dst.dev, skb)) {
dst_release(&rt->u.dst);
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
@@ -377,7 +378,8 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF))) {
+ if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF)) &&
+ !netif_needs_gso(rt->u.dst.dev, skb)) {
ip_rt_put(rt);
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
IP_VS_DBG_RL_PKT(0, pp, skb, 0, "ip_vs_nat_xmit(): frag needed for");
@@ -453,7 +455,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if (skb->len > mtu) {
+ if (skb->len > mtu && !netif_needs_gso(rt->u.dst.dev, skb)) {
dst_release(&rt->u.dst);
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
IP_VS_DBG_RL_PKT(0, pp, skb, 0,
@@ -562,8 +564,9 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
df |= (old_iph->frag_off & htons(IP_DF));
- if ((old_iph->frag_off & htons(IP_DF))
- && mtu < ntohs(old_iph->tot_len)) {
+ if ((old_iph->frag_off & htons(IP_DF) &&
+ mtu < ntohs(old_iph->tot_len) &&
+ !netif_needs_gso(rt->u.dst.dev, skb))) {
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
ip_rt_put(rt);
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
@@ -672,7 +675,8 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
if (skb_dst(skb))
skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu);
- if (mtu < ntohs(old_iph->payload_len) + sizeof(struct ipv6hdr)) {
+ if (mtu < ntohs(old_iph->payload_len) + sizeof(struct ipv6hdr) &&
+ !netif_needs_gso(rt->u.dst.dev, skb)) {
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
dst_release(&rt->u.dst);
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
@@ -761,7 +765,8 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if ((iph->frag_off & htons(IP_DF)) && skb->len > mtu) {
+ if ((iph->frag_off & htons(IP_DF)) && skb->len > mtu &&
+ !netif_needs_gso(rt->u.dst.dev, skb)) {
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
ip_rt_put(rt);
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
@@ -889,7 +894,8 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if ((skb->len > mtu) && (ip_hdr(skb)->frag_off & htons(IP_DF))) {
+ if ((skb->len > mtu) && (ip_hdr(skb)->frag_off & htons(IP_DF)) &&
+ !netif_needs_gso(rt->u.dst.dev, skb)) {
ip_rt_put(rt);
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
@@ -964,7 +970,7 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
/* MTU checking */
mtu = dst_mtu(&rt->u.dst);
- if (skb->len > mtu) {
+ if (skb->len > mtu && !netif_needs_gso(rt->u.dst.dev, skb)) {
dst_release(&rt->u.dst);
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
IP_VS_DBG_RL("%s(): frag needed\n", __func__);
^ permalink raw reply related
* Re: ping -I eth1 ....
From: Joakim Tjernlund @ 2010-11-05 14:01 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1288964206.2882.402.camel@edumazet-laptop>
Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/11/05 14:36:46:
>
> Le vendredi 05 novembre 2010 à 14:14 +0100, Joakim Tjernlund a écrit :
> > If I do busybox ping -I eth1 x.x.y.y i see
> > socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
> > getuid() = 0
> > setuid(0) = 0
> > setsockopt(3, SOL_SOCKET, SO_BINDTODEVICE, "eth1\0\0\0\0\0\0\0\0\0\0\0\0\20\0[l\0\0\0\2\20\7\354(\0"..., 32) = 0
> > setsockopt(3, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
> > setsockopt(3, SOL_SOCKET, SO_RCVBUF, [7280], 4) = 0
> >
> > ......
> > then this in a loop:
> > --- SIGALRM (Alarm clock) @ 0 (0) ---
> > clock_gettime(CLOCK_MONOTONIC, {1238, 116470107}) = 0
> > sendto(3, "\10\0\203\345\1\326\0\2I\314(v\0\0\0\0\0\0\0\0\0\0\0\0"..., 64, 0, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("1.1.1.1")}, 16) = 64
> > rt_sigaction(SIGALRM, {0x10017034, [ALRM], SA_RESTART}, {0x10017034, [ALRM], SA_RESTART}, 8) = 0
> > alarm(1) = 0
> > sigreturn() = ? (mask now [ILL ABRT FPE KILL ALRM STKFLT CONT STOP TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR RTMIN])
> > recvfrom(3, 0xbfe6a620, 192, 0, 0xbfe6a6f0, 0xbfe6a70c) = ? ERESTARTSYS (To be restarted)
> >
> > Then I do ifconfig eth1 down
> > and I still see the same. Should not
> > sendto and/or revcfrom return some error as
> > the interface is down?
>
> Hmm, this reminds me one patch, yes...
>
> Search for " ipv4: remove all rt cache entries on UNREGISTER event"
>
> http://permalink.gmane.org/gmane.linux.network/173391
Ah, that does the trick. A few comments though:
1) I think you should include IFF_RUNNING too
2) This only affects the TX(sendtoo) path?
The RX(recvfrom) should also get an error.
Jocke
>
> I guess I should respin it for net-next-2.6
Yes, pretty please :)
^ permalink raw reply
* Re: ping -I eth1 ....
From: Thomas Graf @ 2010-11-05 14:25 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Eric Dumazet, netdev
In-Reply-To: <OF22F5901E.A7276220-ONC12577D2.004C79CB-C12577D2.004D1571@transmode.se>
On Fri, Nov 05, 2010 at 03:01:57PM +0100, Joakim Tjernlund wrote:
> > > Then I do ifconfig eth1 down
> > > and I still see the same. Should not
> > > sendto and/or revcfrom return some error as
> > > the interface is down?
> >
> > Hmm, this reminds me one patch, yes...
> >
> > Search for " ipv4: remove all rt cache entries on UNREGISTER event"
> >
> > http://permalink.gmane.org/gmane.linux.network/173391
>
> Ah, that does the trick. A few comments though:
>
> 1) I think you should include IFF_RUNNING too
Probably even better to base it on the operational state of the link
netif_running() && netif_oper_up() && netif_carrier_ok() && !netif_dormant()
^ permalink raw reply
* Re: ping -I eth1 ....
From: Eric Dumazet @ 2010-11-05 14:34 UTC (permalink / raw)
To: Thomas Graf; +Cc: Joakim Tjernlund, netdev
In-Reply-To: <20101105142510.GA14986@canuck.infradead.org>
Le vendredi 05 novembre 2010 à 10:25 -0400, Thomas Graf a écrit :
> On Fri, Nov 05, 2010 at 03:01:57PM +0100, Joakim Tjernlund wrote:
> > > > Then I do ifconfig eth1 down
> > > > and I still see the same. Should not
> > > > sendto and/or revcfrom return some error as
> > > > the interface is down?
> > >
> > > Hmm, this reminds me one patch, yes...
> > >
> > > Search for " ipv4: remove all rt cache entries on UNREGISTER event"
> > >
> > > http://permalink.gmane.org/gmane.linux.network/173391
> >
> > Ah, that does the trick. A few comments though:
> >
> > 1) I think you should include IFF_RUNNING too
>
> Probably even better to base it on the operational state of the link
>
> netif_running() && netif_oper_up() && netif_carrier_ok() && !netif_dormant()
At this point we setup a route.
Is a change of any of this status going to flush/cancel a previously
setup route ?
There must be a reason why in many places we only test (dev->flags &
IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
it at userspace)
^ permalink raw reply
* Re: ping -I eth1 ....
From: Thomas Graf @ 2010-11-05 14:53 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Joakim Tjernlund, netdev
In-Reply-To: <1288967665.2882.522.camel@edumazet-laptop>
On Fri, Nov 05, 2010 at 03:34:25PM +0100, Eric Dumazet wrote:
> Le vendredi 05 novembre 2010 à 10:25 -0400, Thomas Graf a écrit :
> > On Fri, Nov 05, 2010 at 03:01:57PM +0100, Joakim Tjernlund wrote:
> > > 1) I think you should include IFF_RUNNING too
> >
> > Probably even better to base it on the operational state of the link
> >
> > netif_running() && netif_oper_up() && netif_carrier_ok() && !netif_dormant()
>
> At this point we setup a route.
>
> Is a change of any of this status going to flush/cancel a previously
> setup route ?
No it won't.
> There must be a reason why in many places we only test (dev->flags &
> IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
> it at userspace)
The reason is that while the device is not operational we queue all
packets in the qdisc and hope for the link to become operational in the
near future. This does make sense, especially if the link was once
operational.
This case is special however, the interface is specified explicitely
and expectes to be notified immediately if that is not possible.
^ permalink raw reply
* Re: ping -I eth1 ....
From: Joakim Tjernlund @ 2010-11-05 14:57 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Thomas Graf
In-Reply-To: <1288967665.2882.522.camel@edumazet-laptop>
Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/11/05 15:34:25:
>
> Le vendredi 05 novembre 2010 à 10:25 -0400, Thomas Graf a écrit :
> > On Fri, Nov 05, 2010 at 03:01:57PM +0100, Joakim Tjernlund wrote:
> > > > > Then I do ifconfig eth1 down
> > > > > and I still see the same. Should not
> > > > > sendto and/or revcfrom return some error as
> > > > > the interface is down?
> > > >
> > > > Hmm, this reminds me one patch, yes...
> > > >
> > > > Search for " ipv4: remove all rt cache entries on UNREGISTER event"
> > > >
> > > > http://permalink.gmane.org/gmane.linux.network/173391
> > >
> > > Ah, that does the trick. A few comments though:
> > >
> > > 1) I think you should include IFF_RUNNING too
> >
> > Probably even better to base it on the operational state of the link
> >
> > netif_running() && netif_oper_up() && netif_carrier_ok() && !netif_dormant()
>
> At this point we setup a route.
It fixes my problem too so it is not only about setting up routes.
The ping -I eth1 I did didn't even have an IP address on eth1
Perhaps there is a better place to test the interface status?
Especially as the RX path should be considered too.
>
> Is a change of any of this status going to flush/cancel a previously
> setup route ?
>
> There must be a reason why in many places we only test (dev->flags &
> IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
> it at userspace)
Hopefully most of that is legacy or just plain wrong? Unless
someone can say why only test IFF_UP one should consider changing them.
^ permalink raw reply
* Re: ping -I eth1 ....
From: Joakim Tjernlund @ 2010-11-05 15:04 UTC (permalink / raw)
To: Thomas Graf; +Cc: Eric Dumazet, netdev, Thomas Graf
In-Reply-To: <20101105145321.GB14986@canuck.infradead.org>
Thomas Graf <tgr@infradead.org> wrote on 2010/11/05 15:53:21:
>
> On Fri, Nov 05, 2010 at 03:34:25PM +0100, Eric Dumazet wrote:
> > Le vendredi 05 novembre 2010 à 10:25 -0400, Thomas Graf a écrit :
> > > On Fri, Nov 05, 2010 at 03:01:57PM +0100, Joakim Tjernlund wrote:
> > > > 1) I think you should include IFF_RUNNING too
> > >
> > > Probably even better to base it on the operational state of the link
> > >
> > > netif_running() && netif_oper_up() && netif_carrier_ok() && !netif_dormant()
> >
> > At this point we setup a route.
> >
> > Is a change of any of this status going to flush/cancel a previously
> > setup route ?
>
> No it won't.
>
> > There must be a reason why in many places we only test (dev->flags &
> > IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
> > it at userspace)
>
> The reason is that while the device is not operational we queue all
> packets in the qdisc and hope for the link to become operational in the
> near future. This does make sense, especially if the link was once
> operational.
That feels wrong. There is now way to know if it ever will be operational
again, let alone in the near future. Is there a timeout so that
if the link doesn't become operational, it will fail?
^ permalink raw reply
* Re: 2.6.36 vlans & bridge crash - status?
From: Jesse Gross @ 2010-11-05 15:05 UTC (permalink / raw)
To: Nikola Ciprich; +Cc: netdev list, nikola.ciprich
In-Reply-To: <20101105103520.GA3577@pcnci.linuxbox.cz>
On Fri, Nov 5, 2010 at 3:35 AM, Nikola Ciprich <extmaillist@linuxbox.cz> wrote:
> Hello,
> I would like to ask if somebody is trying to solve
> https://bugzilla.kernel.org/show_bug.cgi?id=20462
> and if needed, could I provide some help, testing etc?
I sent out a patch for something related:
http://permalink.gmane.org/gmane.linux.network/176566
My guess is that it will also fix your issue. Can you test it?
^ permalink raw reply
* Re: [PATCH 46/49] net/netfilter: Use vzalloc
From: Jiri Kosina @ 2010-11-05 15:10 UTC (permalink / raw)
To: Joe Perches
Cc: Eric Dumazet, Jesper Juhl, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
In-Reply-To: <1288940146.18440.55.camel@Joe-Laptop>
On Thu, 4 Nov 2010, Joe Perches wrote:
> I also think a single rolled-up single patch is good.
>
> I believe Jiri Kosina can easily apply all these individual patches as a
> single patch if he chooses.
I will, after this settles a little bit (the same for the WARN series).
I prefer waiting a bit before applying your patches usually.
First to see what lands in linux-next through maintainer's trees, second
to gather Acks.
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply
* Re: [PATCH] ipv6: addrconf: don't remove address state on ifdown if the address is being kept
From: David Miller @ 2010-11-05 15:12 UTC (permalink / raw)
To: lorenzo; +Cc: maze, brian.haley, netdev
In-Reply-To: <AANLkTine2qXg7MTFyh=Ka=tB8fuzB18-NVRryTyc=LKp@mail.gmail.com>
From: Lorenzo Colitti <lorenzo@google.com>
Date: Fri, 5 Nov 2010 14:45:28 +0800
> On Thu, Oct 28, 2010 at 2:45 PM, Lorenzo Colitti <lorenzo@google.com> wrote:
>>> Fix it so that none of this state is updated if the address is being kept on the interface.
>
> David, any feedback on this? The existing code clearly has the
> intention of keeping the addresses around, except they don't actually
> work, and this just fixes the bug.
I'm travelling and busy at Kernel Summit and Linux Plumbers Conference,
so I'm only processing the most easiest patches this week.
I'll look into this when I get back.
^ permalink raw reply
* Re: [PATCH 46/49] net/netfilter: Use vzalloc
From: Joe Perches @ 2010-11-05 15:25 UTC (permalink / raw)
To: Jiri Kosina
Cc: Eric Dumazet, Jesper Juhl, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
In-Reply-To: <alpine.LNX.2.00.1011051108270.15851@pobox.suse.cz>
On Fri, 2010-11-05 at 11:10 -0400, Jiri Kosina wrote:
> On Thu, 4 Nov 2010, Joe Perches wrote:
> > I also think a single rolled-up single patch is good.
> > I believe Jiri Kosina can easily apply all these individual patches as a
> > single patch if he chooses.
> I will, after this settles a little bit (the same for the WARN series).
> I prefer waiting a bit before applying your patches usually.
> First to see what lands in linux-next through maintainer's trees, second
> to gather Acks.
I think that's the right way to do these
sorts of trivial changes too.
Individual patches cc'd to maintainers for
feedback, improvement, acks or to be directly
applied to their trees, followed by a longish
delay before any unapplied patches are taken
up as a single patch by your trivial queue.
Thanks for doing that work Jiri.
^ permalink raw reply
* Re: ping -I eth1 ....
From: Joakim Tjernlund @ 2010-11-05 15:45 UTC (permalink / raw)
To: Thomas Graf; +Cc: Eric Dumazet, netdev, Thomas Graf
In-Reply-To: <20101105145321.GB14986@canuck.infradead.org>
Thomas Graf <tgr@infradead.org> wrote on 2010/11/05 15:53:21:
>
> On Fri, Nov 05, 2010 at 03:34:25PM +0100, Eric Dumazet wrote:
> > Le vendredi 05 novembre 2010 à 10:25 -0400, Thomas Graf a écrit :
> > > On Fri, Nov 05, 2010 at 03:01:57PM +0100, Joakim Tjernlund wrote:
> > > > 1) I think you should include IFF_RUNNING too
> > >
> > > Probably even better to base it on the operational state of the link
> > >
> > > netif_running() && netif_oper_up() && netif_carrier_ok() && !netif_dormant()
> >
> > At this point we setup a route.
> >
> > Is a change of any of this status going to flush/cancel a previously
> > setup route ?
>
> No it won't.
>
> > There must be a reason why in many places we only test (dev->flags &
> > IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
> > it at userspace)
>
> The reason is that while the device is not operational we queue all
> packets in the qdisc and hope for the link to become operational in the
> near future. This does make sense, especially if the link was once
> operational.
Hmm, perhaps one needs to treat user space differently from
internal kernel calls?
User space should always get an error if the link isn't functional.
^ permalink raw reply
* Re: ping -I eth1 ....
From: Eric Dumazet @ 2010-11-05 15:06 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: netdev, Thomas Graf
In-Reply-To: <OF6C6C2970.245A64ED-ONC12577D2.00518CF6-C12577D2.00522AAD@transmode.se>
Le vendredi 05 novembre 2010 à 15:57 +0100, Joakim Tjernlund a écrit :
> Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/11/05 15:34:25:
> t be a reason why in many places we only test (dev->flags &
> > IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
> > it at userspace)
>
> Hopefully most of that is legacy or just plain wrong? Unless
> someone can say why only test IFF_UP one should consider changing them.
>
Most of the places are hot path.
You dont want to replace one test by four tests.
_This_ would be wrong :)
^ permalink raw reply
* Re: ping -I eth1 ....
From: Joakim Tjernlund @ 2010-11-05 15:54 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Thomas Graf
In-Reply-To: <1288969614.2882.590.camel@edumazet-laptop>
Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/11/05 16:06:54:
>
> Le vendredi 05 novembre 2010 à 15:57 +0100, Joakim Tjernlund a écrit :
> > Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/11/05 15:34:25:
> > t be a reason why in many places we only test (dev->flags &
> > > IFF_UP), and _never_ netif_oper_up() (only in dev_get_flags() to export
> > > it at userspace)
> >
> > Hopefully most of that is legacy or just plain wrong? Unless
> > someone can say why only test IFF_UP one should consider changing them.
> >
>
> Most of the places are hot path.
>
> You dont want to replace one test by four tests.
>
> _This_ would be wrong :)
Wrong is wrong, even if it is in the hot path :)
Perhaps it is time define and internal IFF_OPERATIONAL flag
which is the sum of IFF_UP, IFF_RUNNING etc.? That
way you still get one test in the hot path and can abstract
what defines an operational link.
Jocke
^ 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