* [PATCH 2/2] smsc95xx: support PHY wakeup source
From: Steve Glendinning @ 2012-11-21 13:29 UTC (permalink / raw)
To: netdev; +Cc: Steve Glendinning
In-Reply-To: <1353504577-5719-1-git-send-email-steve.glendinning@shawell.net>
This patch enables LAN9500 family devices to wake from suspend
on either link up or link down events
It also adds _nopm versions of mdio access functions, so we can
safely call them from suspend and resume functions
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
---
drivers/net/usb/smsc95xx.c | 161 +++++++++++++++++++++++++++++++++++++++-----
drivers/net/usb/smsc95xx.h | 17 +++++
2 files changed, 161 insertions(+), 17 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 42fc1df..717e9ca 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -48,8 +48,10 @@
#define SMSC95XX_INTERNAL_PHY_ID (1)
#define SMSC95XX_TX_OVERHEAD (8)
#define SMSC95XX_TX_OVERHEAD_CSUM (12)
-#define SUPPORTED_WAKE (WAKE_UCAST | WAKE_BCAST | \
+#define SUPPORTED_WAKE (WAKE_PHY | WAKE_UCAST | WAKE_BCAST | \
WAKE_MCAST | WAKE_ARP | WAKE_MAGIC)
+#define PHY_WAKE_INTS (PHY_INT_MASK_ANEG_COMP_ | \
+ PHY_INT_MASK_LINK_DOWN_)
#define FEATURE_8_WAKEUP_FILTERS (0x01)
#define FEATURE_PHY_NLP_CROSSOVER (0x02)
@@ -176,14 +178,15 @@ static int smsc95xx_clear_feature(struct usbnet *dev, u32 feature)
/* Loop until the read is completed with timeout
* called with phy_mutex held */
-static int __must_check smsc95xx_phy_wait_not_busy(struct usbnet *dev)
+static int __must_check __smsc95xx_phy_wait_not_busy(struct usbnet *dev,
+ int in_pm)
{
unsigned long start_time = jiffies;
u32 val;
int ret;
do {
- ret = smsc95xx_read_reg(dev, MII_ADDR, &val);
+ ret = __smsc95xx_read_reg(dev, MII_ADDR, &val, in_pm);
check_warn_return(ret, "Error reading MII_ACCESS");
if (!(val & MII_BUSY_))
return 0;
@@ -192,7 +195,8 @@ static int __must_check smsc95xx_phy_wait_not_busy(struct usbnet *dev)
return -EIO;
}
-static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
+static int __smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx,
+ int in_pm)
{
struct usbnet *dev = netdev_priv(netdev);
u32 val, addr;
@@ -201,20 +205,20 @@ static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
mutex_lock(&dev->phy_mutex);
/* confirm MII not busy */
- ret = smsc95xx_phy_wait_not_busy(dev);
+ ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
check_warn_goto_done(ret, "MII is busy in smsc95xx_mdio_read");
/* set the address, index & direction (read from PHY) */
phy_id &= dev->mii.phy_id_mask;
idx &= dev->mii.reg_num_mask;
addr = (phy_id << 11) | (idx << 6) | MII_READ_ | MII_BUSY_;
- ret = smsc95xx_write_reg(dev, MII_ADDR, addr);
+ ret = __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm);
check_warn_goto_done(ret, "Error writing MII_ADDR");
- ret = smsc95xx_phy_wait_not_busy(dev);
+ ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
check_warn_goto_done(ret, "Timed out reading MII reg %02X", idx);
- ret = smsc95xx_read_reg(dev, MII_DATA, &val);
+ ret = __smsc95xx_read_reg(dev, MII_DATA, &val, in_pm);
check_warn_goto_done(ret, "Error reading MII_DATA");
ret = (u16)(val & 0xFFFF);
@@ -224,8 +228,8 @@ done:
return ret;
}
-static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
- int regval)
+static void __smsc95xx_mdio_write(struct net_device *netdev, int phy_id,
+ int idx, int regval, int in_pm)
{
struct usbnet *dev = netdev_priv(netdev);
u32 val, addr;
@@ -234,27 +238,50 @@ static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
mutex_lock(&dev->phy_mutex);
/* confirm MII not busy */
- ret = smsc95xx_phy_wait_not_busy(dev);
+ ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
check_warn_goto_done(ret, "MII is busy in smsc95xx_mdio_write");
val = regval;
- ret = smsc95xx_write_reg(dev, MII_DATA, val);
+ ret = __smsc95xx_write_reg(dev, MII_DATA, val, in_pm);
check_warn_goto_done(ret, "Error writing MII_DATA");
/* set the address, index & direction (write to PHY) */
phy_id &= dev->mii.phy_id_mask;
idx &= dev->mii.reg_num_mask;
addr = (phy_id << 11) | (idx << 6) | MII_WRITE_ | MII_BUSY_;
- ret = smsc95xx_write_reg(dev, MII_ADDR, addr);
+ ret = __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm);
check_warn_goto_done(ret, "Error writing MII_ADDR");
- ret = smsc95xx_phy_wait_not_busy(dev);
+ ret = __smsc95xx_phy_wait_not_busy(dev, in_pm);
check_warn_goto_done(ret, "Timed out writing MII reg %02X", idx);
done:
mutex_unlock(&dev->phy_mutex);
}
+static int smsc95xx_mdio_read_nopm(struct net_device *netdev, int phy_id,
+ int idx)
+{
+ return __smsc95xx_mdio_read(netdev, phy_id, idx, 1);
+}
+
+static void smsc95xx_mdio_write_nopm(struct net_device *netdev, int phy_id,
+ int idx, int regval)
+{
+ __smsc95xx_mdio_write(netdev, phy_id, idx, regval, 1);
+}
+
+static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
+{
+ return __smsc95xx_mdio_read(netdev, phy_id, idx, 0);
+}
+
+static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
+ int regval)
+{
+ __smsc95xx_mdio_write(netdev, phy_id, idx, regval, 0);
+}
+
static int __must_check smsc95xx_wait_eeprom(struct usbnet *dev)
{
unsigned long start_time = jiffies;
@@ -1067,18 +1094,59 @@ static u16 smsc_crc(const u8 *buffer, size_t len, int filter)
return bitrev16(crc16(0xFFFF, buffer, len)) << ((filter % 2) * 16);
}
+static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev)
+{
+ struct mii_if_info *mii = &dev->mii;
+ int ret;
+
+ netdev_info(dev->net, "enabling PHY wakeup interrupts");
+
+ /* read to clear */
+ ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, PHY_INT_SRC);
+ check_warn_return(ret, "Error reading PHY_INT_SRC");
+
+ /* enable interrupt source */
+ ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, PHY_INT_MASK);
+ check_warn_return(ret, "Error reading PHY_INT_MASK");
+
+ ret |= PHY_WAKE_INTS;
+
+ smsc95xx_mdio_write_nopm(dev->net, mii->phy_id, PHY_INT_MASK, ret);
+
+ return 0;
+}
+
+static int smsc95xx_link_ok_nopm(struct usbnet *dev)
+{
+ struct mii_if_info *mii = &dev->mii;
+
+ /* first, a dummy read, needed to latch some MII phys */
+ int ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, MII_BMSR);
+ check_warn_return(ret, "Error reading MII_BMSR");
+
+ ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id, MII_BMSR);
+ check_warn_return(ret, "Error reading MII_BMSR");
+
+ return !!(ret & BMSR_LSTATUS);
+}
+
static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
{
struct usbnet *dev = usb_get_intfdata(intf);
struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
int ret;
- u32 val;
+ u32 val, link_up;
ret = usbnet_suspend(intf, message);
check_warn_return(ret, "usbnet_suspend error");
- /* if no wol options set, enter lowest power SUSPEND2 mode */
- if (!(pdata->wolopts & SUPPORTED_WAKE)) {
+ /* determine if link is up using only _nopm functions */
+ link_up = smsc95xx_link_ok_nopm(dev);
+
+ /* if no wol options set, or if link is down and we're not waking on
+ * PHY activity, enter lowest power SUSPEND2 mode */
+ if (!(pdata->wolopts & SUPPORTED_WAKE) ||
+ !(link_up || (pdata->wolopts & WAKE_PHY))) {
netdev_info(dev->net, "entering SUSPEND2 mode");
/* disable energy detect (link up) & wake up events */
@@ -1111,6 +1179,56 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
return 0;
}
+ if (pdata->wolopts & WAKE_PHY) {
+ ret = smsc95xx_enable_phy_wakeup_interrupts(dev);
+ check_warn_return(ret, "error enabling PHY wakeup ints");
+
+ /* if link is down then configure EDPD and enter SUSPEND1,
+ * otherwise enter SUSPEND0 below */
+ if (!link_up) {
+ struct mii_if_info *mii = &dev->mii;
+ netdev_info(dev->net, "entering SUSPEND1 mode");
+
+ /* reconfigure link pulse detection timing for
+ * compatibility with non-standard link partners */
+ if (pdata->features & FEATURE_PHY_NLP_CROSSOVER)
+ smsc95xx_mdio_write_nopm(dev->net, mii->phy_id,
+ PHY_EDPD_CONFIG,
+ PHY_EDPD_CONFIG_DEFAULT);
+
+ /* enable energy detect power-down mode */
+ ret = smsc95xx_mdio_read_nopm(dev->net, mii->phy_id,
+ PHY_MODE_CTRL_STS);
+ check_warn_return(ret, "Error reading PHY_MODE_CTRL_STS");
+
+ ret |= MODE_CTRL_STS_EDPWRDOWN_;
+
+ smsc95xx_mdio_write_nopm(dev->net, mii->phy_id,
+ PHY_MODE_CTRL_STS, ret);
+
+ /* enter SUSPEND1 mode */
+ ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
+ check_warn_return(ret, "Error reading PM_CTRL");
+
+ val &= ~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_);
+ val |= PM_CTL_SUS_MODE_1;
+
+ ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
+ check_warn_return(ret, "Error writing PM_CTRL");
+
+ /* clear wol status, enable energy detection */
+ val &= ~PM_CTL_WUPS_;
+ val |= (PM_CTL_WUPS_ED_ | PM_CTL_ED_EN_);
+
+ ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
+ check_warn_return(ret, "Error writing PM_CTRL");
+
+ smsc95xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
+
+ return 0;
+ }
+ }
+
if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
u32 *filter_mask = kzalloc(32, GFP_KERNEL);
u32 command[2];
@@ -1249,6 +1367,10 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
val |= PM_CTL_WOL_EN_;
+ /* phy energy detect wakeup source */
+ if (pdata->wolopts & WAKE_PHY)
+ val |= PM_CTL_ED_EN_;
+
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
check_warn_return(ret, "Error writing PM_CTRL");
@@ -1270,6 +1392,11 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
/* clear wol status */
val &= ~PM_CTL_WUPS_;
val |= PM_CTL_WUPS_WOL_;
+
+ /* enable energy detection */
+ if (pdata->wolopts & WAKE_PHY)
+ val |= PM_CTL_WUPS_ED_;
+
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
check_warn_return(ret, "Error writing PM_CTRL");
diff --git a/drivers/net/usb/smsc95xx.h b/drivers/net/usb/smsc95xx.h
index 99f04a2..f360ee3 100644
--- a/drivers/net/usb/smsc95xx.h
+++ b/drivers/net/usb/smsc95xx.h
@@ -226,6 +226,23 @@
/* Vendor-specific PHY Definitions */
+/* EDPD NLP / crossover time configuration (LAN9500A only) */
+#define PHY_EDPD_CONFIG (16)
+#define PHY_EDPD_CONFIG_TX_NLP_EN_ ((u16)0x8000)
+#define PHY_EDPD_CONFIG_TX_NLP_1000_ ((u16)0x0000)
+#define PHY_EDPD_CONFIG_TX_NLP_768_ ((u16)0x2000)
+#define PHY_EDPD_CONFIG_TX_NLP_512_ ((u16)0x4000)
+#define PHY_EDPD_CONFIG_TX_NLP_256_ ((u16)0x6000)
+#define PHY_EDPD_CONFIG_RX_1_NLP_ ((u16)0x1000)
+#define PHY_EDPD_CONFIG_RX_NLP_64_ ((u16)0x0000)
+#define PHY_EDPD_CONFIG_RX_NLP_256_ ((u16)0x0400)
+#define PHY_EDPD_CONFIG_RX_NLP_512_ ((u16)0x0800)
+#define PHY_EDPD_CONFIG_RX_NLP_1000_ ((u16)0x0C00)
+#define PHY_EDPD_CONFIG_EXT_CROSSOVER_ ((u16)0x0001)
+#define PHY_EDPD_CONFIG_DEFAULT (PHY_EDPD_CONFIG_TX_NLP_EN_ | \
+ PHY_EDPD_CONFIG_TX_NLP_768_ | \
+ PHY_EDPD_CONFIG_RX_1_NLP_)
+
/* Mode Control/Status Register */
#define PHY_MODE_CTRL_STS (17)
#define MODE_CTRL_STS_EDPWRDOWN_ ((u16)0x2000)
--
1.7.10.4
^ permalink raw reply related
* RE: [PATCH 9/9] batman-adv: Use packing of 2 for all headers before an ethernet header
From: David Laight @ 2012-11-21 13:36 UTC (permalink / raw)
To: Antonio Quartulli, davem
Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Marek Lindner
In-Reply-To: <1353499919-28596-10-git-send-email-ordex@autistici.org>
> All packet headers in front of an ethernet header have to be completely
> divisible by 2 but not by 4 to make the payload after the ethernet header again
> 4 bytes boundary aligned.
I'm not sure that statement is correct - whether the patches are
correct rather depends on the actual packet format(s) you are
generating/modifying.
If you are adding data to an ethernet packet you'll need
to add a multiple of 4 bytes in order maintain the alignment
of the IP header (which needs to be 4 byte aligned and is
usually 14 bytes from the start of the receive data).
This means that the data you add probably has to be 4n+2
aligned - since I guess you are adding between the source
MAC address and ethertype?
If you are inserting data after the ethertype (ie after some
protocol identifier), then your header can be 4 byte aligned
provided it ends with the replacement ethertype (0800 or 0806
for IP protocols).
David
^ permalink raw reply
* Re: [Xen-devel] [PATCH V3] xen/netfront: handle compound page fragments on transmit
From: Stefan Bader @ 2012-11-21 13:45 UTC (permalink / raw)
To: Ian Campbell
Cc: netdev, Sander Eikelenboom, ANNIE LI, xen-devel,
Konrad Rzeszutek Wilk, Eric Dumazet
In-Reply-To: <1353499336-28952-1-git-send-email-ian.campbell@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 5565 bytes --]
FWIW, I ran the v3 version and it appears to be good from that point of view.
If it looks good to everyone else, it would be great if that could reach 3.7
final. :)
-Stefan
On 21.11.2012 13:02, Ian Campbell wrote:
> An SKB paged fragment can consist of a compound page with order > 0.
> However the netchannel protocol deals only in PAGE_SIZE frames.
>
> Handle this in xennet_make_frags by iterating over the frames which
> make up the page.
>
> This is the netfront equivalent to 6a8ed462f16b for netback.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: netdev@vger.kernel.org
> Cc: xen-devel@lists.xen.org
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
> Cc: ANNIE LI <annie.li@oracle.com>
> Cc: Sander Eikelenboom <linux@eikelenboom.it>
> Cc: Stefan Bader <stefan.bader@canonical.com>
> ---
> v3: limit to 80-characters. Use net_alert_ratelimited.
> v2: check we have enough room in the ring and that the other end can
> cope with the number of slots in a single frame
> ---
> drivers/net/xen-netfront.c | 98 ++++++++++++++++++++++++++++++++++---------
> 1 files changed, 77 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index caa0110..fc24eb9 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -452,29 +452,85 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
> /* Grant backend access to each skb fragment page. */
> for (i = 0; i < frags; i++) {
> skb_frag_t *frag = skb_shinfo(skb)->frags + i;
> + struct page *page = skb_frag_page(frag);
>
> - tx->flags |= XEN_NETTXF_more_data;
> + len = skb_frag_size(frag);
> + offset = frag->page_offset;
>
> - id = get_id_from_freelist(&np->tx_skb_freelist, np->tx_skbs);
> - np->tx_skbs[id].skb = skb_get(skb);
> - tx = RING_GET_REQUEST(&np->tx, prod++);
> - tx->id = id;
> - ref = gnttab_claim_grant_reference(&np->gref_tx_head);
> - BUG_ON((signed short)ref < 0);
> + /* Data must not cross a page boundary. */
> + BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
>
> - mfn = pfn_to_mfn(page_to_pfn(skb_frag_page(frag)));
> - gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id,
> - mfn, GNTMAP_readonly);
> + /* Skip unused frames from start of page */
> + page += offset >> PAGE_SHIFT;
> + offset &= ~PAGE_MASK;
>
> - tx->gref = np->grant_tx_ref[id] = ref;
> - tx->offset = frag->page_offset;
> - tx->size = skb_frag_size(frag);
> - tx->flags = 0;
> + while (len > 0) {
> + unsigned long bytes;
> +
> + BUG_ON(offset >= PAGE_SIZE);
> +
> + bytes = PAGE_SIZE - offset;
> + if (bytes > len)
> + bytes = len;
> +
> + tx->flags |= XEN_NETTXF_more_data;
> +
> + id = get_id_from_freelist(&np->tx_skb_freelist,
> + np->tx_skbs);
> + np->tx_skbs[id].skb = skb_get(skb);
> + tx = RING_GET_REQUEST(&np->tx, prod++);
> + tx->id = id;
> + ref = gnttab_claim_grant_reference(&np->gref_tx_head);
> + BUG_ON((signed short)ref < 0);
> +
> + mfn = pfn_to_mfn(page_to_pfn(page));
> + gnttab_grant_foreign_access_ref(ref,
> + np->xbdev->otherend_id,
> + mfn, GNTMAP_readonly);
> +
> + tx->gref = np->grant_tx_ref[id] = ref;
> + tx->offset = offset;
> + tx->size = bytes;
> + tx->flags = 0;
> +
> + offset += bytes;
> + len -= bytes;
> +
> + /* Next frame */
> + if (offset == PAGE_SIZE && len) {
> + BUG_ON(!PageCompound(page));
> + page++;
> + offset = 0;
> + }
> + }
> }
>
> np->tx.req_prod_pvt = prod;
> }
>
> +/*
> + * Count how many ring slots are required to send the frags of this
> + * skb. Each frag might be a compound page.
> + */
> +static int xennet_count_skb_frag_slots(struct sk_buff *skb)
> +{
> + int i, frags = skb_shinfo(skb)->nr_frags;
> + int pages = 0;
> +
> + for (i = 0; i < frags; i++) {
> + skb_frag_t *frag = skb_shinfo(skb)->frags + i;
> + unsigned long size = skb_frag_size(frag);
> + unsigned long offset = frag->page_offset;
> +
> + /* Skip unused frames from start of page */
> + offset &= ~PAGE_MASK;
> +
> + pages += PFN_UP(offset + size);
> + }
> +
> + return pages;
> +}
> +
> static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> unsigned short id;
> @@ -487,23 +543,23 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
> grant_ref_t ref;
> unsigned long mfn;
> int notify;
> - int frags = skb_shinfo(skb)->nr_frags;
> + int slots;
> unsigned int offset = offset_in_page(data);
> unsigned int len = skb_headlen(skb);
> unsigned long flags;
>
> - frags += DIV_ROUND_UP(offset + len, PAGE_SIZE);
> - if (unlikely(frags > MAX_SKB_FRAGS + 1)) {
> - printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n",
> - frags);
> - dump_stack();
> + slots = DIV_ROUND_UP(offset + len, PAGE_SIZE) +
> + xennet_count_skb_frag_slots(skb);
> + if (unlikely(slots > MAX_SKB_FRAGS + 1)) {
> + net_alert_ratelimited(
> + "xennet: skb rides the rocket: %d slots\n", slots);
> goto drop;
> }
>
> spin_lock_irqsave(&np->tx_lock, flags);
>
> if (unlikely(!netif_carrier_ok(dev) ||
> - (frags > 1 && !xennet_can_sg(dev)) ||
> + (slots > 1 && !xennet_can_sg(dev)) ||
> netif_needs_gso(skb, netif_skb_features(skb)))) {
> spin_unlock_irqrestore(&np->tx_lock, flags);
> goto drop;
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]
^ permalink raw reply
* Re: [PATCH 9/9] batman-adv: Use packing of 2 for all headers before an ethernet header
From: Sven Eckelmann @ 2012-11-21 13:51 UTC (permalink / raw)
To: David Laight
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Marek Lindner,
davem-fT/PcQaiUtIeIZ0/mPfg9Q
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B70BB-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]
On Wednesday 21 November 2012 13:36:54 David Laight wrote:
> > All packet headers in front of an ethernet header have to be completely
> > divisible by 2 but not by 4 to make the payload after the ethernet header
> > again 4 bytes boundary aligned.
>
> I'm not sure that statement is correct - whether the patches are
> correct rather depends on the actual packet format(s) you are
> generating/modifying.
>
> If you are adding data to an ethernet packet you'll need
> to add a multiple of 4 bytes in order maintain the alignment
> of the IP header (which needs to be 4 byte aligned and is
> usually 14 bytes from the start of the receive data).
>
> This means that the data you add probably has to be 4n+2
> aligned - since I guess you are adding between the source
> MAC address and ethertype?
> If you are inserting data after the ethertype (ie after some
> protocol identifier), then your header can be 4 byte aligned
> provided it ends with the replacement ethertype (0800 or 0806
> for IP protocols).
No, it looks like this
ethernet header | batman-adv stuff | ethernet header | ip header
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [RFC PATCH] tcp: introduce raw access to experimental options
From: Einar Lueck @ 2012-11-21 14:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev, frankbla, raspl, ubacher, samudrala
In-Reply-To: <20121116.134424.1929556546744828875.davem@davemloft.net>
On 11/16/2012 07:44 PM, David Miller wrote:
>
> Unprivileged access to set and fetch these things? I don't think
> that's a good idea.
>
> Also, your code has a lot of coding style errors.
>
Would a restriction to a CAP_NET_ADMIN like privilege level address and
resolve your concerns?
Thx,
Einar.
^ permalink raw reply
* [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size/gso_max_segs setting of slave devices.
From: sarveshwar.bandi @ 2012-11-21 14:35 UTC (permalink / raw)
To: davem; +Cc: netdev, Sarveshwar Bandi
From: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
Patch sets the lowest gso_max_size and gso_max_segs values of the slave devices during enslave and detach.
Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
---
drivers/net/bonding/bond_main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b2530b0..5f5b69f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1379,6 +1379,8 @@ static void bond_compute_features(struct bonding *bond)
struct net_device *bond_dev = bond->dev;
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
unsigned short max_hard_header_len = ETH_HLEN;
+ unsigned int gso_max_size = GSO_MAX_SIZE;
+ u16 gso_max_segs = GSO_MAX_SEGS;
int i;
unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE;
@@ -1394,11 +1396,16 @@ static void bond_compute_features(struct bonding *bond)
dst_release_flag &= slave->dev->priv_flags;
if (slave->dev->hard_header_len > max_hard_header_len)
max_hard_header_len = slave->dev->hard_header_len;
+
+ gso_max_size = min(gso_max_size, slave->dev->gso_max_size);
+ gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs);
}
done:
bond_dev->vlan_features = vlan_features;
bond_dev->hard_header_len = max_hard_header_len;
+ bond_dev->gso_max_segs = gso_max_segs;
+ netif_set_gso_max_size(bond_dev, gso_max_size);
flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE;
bond_dev->priv_flags = flags | dst_release_flag;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH]ipv6: fix the bug when we do not have a socket context
From: Eric Dumazet @ 2012-11-21 14:40 UTC (permalink / raw)
To: Duan Jiong; +Cc: davem, netdev
In-Reply-To: <50ACB71C.4080101@gmail.com>
On Wed, 2012-11-21 at 19:12 +0800, Duan Jiong wrote:
> call the ip6_update_pmtu/ip6_redirect function to deal with
> ICMPV6 Error Messages and Redirect Message, when we do not
> have a socket context.
>
> Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
> ---
What is the exact problem you want to solve ?
What is the possible impact on the routing table size ?
Thanks
^ permalink raw reply
* Re: [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size setting of slaves.
From: Eric Dumazet @ 2012-11-21 14:43 UTC (permalink / raw)
To: sarveshwar.bandi; +Cc: davem, netdev
In-Reply-To: <8814d83f-7213-4a32-91ec-39088a1a60a6@CMEXHTCAS1.ad.emulex.com>
On Wed, 2012-11-21 at 16:48 +0530, sarveshwar.bandi@emulex.com wrote:
> From: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
>
> Patch sets the lowest non-zero gso_max_size value of the slaves during enslave
> and detach.
>
> Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
> ---
> drivers/net/bonding/bond_main.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index b2530b0..5f19d16 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1198,6 +1198,31 @@ static void bond_attach_slave(struct bonding *bond, struct slave *new_slave)
> bond->slave_cnt++;
> }
>
> +static void bond_set_gso_max_size(struct bonding *bond)
> +{
> + struct slave *slave;
> + struct net_device *bond_dev = bond->dev;
> + unsigned int gso_max_size = 0;
> + bool reset_gso_size = true;
> + int i;
> +
> + bond_for_each_slave(bond, slave, i) {
> + if (!slave->dev->gso_max_size)
> + continue;
> +
> + reset_gso_size = false;
> +
> + if (!gso_max_size ||
> + slave->dev->gso_max_size < gso_max_size)
> + gso_max_size = slave->dev->gso_max_size;
> + }
> +
> + if (gso_max_size && gso_max_size < bond_dev->gso_max_size)
> + netif_set_gso_max_size(bond_dev, gso_max_size);
> + else if (reset_gso_size)
> + netif_set_gso_max_size(bond_dev, 0);
> +}
> +
This seems a bit complex, and I have no idea why you call
netif_set_gso_max_size(bond_dev, 0);
Default gso_max_size is GSO_MAX_SIZE, not 0
^ permalink raw reply
* RE: [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size setting of slaves.
From: Bandi,Sarveshwar @ 2012-11-21 14:44 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem@davemloft.net, netdev@vger.kernel.org
In-Reply-To: <1353509025.2590.31.camel@edumazet-glaptop>
Eric,
I realized the good up and I have reposted this patch. Please review the latest.
Thanks,
Sarvesh
-----Original Message-----
From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
Sent: Wednesday, November 21, 2012 8:14 PM
To: Bandi,Sarveshwar
Cc: davem@davemloft.net; netdev@vger.kernel.org
Subject: Re: [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size setting of slaves.
On Wed, 2012-11-21 at 16:48 +0530, sarveshwar.bandi@emulex.com wrote:
> From: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
>
> Patch sets the lowest non-zero gso_max_size value of the slaves during
> enslave and detach.
>
> Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
> ---
> drivers/net/bonding/bond_main.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/net/bonding/bond_main.c
> b/drivers/net/bonding/bond_main.c index b2530b0..5f19d16 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1198,6 +1198,31 @@ static void bond_attach_slave(struct bonding *bond, struct slave *new_slave)
> bond->slave_cnt++;
> }
>
> +static void bond_set_gso_max_size(struct bonding *bond) {
> + struct slave *slave;
> + struct net_device *bond_dev = bond->dev;
> + unsigned int gso_max_size = 0;
> + bool reset_gso_size = true;
> + int i;
> +
> + bond_for_each_slave(bond, slave, i) {
> + if (!slave->dev->gso_max_size)
> + continue;
> +
> + reset_gso_size = false;
> +
> + if (!gso_max_size ||
> + slave->dev->gso_max_size < gso_max_size)
> + gso_max_size = slave->dev->gso_max_size;
> + }
> +
> + if (gso_max_size && gso_max_size < bond_dev->gso_max_size)
> + netif_set_gso_max_size(bond_dev, gso_max_size);
> + else if (reset_gso_size)
> + netif_set_gso_max_size(bond_dev, 0); }
> +
This seems a bit complex, and I have no idea why you call netif_set_gso_max_size(bond_dev, 0);
Default gso_max_size is GSO_MAX_SIZE, not 0
^ permalink raw reply
* Re: [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size setting of slaves.
From: Eric Dumazet @ 2012-11-21 14:44 UTC (permalink / raw)
To: Neil Horman; +Cc: sarveshwar.bandi, davem, netdev
In-Reply-To: <20121121115601.GA5579@hmsreliant.think-freely.org>
On Wed, 2012-11-21 at 06:56 -0500, Neil Horman wrote:
> This seems a bit overly complex. It doesn't seem like you need the
> reset_go_size bool in here at all. Just initalize gso_max_size to GSO_MAX_SIZE
> and reduce it every time you find a smaller gso value on a slave. Then you can
> unilaterally set the bond devices gso_max_size without having to check any bools
> or do any comparisons.
Oh well, I should have read your answer ;)
^ permalink raw reply
* Re: [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size/gso_max_segs setting of slave devices.
From: Eric Dumazet @ 2012-11-21 14:55 UTC (permalink / raw)
To: sarveshwar.bandi; +Cc: davem, netdev
In-Reply-To: <649de771-427a-4876-af3c-9f84a164a7f1@CMEXHTCAS2.ad.emulex.com>
On Wed, 2012-11-21 at 20:05 +0530, sarveshwar.bandi@emulex.com wrote:
> From: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
>
> Patch sets the lowest gso_max_size and gso_max_segs values of the slave devices during enslave and detach.
>
> Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
> ---
> drivers/net/bonding/bond_main.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index b2530b0..5f5b69f 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1379,6 +1379,8 @@ static void bond_compute_features(struct bonding *bond)
> struct net_device *bond_dev = bond->dev;
> netdev_features_t vlan_features = BOND_VLAN_FEATURES;
> unsigned short max_hard_header_len = ETH_HLEN;
> + unsigned int gso_max_size = GSO_MAX_SIZE;
> + u16 gso_max_segs = GSO_MAX_SEGS;
> int i;
> unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE;
>
> @@ -1394,11 +1396,16 @@ static void bond_compute_features(struct bonding *bond)
> dst_release_flag &= slave->dev->priv_flags;
> if (slave->dev->hard_header_len > max_hard_header_len)
> max_hard_header_len = slave->dev->hard_header_len;
> +
> + gso_max_size = min(gso_max_size, slave->dev->gso_max_size);
> + gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs);
> }
>
> done:
> bond_dev->vlan_features = vlan_features;
> bond_dev->hard_header_len = max_hard_header_len;
> + bond_dev->gso_max_segs = gso_max_segs;
> + netif_set_gso_max_size(bond_dev, gso_max_size);
>
> flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE;
> bond_dev->priv_flags = flags | dst_release_flag;
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Re: [PATCH v2] checkpatch: add double empty line check
From: Joe Perches @ 2012-11-21 15:01 UTC (permalink / raw)
To: eilong; +Cc: Andy Whitcroft, David Rientjes, linux-kernel, netdev
In-Reply-To: <1353490921.6559.40.camel@lb-tlvb-eilong.il.broadcom.com>
On Wed, 2012-11-21 at 11:42 +0200, Eilon Greenstein wrote:
> On Tue, 2012-11-20 at 15:41 -0800, Joe Perches wrote:
> > On Tue, 2012-11-20 at 23:19 +0000, Andy Whitcroft wrote:
> > > On Tue, Nov 20, 2012 at 01:58:48PM -0800, Joe Perches wrote:
> > >
> > > > +# check for multiple blank lines, warn only on the second one in a block
> > > > + if ($rawline =~ /^.\s*$/ &&
> > > > + $prevrawline =~ /^.\s*$/ &&
> > > > + $linenr != $last_blank_linenr + 1) {
> > > > + CHK("DOUBLE_EMPTY_LINE",
> > > > + "One blank line separating blocks is generally sufficient\n" . $herecurr);
> > > > + $last_blank_linenr = $linenr;
> > > > + }
> > > > +
> > > > # check for line continuations in quoted strings with odd counts of "
> > > > if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
> > > > WARN("LINE_CONTINUATIONS",
> > >
> > > Pretty sure that will fail with combination which have removed lines.
> >
> > Not as far as I can tell.
> > Deleted lines followed by inserted lines seem
> > to work OK.
> >
> > This check is located after the test that ensures
> > the current $line/$rawline is an insertion.
> >
>
> But you do not look at the next line, so you will miss something like
> that:
>
> diff --git a/test.c b/test.c
> index e3c46d4..e1c6ffc 100644
> --- a/test.c
> +++ b/test.c
> @@ -15,7 +15,8 @@
> * something
> * something
> * something
> - * next line was already empty */
> + * next line was already empty, but I'm adding another one now*/
> +
Hi Eilon.
Thanks for the test case.
That's true, but I'm OK with missing a few cases in the
search for simplicity as long as there aren't significant
false positives.
For instance the next test
# check for line continuations in quoted strings with odd counts of "
if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
WARN("LINE_CONTINUATIONS",
That fails if the rawline is:
"\"" \
Does it matter much? Probably not.
I suppose that test could be improved by using $line.
checkpatch isn't a perfect tool. Given how it's constructed,
I doubt it ever could be.
No doubt you and Andy will find a better solution.
^ permalink raw reply
* Packet Corruption with Atheros Communications Inc. AR8121/AR8113/AR8114 Gigabit or Fast Ethernet (rev b0) Interface
From: Martin Tessun @ 2012-11-21 14:54 UTC (permalink / raw)
To: netdev
Hi @all,
unfortunately I don't have the old postings any more, so I start a new
thread.
Following situation:
I have a Server (NFS) and a Client with the Atheros network card. If I
transfer big files, the md5sum of these files differ.
If I try to scp the file I get "MAC corrupted on inpu".
Everything works fine, if running on any other OS (or with other NICs
than the Atheros one).
So here is the data:
lspci:
02:00.0 Ethernet controller: Atheros Communications Inc.
AR8121/AR8113/AR8114 Gigabit or Fast Ethernet (rev b0)
Subsystem: ASUSTeK Computer Inc. Device 831c
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR+ FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 44
Region 0: Memory at fbec0000 (64-bit, non-prefetchable) [size=256K]
Region 2: I/O ports at dc00 [size=128]
Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [48] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee0f00c Data: 4181
Capabilities: [58] Express (v1) Endpoint, MSI 00
DevCap: MaxPayload 4096 bytes, PhantFunc 0, Latency L0s
<4us, L1 unlimited
ExtTag- AttnBtn+ AttnInd+ PwrInd+ RBE- FLReset-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal-
Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr- UncorrErr+ FatalErr- UnsuppReq+
AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s,
Latency L0 unlimited, L1 unlimited
ClockPM- Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain-
CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+
DLActive- BWMgmt- ABWMgmt-
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt+
UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt-
UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt-
UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout-
NonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout-
NonFatalErr-
AERCap: First Error Pointer: 14, GenCap+ CGenEn-
ChkCap+ ChkEn-
Capabilities: [180 v1] Device Serial Number ff-76-f8-79-00-26-18-ff
Kernel driver in use: ATL1E
$ ethtool -k eth0
Offload parameters for eth0:
rx-checksumming: off
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: off
SCP initiated on client:
$ scp server:/export/no_backup/burn/openSUSE-12.2-DVD-x86_64.iso .
openSUSE-12.2-DVD-x86_64.iso
1% 88MB
9.8MB/s 07:26 ETA
Corrupted MAC on input.
Disconnecting: Packet corrupt
lost connection
SCP initiated on server:
$ scp /export/no_backup/burn/openSUSE-12.2-DVD-x86_64.iso client:/tmp
Enter passphrase for key '/home/chewie/tessun/.ssh/id_rsa':
openSUSE-12.2-DVD-x86_64.iso
5% 229MB
7.0MB/s 10:00 ETA
Received disconnect from 2a01:198:366:100::fba5: 2: Packet corrupt
lost connection
ifconfig-output (Client):
RX packets:773481 errors:0 dropped:7620 overruns:0 frame:0
TX packets:589594 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 Sendewarteschlangenlänge:1000
RX bytes:596932088 (569.2 Mb) TX bytes:90583584 (86.3 Mb)
Interrupt:44
ifconfig-Output (Server):
RX packets:11579837 errors:0 dropped:0 overruns:0 frame:0
TX packets:19734057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2717120721 (2591.2 Mb) TX bytes:22047372376
(21026.0 Mb)
Interrupt:42 Base address:0xc000
As said: Other NICs than the Atheros work fine.
If you need additional Infos (tcpdumps, etc.) please let me know.
Regards,
Martin
^ permalink raw reply
* Re: [PATCH V2] xen/netfront: handle compound page fragments on transmit
From: Eric Dumazet @ 2012-11-21 15:13 UTC (permalink / raw)
To: Ian Campbell
Cc: netdev@vger.kernel.org, xen-devel@lists.xen.org, Eric Dumazet,
Konrad Rzeszutek Wilk, ANNIE LI, Sander Eikelenboom, Stefan Bader
In-Reply-To: <1353499727.13542.137.camel@zakaz.uk.xensource.com>
On Wed, 2012-11-21 at 12:08 +0000, Ian Campbell wrote:
> The max-frag related limitation comes from the "wire" protocol used
> between front and back. As it stands either the frontend or the backend
> is more than likely going to drop the sort of pathalogical skbs you are
> worried.
>
> I agree that this absolutely needs to be fixed in the protocol (and I've
> posted a call to arms on this topic on xen-devel) but I'd like to do it
> in a coordinated manner as part of a protocol extension (where the front
> and backend negotiate the maximum number of order-0 pages per Ethernet
> frame they are willing to handle) rather than as a side effect of this
> patch.
>
> So right now I don't want to introduce frontends which default to
> sending increased numbers of pages in to the wild, since that makes
> things more complex when we come to extend the protocol.
>
> Perhaps in the short term doing an skb_linearize when we hit this case
> would help, that will turn the pathalogical skb into a much more normal
> one. It'll be expensive but it should be rare. That assumes you can
> linearize such a large skb, which depends on the ability to allocate
> large order pages which isn't a given. Herm, maybe that doesn't work
> then.
>
First of all, thanks a lot for all these detailed informations.
This now makes sense !
> AFAIK we don't have an existing skb_foo operation which copies an skb,
> including (or only) the frags, with the side effect of aligning and
> coalescing them. Do we?
>
No, we only have the full linearize helper, and skb_try_coalesce()
helpers.
TCP stack uses an internal function to collapse several skbs so skbs
using a single page, I guess we could generalize this and make it
available to other uses.
Thanks !
^ permalink raw reply
* Re: [PATCH V3] xen/netfront: handle compound page fragments on transmit
From: Eric Dumazet @ 2012-11-21 15:13 UTC (permalink / raw)
To: Ian Campbell
Cc: netdev, xen-devel, Eric Dumazet, Konrad Rzeszutek Wilk, ANNIE LI,
Sander Eikelenboom, Stefan Bader
In-Reply-To: <1353499336-28952-1-git-send-email-ian.campbell@citrix.com>
On Wed, 2012-11-21 at 12:02 +0000, Ian Campbell wrote:
> An SKB paged fragment can consist of a compound page with order > 0.
> However the netchannel protocol deals only in PAGE_SIZE frames.
>
> Handle this in xennet_make_frags by iterating over the frames which
> make up the page.
>
> This is the netfront equivalent to 6a8ed462f16b for netback.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: netdev@vger.kernel.org
> Cc: xen-devel@lists.xen.org
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
> Cc: ANNIE LI <annie.li@oracle.com>
> Cc: Sander Eikelenboom <linux@eikelenboom.it>
> Cc: Stefan Bader <stefan.bader@canonical.com>
> ---
> v3: limit to 80-characters. Use net_alert_ratelimited.
> v2: check we have enough room in the ring and that the other end can
> cope with the number of slots in a single frame
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Re: [PATCH V3] xen/netfront: handle compound page fragments on transmit
From: Konrad Rzeszutek Wilk @ 2012-11-21 15:16 UTC (permalink / raw)
To: Ian Campbell, davem
Cc: netdev, xen-devel, Eric Dumazet, ANNIE LI, Sander Eikelenboom,
Stefan Bader
In-Reply-To: <1353499336-28952-1-git-send-email-ian.campbell@citrix.com>
On Wed, Nov 21, 2012 at 12:02:16PM +0000, Ian Campbell wrote:
> An SKB paged fragment can consist of a compound page with order > 0.
> However the netchannel protocol deals only in PAGE_SIZE frames.
>
> Handle this in xennet_make_frags by iterating over the frames which
> make up the page.
>
> This is the netfront equivalent to 6a8ed462f16b for netback.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: netdev@vger.kernel.org
> Cc: xen-devel@lists.xen.org
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
David, would you like me to send it to Linus via my tree or are you
OK sending him a git pull with this patch (and hopefully some other
ones?)
Thank you.
> Cc: ANNIE LI <annie.li@oracle.com>
> Cc: Sander Eikelenboom <linux@eikelenboom.it>
> Cc: Stefan Bader <stefan.bader@canonical.com>
> ---
> v3: limit to 80-characters. Use net_alert_ratelimited.
> v2: check we have enough room in the ring and that the other end can
> cope with the number of slots in a single frame
> ---
> drivers/net/xen-netfront.c | 98 ++++++++++++++++++++++++++++++++++---------
> 1 files changed, 77 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index caa0110..fc24eb9 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -452,29 +452,85 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
> /* Grant backend access to each skb fragment page. */
> for (i = 0; i < frags; i++) {
> skb_frag_t *frag = skb_shinfo(skb)->frags + i;
> + struct page *page = skb_frag_page(frag);
>
> - tx->flags |= XEN_NETTXF_more_data;
> + len = skb_frag_size(frag);
> + offset = frag->page_offset;
>
> - id = get_id_from_freelist(&np->tx_skb_freelist, np->tx_skbs);
> - np->tx_skbs[id].skb = skb_get(skb);
> - tx = RING_GET_REQUEST(&np->tx, prod++);
> - tx->id = id;
> - ref = gnttab_claim_grant_reference(&np->gref_tx_head);
> - BUG_ON((signed short)ref < 0);
> + /* Data must not cross a page boundary. */
> + BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
>
> - mfn = pfn_to_mfn(page_to_pfn(skb_frag_page(frag)));
> - gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id,
> - mfn, GNTMAP_readonly);
> + /* Skip unused frames from start of page */
> + page += offset >> PAGE_SHIFT;
> + offset &= ~PAGE_MASK;
>
> - tx->gref = np->grant_tx_ref[id] = ref;
> - tx->offset = frag->page_offset;
> - tx->size = skb_frag_size(frag);
> - tx->flags = 0;
> + while (len > 0) {
> + unsigned long bytes;
> +
> + BUG_ON(offset >= PAGE_SIZE);
> +
> + bytes = PAGE_SIZE - offset;
> + if (bytes > len)
> + bytes = len;
> +
> + tx->flags |= XEN_NETTXF_more_data;
> +
> + id = get_id_from_freelist(&np->tx_skb_freelist,
> + np->tx_skbs);
> + np->tx_skbs[id].skb = skb_get(skb);
> + tx = RING_GET_REQUEST(&np->tx, prod++);
> + tx->id = id;
> + ref = gnttab_claim_grant_reference(&np->gref_tx_head);
> + BUG_ON((signed short)ref < 0);
> +
> + mfn = pfn_to_mfn(page_to_pfn(page));
> + gnttab_grant_foreign_access_ref(ref,
> + np->xbdev->otherend_id,
> + mfn, GNTMAP_readonly);
> +
> + tx->gref = np->grant_tx_ref[id] = ref;
> + tx->offset = offset;
> + tx->size = bytes;
> + tx->flags = 0;
> +
> + offset += bytes;
> + len -= bytes;
> +
> + /* Next frame */
> + if (offset == PAGE_SIZE && len) {
> + BUG_ON(!PageCompound(page));
> + page++;
> + offset = 0;
> + }
> + }
> }
>
> np->tx.req_prod_pvt = prod;
> }
>
> +/*
> + * Count how many ring slots are required to send the frags of this
> + * skb. Each frag might be a compound page.
> + */
> +static int xennet_count_skb_frag_slots(struct sk_buff *skb)
> +{
> + int i, frags = skb_shinfo(skb)->nr_frags;
> + int pages = 0;
> +
> + for (i = 0; i < frags; i++) {
> + skb_frag_t *frag = skb_shinfo(skb)->frags + i;
> + unsigned long size = skb_frag_size(frag);
> + unsigned long offset = frag->page_offset;
> +
> + /* Skip unused frames from start of page */
> + offset &= ~PAGE_MASK;
> +
> + pages += PFN_UP(offset + size);
> + }
> +
> + return pages;
> +}
> +
> static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> unsigned short id;
> @@ -487,23 +543,23 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
> grant_ref_t ref;
> unsigned long mfn;
> int notify;
> - int frags = skb_shinfo(skb)->nr_frags;
> + int slots;
> unsigned int offset = offset_in_page(data);
> unsigned int len = skb_headlen(skb);
> unsigned long flags;
>
> - frags += DIV_ROUND_UP(offset + len, PAGE_SIZE);
> - if (unlikely(frags > MAX_SKB_FRAGS + 1)) {
> - printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n",
> - frags);
> - dump_stack();
> + slots = DIV_ROUND_UP(offset + len, PAGE_SIZE) +
> + xennet_count_skb_frag_slots(skb);
> + if (unlikely(slots > MAX_SKB_FRAGS + 1)) {
> + net_alert_ratelimited(
> + "xennet: skb rides the rocket: %d slots\n", slots);
> goto drop;
> }
>
> spin_lock_irqsave(&np->tx_lock, flags);
>
> if (unlikely(!netif_carrier_ok(dev) ||
> - (frags > 1 && !xennet_can_sg(dev)) ||
> + (slots > 1 && !xennet_can_sg(dev)) ||
> netif_needs_gso(skb, netif_skb_features(skb)))) {
> spin_unlock_irqrestore(&np->tx_lock, flags);
> goto drop;
> --
> 1.7.2.5
>
^ permalink raw reply
* [PATCH 1/1 v2] net: add micrel KSZ8873MLL switch support
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:38 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: netdev, Jean-Christophe PLAGNIOL-VILLARD
In-Reply-To: <1353493630-30867-1-git-send-email-plagnioj@jcrosoft.com>
this will allow to detect the link between the switch and the soc
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: netdev@vger.kernel.org
---
v2:
fix typo in the phy_driver name
Best Regards,
J.
drivers/net/phy/micrel.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/linux/micrel_phy.h | 1 +
2 files changed, 45 insertions(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 2165d5f..b983596 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -127,6 +127,39 @@ static int ks8051_config_init(struct phy_device *phydev)
return 0;
}
+#define KSZ8873MLL_GLOBAL_CONTROL_4 0x06
+#define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX (1 << 6)
+#define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED (1 << 4)
+int ksz8873mll_read_status(struct phy_device *phydev)
+{
+ int regval;
+
+ /* dummy read */
+ regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4);
+
+ regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4);
+
+ if (regval & KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX)
+ phydev->duplex = DUPLEX_HALF;
+ else
+ phydev->duplex = DUPLEX_FULL;
+
+ if (regval & KSZ8873MLL_GLOBAL_CONTROL_4_SPEED)
+ phydev->speed = SPEED_10;
+ else
+ phydev->speed = SPEED_100;
+
+ phydev->link = 1;
+ phydev->pause = phydev->asym_pause = 0;
+
+ return 0;
+}
+
+static int ksz8873mll_config_aneg(struct phy_device *phydev)
+{
+ return 0;
+}
+
static struct phy_driver ksphy_driver[] = {
{
.phy_id = PHY_ID_KS8737,
@@ -204,6 +237,16 @@ static struct phy_driver ksphy_driver[] = {
.ack_interrupt = kszphy_ack_interrupt,
.config_intr = ksz9021_config_intr,
.driver = { .owner = THIS_MODULE, },
+}, {
+ .phy_id = PHY_ID_KSZ8873MLL,
+ .phy_id_mask = 0x00fffff0,
+ .name = "Micrel KSZ8873MLL Switch",
+ .features = (SUPPORTED_Pause | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG,
+ .config_init = kszphy_config_init,
+ .config_aneg = ksz8873mll_config_aneg,
+ .read_status = ksz8873mll_read_status,
+ .driver = { .owner = THIS_MODULE, },
} };
static int __init ksphy_init(void)
@@ -232,6 +275,7 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] = {
{ PHY_ID_KSZ8021, 0x00ffffff },
{ PHY_ID_KSZ8041, 0x00fffff0 },
{ PHY_ID_KSZ8051, 0x00fffff0 },
+ { PHY_ID_KSZ8873MLL, 0x00fffff0 },
{ }
};
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index de20120..adfe8c0 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -15,6 +15,7 @@
#define MICREL_PHY_ID_MASK 0x00fffff0
+#define PHY_ID_KSZ8873MLL 0x000e7237
#define PHY_ID_KSZ9021 0x00221610
#define PHY_ID_KS8737 0x00221720
#define PHY_ID_KSZ8021 0x00221555
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH v2] checkpatch: add double empty line check
From: Eilon Greenstein @ 2012-11-21 15:45 UTC (permalink / raw)
To: Joe Perches; +Cc: Andy Whitcroft, David Rientjes, linux-kernel, netdev
In-Reply-To: <1353510075.24807.24.camel@joe-AO722>
On Wed, 2012-11-21 at 07:01 -0800, Joe Perches wrote:
> checkpatch isn't a perfect tool. Given how it's constructed,
> I doubt it ever could be.
Joe - I completely agree, this is why I'm not to concern about the
potential miss in the version I suggested.
Thanks,
Eilon
^ permalink raw reply
* pull request: wireless 2012-11-21
From: John W. Linville @ 2012-11-21 16:24 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 14415 bytes --]
commit 57a0c44fca179c27808a5f2fae718e7eab9d6243
Dave,
This is a batch of fixes intended for 3.7...
Included are two pulls. Regarding the mac80211 tree, Johannes says:
"Please pull my mac80211.git tree (see below) to get two more fixes for
3.7. Both fix regressions introduced *before* this cycle that weren't
noticed until now, one for IBSS not cleaning up properly and the other
to add back the "wireless" sysfs directory for Fedora's startup scripts."
Regarding the iwlwifi tree, Johannes says:
"Please also pull my iwlwifi.git tree, I have two fixes: one to remove a
spurious warning that can actually trigger in legitimate situations, and
the other to fix a regression from when monitor mode was changed to use
the "sniffer" firmware mode."
Also included is an nfc tree pull. Samuel says:
"We mostly have pn533 fixes here, 2 memory leaks and an early unlocking fix.
Moreover, we also have an LLCP adapter linked list insertion fix."
On top of that, a few more bits... Albert Pool adds a USB ID
to rtlwifi. Bing Zhao provides two mwifiex fixes -- one to fix
a system hang during a command timeout, and the other to properly
report a suspend error to the MMC core. Finally, Sujith Manoharan
fixes a thinko that would trigger an ath9k hang during device reset.
Please let me know if there are problems!
Thanks,
John
---
The following changes since commit aecb55be41b1bab432e81d550ebce010e7d178c6:
net: fix build failure in xilinx (2012-11-20 15:51:55 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem
for you to fetch changes up to 57a0c44fca179c27808a5f2fae718e7eab9d6243:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2012-11-21 10:42:23 -0500)
----------------------------------------------------------------
Albert Pool (1):
rtlwifi: rtl8192cu: Add new USB ID
Bing Zhao (2):
mwifiex: fix system hang issue in cmd timeout error case
mwifiex: report error to MMC core if we cannot suspend
Emmanuel Grumbach (1):
iwlwifi: don't WARN when a non empty queue is disabled
Johannes Berg (2):
iwlwifi: fix monitor mode FCS flag
wireless: add back sysfs directory
John W. Linville (4):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
Merge tag 'nfc-fixes-3.7-1' of git://git.kernel.org/.../sameo/nfc-3.0
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Simon Wunderlich (1):
mac80211: deinitialize ibss-internals after emptiness check
Sujith Manoharan (1):
ath9k_hw: Fix regression in device reset
Szymon Janc (2):
NFC: pn533: Fix missing lock while operating on commands list
NFC: pn533: Fix use after free
Thierry Escande (2):
NFC: Fix nfc_llcp_local chained list insertion
NFC: Fix pn533 target mode memory leak
Waldemar Rymarkiewicz (1):
NFC: pn533: Fix mem leak in pn533_in_dep_link_up
drivers/net/wireless/ath/ath9k/hw.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/mac80211.c | 14 ++++++++++++++
drivers/net/wireless/iwlwifi/pcie/tx.c | 8 --------
drivers/net/wireless/mwifiex/cmdevt.c | 11 ++++++++---
drivers/net/wireless/mwifiex/sdio.c | 11 ++++++-----
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
drivers/nfc/pn533.c | 25 ++++++++++++++-----------
net/core/net-sysfs.c | 20 ++++++++++++++++++++
net/mac80211/ibss.c | 8 ++++----
net/nfc/llcp/llcp.c | 2 +-
10 files changed, 69 insertions(+), 33 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8e1559a..1829b44 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1456,7 +1456,7 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
switch (type) {
case ATH9K_RESET_POWER_ON:
ret = ath9k_hw_set_reset_power_on(ah);
- if (!ret)
+ if (ret)
ah->reset_power_on = true;
break;
case ATH9K_RESET_WARM:
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index fa4d1b8..2d9eee9 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -1354,6 +1354,20 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
vif_priv->ctx = ctx;
ctx->vif = vif;
+ /*
+ * In SNIFFER device type, the firmware reports the FCS to
+ * the host, rather than snipping it off. Unfortunately,
+ * mac80211 doesn't (yet) provide a per-packet flag for
+ * this, so that we have to set the hardware flag based
+ * on the interfaces added. As the monitor interface can
+ * only be present by itself, and will be removed before
+ * other interfaces are added, this is safe.
+ */
+ if (vif->type == NL80211_IFTYPE_MONITOR)
+ priv->hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS;
+ else
+ priv->hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
+
err = iwl_setup_interface(priv, ctx);
if (!err || reset)
goto out;
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 105e3af..79a4ddc 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -480,20 +480,12 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
- u16 rd_ptr, wr_ptr;
- int n_bd = trans_pcie->txq[txq_id].q.n_bd;
if (!test_and_clear_bit(txq_id, trans_pcie->queue_used)) {
WARN_ONCE(1, "queue %d not used", txq_id);
return;
}
- rd_ptr = iwl_read_prph(trans, SCD_QUEUE_RDPTR(txq_id)) & (n_bd - 1);
- wr_ptr = iwl_read_prph(trans, SCD_QUEUE_WRPTR(txq_id));
-
- WARN_ONCE(rd_ptr != wr_ptr, "queue %d isn't empty: [%d,%d]",
- txq_id, rd_ptr, wr_ptr);
-
iwl_txq_set_inactive(trans, txq_id);
IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id);
}
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 8d46510..ae9010e 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -890,9 +890,6 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
return;
}
cmd_node = adapter->curr_cmd;
- if (cmd_node->wait_q_enabled)
- adapter->cmd_wait_q.status = -ETIMEDOUT;
-
if (cmd_node) {
adapter->dbg.timeout_cmd_id =
adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index];
@@ -938,6 +935,14 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n",
adapter->ps_mode, adapter->ps_state);
+
+ if (cmd_node->wait_q_enabled) {
+ adapter->cmd_wait_q.status = -ETIMEDOUT;
+ wake_up_interruptible(&adapter->cmd_wait_q.wait);
+ mwifiex_cancel_pending_ioctl(adapter);
+ /* reset cmd_sent flag to unblock new commands */
+ adapter->cmd_sent = false;
+ }
}
if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
mwifiex_init_fw_complete(adapter);
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index fc8a9bf..82cf0fa 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -161,7 +161,6 @@ static int mwifiex_sdio_suspend(struct device *dev)
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
mmc_pm_flag_t pm_flag = 0;
- int hs_actived = 0;
int i;
int ret = 0;
@@ -188,12 +187,14 @@ static int mwifiex_sdio_suspend(struct device *dev)
adapter = card->adapter;
/* Enable the Host Sleep */
- hs_actived = mwifiex_enable_hs(adapter);
- if (hs_actived) {
- pr_debug("cmd: suspend with MMC_PM_KEEP_POWER\n");
- ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+ if (!mwifiex_enable_hs(adapter)) {
+ dev_err(adapter->dev, "cmd: failed to suspend\n");
+ return -EFAULT;
}
+ dev_dbg(adapter->dev, "cmd: suspend with MMC_PM_KEEP_POWER\n");
+ ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+
/* Indicate device suspended */
adapter->is_suspended = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 9970c2b..b7e6607 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -297,6 +297,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
/*=== Customer ID ===*/
/****** 8188CU ********/
{RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/
+ {RTL_USB_DEVICE(0x050d, 0x11f2, rtl92cu_hal_cfg)}, /*Belkin - ISY*/
{RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 97c440a..30ae18a 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -698,13 +698,14 @@ static void pn533_wq_cmd(struct work_struct *work)
cmd = list_first_entry(&dev->cmd_queue, struct pn533_cmd, queue);
+ list_del(&cmd->queue);
+
mutex_unlock(&dev->cmd_lock);
__pn533_send_cmd_frame_async(dev, cmd->out_frame, cmd->in_frame,
cmd->in_frame_len, cmd->cmd_complete,
cmd->arg, cmd->flags);
- list_del(&cmd->queue);
kfree(cmd);
}
@@ -1678,11 +1679,14 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev,
static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
u8 *params, int params_len)
{
- struct pn533_cmd_jump_dep *cmd;
struct pn533_cmd_jump_dep_response *resp;
struct nfc_target nfc_target;
u8 target_gt_len;
int rc;
+ struct pn533_cmd_jump_dep *cmd = (struct pn533_cmd_jump_dep *)arg;
+ u8 active = cmd->active;
+
+ kfree(arg);
if (params_len == -ENOENT) {
nfc_dev_dbg(&dev->interface->dev, "");
@@ -1704,7 +1708,6 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
}
resp = (struct pn533_cmd_jump_dep_response *) params;
- cmd = (struct pn533_cmd_jump_dep *) arg;
rc = resp->status & PN533_CMD_RET_MASK;
if (rc != PN533_CMD_RET_SUCCESS) {
nfc_dev_err(&dev->interface->dev,
@@ -1734,7 +1737,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
if (rc == 0)
rc = nfc_dep_link_is_up(dev->nfc_dev,
dev->nfc_dev->targets[0].idx,
- !cmd->active, NFC_RF_INITIATOR);
+ !active, NFC_RF_INITIATOR);
return 0;
}
@@ -1819,12 +1822,8 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
rc = pn533_send_cmd_frame_async(dev, dev->out_frame, dev->in_frame,
dev->in_maxlen, pn533_in_dep_link_up_complete,
cmd, GFP_KERNEL);
- if (rc)
- goto out;
-
-
-out:
- kfree(cmd);
+ if (rc < 0)
+ kfree(cmd);
return rc;
}
@@ -2078,8 +2077,12 @@ error:
static int pn533_tm_send_complete(struct pn533 *dev, void *arg,
u8 *params, int params_len)
{
+ struct sk_buff *skb_out = arg;
+
nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
+ dev_kfree_skb(skb_out);
+
if (params_len < 0) {
nfc_dev_err(&dev->interface->dev,
"Error %d when sending data",
@@ -2117,7 +2120,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
rc = pn533_send_cmd_frame_async(dev, out_frame, dev->in_frame,
dev->in_maxlen, pn533_tm_send_complete,
- NULL, GFP_KERNEL);
+ skb, GFP_KERNEL);
if (rc) {
nfc_dev_err(&dev->interface->dev,
"Error %d when trying to send data", rc);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index bcf02f6..017a8ba 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -429,6 +429,17 @@ static struct attribute_group netstat_group = {
.name = "statistics",
.attrs = netstat_attrs,
};
+
+#if IS_ENABLED(CONFIG_WIRELESS_EXT) || IS_ENABLED(CONFIG_CFG80211)
+static struct attribute *wireless_attrs[] = {
+ NULL
+};
+
+static struct attribute_group wireless_group = {
+ .name = "wireless",
+ .attrs = wireless_attrs,
+};
+#endif
#endif /* CONFIG_SYSFS */
#ifdef CONFIG_RPS
@@ -1409,6 +1420,15 @@ int netdev_register_kobject(struct net_device *net)
groups++;
*groups++ = &netstat_group;
+
+#if IS_ENABLED(CONFIG_WIRELESS_EXT) || IS_ENABLED(CONFIG_CFG80211)
+ if (net->ieee80211_ptr)
+ *groups++ = &wireless_group;
+#if IS_ENABLED(CONFIG_WIRELESS_EXT)
+ else if (net->wireless_handlers)
+ *groups++ = &wireless_group;
+#endif
+#endif
#endif /* CONFIG_SYSFS */
error = device_add(dev);
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index bf87c70..c21e33d 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1151,10 +1151,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
mutex_lock(&sdata->u.ibss.mtx);
- sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
- memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
- sdata->u.ibss.ssid_len = 0;
-
active_ibss = ieee80211_sta_active_ibss(sdata);
if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
@@ -1175,6 +1171,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
}
}
+ ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
+ memset(ifibss->bssid, 0, ETH_ALEN);
+ ifibss->ssid_len = 0;
+
sta_info_flush(sdata->local, sdata);
spin_lock_bh(&ifibss->incomplete_lock);
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index cc10d07..9e8f4b2 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -1210,7 +1210,7 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
local->remote_miu = LLCP_DEFAULT_MIU;
local->remote_lto = LLCP_DEFAULT_LTO;
- list_add(&llcp_devices, &local->list);
+ list_add(&local->list, &llcp_devices);
return 0;
}
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related
* Re: pull request: wireless 2012-11-21
From: David Miller @ 2012-11-21 16:49 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20121121162406.GA2066@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Wed, 21 Nov 2012 11:24:06 -0500
> Included are two pulls. Regarding the mac80211 tree, Johannes says:
>
> "Please pull my mac80211.git tree (see below) to get two more fixes for
> 3.7. Both fix regressions introduced *before* this cycle that weren't
> noticed until now, one for IBSS not cleaning up properly and the other
> to add back the "wireless" sysfs directory for Fedora's startup scripts."
>
> Regarding the iwlwifi tree, Johannes says:
>
> "Please also pull my iwlwifi.git tree, I have two fixes: one to remove a
> spurious warning that can actually trigger in legitimate situations, and
> the other to fix a regression from when monitor mode was changed to use
> the "sniffer" firmware mode."
>
> Also included is an nfc tree pull. Samuel says:
>
> "We mostly have pn533 fixes here, 2 memory leaks and an early unlocking fix.
> Moreover, we also have an LLCP adapter linked list insertion fix."
>
> On top of that, a few more bits... Albert Pool adds a USB ID
> to rtlwifi. Bing Zhao provides two mwifiex fixes -- one to fix
> a system hang during a command timeout, and the other to properly
> report a suspend error to the MMC core. Finally, Sujith Manoharan
> fixes a thinko that would trigger an ath9k hang during device reset.
Pulled, thanks John.
^ permalink raw reply
* Re: [PATCH V3] xen/netfront: handle compound page fragments on transmit
From: David Miller @ 2012-11-21 16:49 UTC (permalink / raw)
To: konrad
Cc: ian.campbell, netdev, xen-devel, edumazet, annie.li, linux,
stefan.bader
In-Reply-To: <20121121151625.GA13127@konrad-lan.dumpdata.com>
From: Konrad Rzeszutek Wilk <konrad@kernel.org>
Date: Wed, 21 Nov 2012 10:16:27 -0500
> On Wed, Nov 21, 2012 at 12:02:16PM +0000, Ian Campbell wrote:
>> An SKB paged fragment can consist of a compound page with order > 0.
>> However the netchannel protocol deals only in PAGE_SIZE frames.
>>
>> Handle this in xennet_make_frags by iterating over the frames which
>> make up the page.
>>
>> This is the netfront equivalent to 6a8ed462f16b for netback.
>>
>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>> Cc: netdev@vger.kernel.org
>> Cc: xen-devel@lists.xen.org
>> Cc: Eric Dumazet <edumazet@google.com>
>> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
>
> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> David, would you like me to send it to Linus via my tree or are you
> OK sending him a git pull with this patch (and hopefully some other
> ones?)
I'll merge this to Linus via my net tree, thanks.
^ permalink raw reply
* Re: [PATCH net-2.6] bonding: Bonding driver does not consider the gso_max_size/gso_max_segs setting of slave devices.
From: David Miller @ 2012-11-21 16:51 UTC (permalink / raw)
To: eric.dumazet; +Cc: sarveshwar.bandi, netdev
In-Reply-To: <1353509706.2590.33.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 21 Nov 2012 06:55:06 -0800
> On Wed, 2012-11-21 at 20:05 +0530, sarveshwar.bandi@emulex.com wrote:
>> From: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
>>
>> Patch sets the lowest gso_max_size and gso_max_segs values of the slave devices during enslave and detach.
>>
>> Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
...
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply
* Re: [patch net] team: bcast: convert return value of team_dev_queue_xmit() to bool correctly
From: David Miller @ 2012-11-21 16:55 UTC (permalink / raw)
To: jiri; +Cc: netdev, dan.carpenter
In-Reply-To: <20121121125328.GA6812@minipsycho.orion>
From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 21 Nov 2012 13:53:28 +0100
>
> I forgot to mention this bug was introduced by:
> team: add broadcast mode (5fc889911a99043a97da1daa0d010ad72cbc3042)
>
> Wed, Nov 21, 2012 at 01:34:45PM CET, jiri@resnulli.us wrote:
>>The thing is that team_dev_queue_xmit() returns NET_XMIT_* or -E*.
>>bc_trasmit() should return true in case all went well. So use ! to get
>>correct retval from team_dev_queue_xmit() result.
>>This bug caused iface statistics to be badly computed.
>>
>>Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>Signed-off-by: Jiri Pirko <jiri@resnulli.us>
I incorporated the reference to the bug introducing commit and
applied this patch, thanks.
^ permalink raw reply
* Re: 8139cp: set ring address before enabling receiver
From: David Woodhouse @ 2012-11-21 16:57 UTC (permalink / raw)
To: Jason Wang; +Cc: David S. Miller, netdev, Jeff Garzik
In-Reply-To: <20120602235020.2C0A57C006C@ra.kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2601 bytes --]
On Sat, 2012-06-02 at 23:50 +0000, Linux Kernel Mailing List wrote:
> Gitweb: http://git.kernel.org/linus/;a=commit;h=b01af4579ec41f48e9b9c774e70bd6474ad210db
> Commit: b01af4579ec41f48e9b9c774e70bd6474ad210db
> Parent: 20e2a86485967c385d7c7befc1646e4d1d39362e
> Author: Jason Wang <jasowang@redhat.com>
> AuthorDate: Thu May 31 18:19:39 2012 +0000
> Committer: David S. Miller <davem@davemloft.net>
> CommitDate: Fri Jun 1 14:22:11 2012 -0400
>
> 8139cp: set ring address before enabling receiver
>
> Currently, we enable the receiver before setting the ring address which could
> lead the card DMA into unexpected areas. Solving this by set the ring address
> before enabling the receiver.
>
> btw. I find and test this in qemu as I didn't have a 8139cp card in hand. please
> review it carefully.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit appears to break Ethernet on my Traverse Geos router. With
OpenWRT and 3.6.6 I get:
[ 124.068359] NETDEV WATCHDOG: eth1 (8139cp): transmit queue 0 timed out
...
[ 124.260614] 8139cp 0000:00:0b.0: eth1: Transmit timeout, status c 2b 1 80ac
If I add code to *read* the *RingAddr registers, at the later point in
cp_init_hw() that they *used* to be set, I get the following:
[ 1126.909193] HiTxRingAddr 0000000000000000 (should be 0)
[ 1126.913880] RxRingAddr 000000000f1e5000 (sb f1e5000)
[ 1126.919018] TxRingAddr 000000000f344400 (sb f1e5400)
Adding further debugging indicates that it's being changed in
cp_start_hw(), at the line which writes the CpCmd register. These two
outputs are from the surrounding lines...
[ 1331.650579] at line 960 TxRingAddr 000000000f3c6400 (sb f3c6400)
[ 1331.656820] at line 962 TxRingAddr 000000000f3e4400 (sb f3c6400)
The devices are:
00:0a.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ [10ec:8139] (rev 20)
00:0b.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ [10ec:8139] (rev 20)
The other one (eth0) isn't connected, which is why I only see the errors
from eth1.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
^ permalink raw reply
* Re: [net-next 06/10] ixgbe: eliminate Smatch warnings in ixgbe_debugfs.c
From: David Miller @ 2012-11-21 17:04 UTC (permalink / raw)
To: dan.carpenter; +Cc: jeffrey.t.kirsher, joshua.a.hay, netdev, gospo, sassmann
In-Reply-To: <20121121110409.GG6186@mwanda>
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 21 Nov 2012 14:04:09 +0300
> On Wed, Nov 21, 2012 at 02:47:32AM -0800, Jeff Kirsher wrote:
>> + len = simple_write_to_buffer(ixgbe_dbg_reg_ops_buf,
>> + sizeof(ixgbe_dbg_reg_ops_buf)-1,
>> + ppos,
>> + buffer,
>> + count);
>> + if (len < 0)
>> + return -EFAULT;
>
> Any negative return is bad.
>
> if (len)
> return len;
...
>> @@ -187,15 +196,15 @@ static ssize_t ixgbe_dbg_netdev_ops_write(struct file *filp,
...
>> + if (len < 0)
>> + return -EFAULT;
>
> Same.
Agreed.
^ 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