* [PATCH v2 2/6] net: MOXA ART: connect to PHY
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>
The kernel now has a MDIO bus driver and a phy_driver (RTL8201CP),
connect to this PHY using OF.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Thanks for reviewing!
Changes since v1:
1. split ethtool support to separate patch
2. changes to devicetree binding document
3. add moxart_mac_update_duplex()
4. compare previous link state/speed/duplex on link adjust
5. use of_get_phy_mode() not PHY_INTERFACE_MODE_MII
6. bail on of_parse_phandle() failure
7. remove "if (!priv->phy_dev) return -ENODEV;"
moxart_do_ioctl()
8. remove "if (priv->phy_dev)"
moxart_mac_open(), moxart_mac_stop()
Applies to next-20131125
.../devicetree/bindings/net/moxa,moxart-mac.txt | 47 ++++++++++-
drivers/net/ethernet/moxa/moxart_ether.c | 92 +++++++++++++++++++++-
drivers/net/ethernet/moxa/moxart_ether.h | 2 +
3 files changed, 138 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt b/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
index 583418b..56f0374 100644
--- a/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
+++ b/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
@@ -1,21 +1,64 @@
MOXA ART Ethernet Controller
+Integrated MDIO bus node:
+
+- compatible: "moxa,moxart-mdio"
+- Inherets from MDIO bus node binding[1]
+
+[1] Documentation/devicetree/bindings/net/phy.txt
+
+
+Ethernet node:
+
Required properties:
- compatible : Must be "moxa,moxart-mac"
- reg : Should contain register location and length
- interrupts : Should contain the mac interrupt number
+Optional Properties:
+
+- phy-handle : the phandle to a PHY node
+
+
Example:
+ mdio0: mdio@90900090 {
+ compatible = "moxa,moxart-mdio";
+ reg = <0x90900090 0x8>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethphy0: ethernet-phy@1 {
+ device_type = "ethernet-phy";
+ compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+ };
+
+ mdio1: mdio@92000090 {
+ compatible = "moxa,moxart-mdio";
+ reg = <0x92000090 0x8>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethphy1: ethernet-phy@1 {
+ device_type = "ethernet-phy";
+ compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+ };
+
mac0: mac@90900000 {
compatible = "moxa,moxart-mac";
- reg = <0x90900000 0x100>;
+ reg = <0x90900000 0x90>;
interrupts = <25 0>;
+ phy-handle = <ðphy0>;
};
mac1: mac@92000000 {
compatible = "moxa,moxart-mac";
- reg = <0x92000000 0x100>;
+ reg = <0x92000000 0x90>;
interrupts = <27 0>;
+ phy-handle = <ðphy1>;
};
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 3c14afd..1b87034 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -26,6 +26,9 @@
#include <linux/of_irq.h>
#include <linux/crc32.h>
#include <linux/crc32c.h>
+#include <linux/phy.h>
+#include <linux/of_mdio.h>
+#include <linux/of_net.h>
#include "moxart_ether.h"
@@ -61,6 +64,16 @@ static int moxart_set_mac_address(struct net_device *ndev, void *addr)
return 0;
}
+static int moxart_do_ioctl(struct net_device *ndev, struct ifreq *ir, int cmd)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ if (!netif_running(ndev))
+ return -EINVAL;
+
+ return phy_mii_ioctl(priv->phy_dev, ir, cmd);
+}
+
static void moxart_mac_free_memory(struct net_device *ndev)
{
struct moxart_mac_priv_t *priv = netdev_priv(ndev);
@@ -110,6 +123,19 @@ static void moxart_mac_enable(struct net_device *ndev)
writel(priv->reg_maccr, priv->base + REG_MAC_CTRL);
}
+static void moxart_mac_update_duplex(struct net_device *ndev)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ priv->reg_maccr &= ~(FULLDUP | ENRX_IN_HALFTX);
+ if (priv->duplex)
+ priv->reg_maccr |= FULLDUP;
+ else
+ priv->reg_maccr |= ENRX_IN_HALFTX;
+
+ writel(priv->reg_maccr, priv->base + REG_MAC_CTRL);
+}
+
static void moxart_mac_setup_desc_ring(struct net_device *ndev)
{
struct moxart_mac_priv_t *priv = netdev_priv(ndev);
@@ -169,6 +195,9 @@ static int moxart_mac_open(struct net_device *ndev)
moxart_update_mac_address(ndev);
moxart_mac_setup_desc_ring(ndev);
moxart_mac_enable(ndev);
+
+ phy_start(priv->phy_dev);
+
netif_start_queue(ndev);
netdev_dbg(ndev, "%s: IMR=0x%x, MACCR=0x%x\n",
@@ -184,6 +213,8 @@ static int moxart_mac_stop(struct net_device *ndev)
napi_disable(&priv->napi);
+ phy_stop(priv->phy_dev);
+
netif_stop_queue(ndev);
/* disable all interrupts */
@@ -429,12 +460,49 @@ static struct net_device_ops moxart_netdev_ops = {
.ndo_set_mac_address = moxart_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = eth_change_mtu,
+ .ndo_do_ioctl = moxart_do_ioctl,
};
+static void moxart_adjust_link(struct net_device *ndev)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+ unsigned long flags;
+ int status_change = 0;
+
+ if (priv->phy_dev->link) {
+ if (priv->speed != priv->phy_dev->speed) {
+ priv->speed = priv->phy_dev->speed;
+ status_change = 1;
+ }
+
+ if (priv->duplex != priv->phy_dev->duplex) {
+ spin_lock_irqsave(&priv->txlock, flags);
+
+ priv->duplex = priv->phy_dev->duplex;
+ moxart_mac_update_duplex(ndev);
+
+ spin_unlock_irqrestore(&priv->txlock, flags);
+ status_change = 1;
+ }
+ }
+
+ if (priv->link != priv->phy_dev->link) {
+ if (!priv->phy_dev->link) {
+ priv->speed = 0;
+ priv->duplex = -1;
+ }
+ priv->link = priv->phy_dev->link;
+ status_change = 1;
+ }
+
+ if (status_change)
+ phy_print_status(priv->phy_dev);
+}
+
static int moxart_mac_probe(struct platform_device *pdev)
{
struct device *p_dev = &pdev->dev;
- struct device_node *node = p_dev->of_node;
+ struct device_node *node = p_dev->of_node, *phy_node;
struct net_device *ndev;
struct moxart_mac_priv_t *priv;
struct resource *res;
@@ -455,6 +523,28 @@ static int moxart_mac_probe(struct platform_device *pdev)
priv = netdev_priv(ndev);
priv->ndev = ndev;
+ priv->link = 0;
+ priv->speed = 0;
+ priv->duplex = -1;
+
+ phy_node = of_parse_phandle(node, "phy-handle", 0);
+ if (!phy_node) {
+ dev_err(p_dev, "of_parse_phandle failed\n");
+ ret = -ENODEV;
+ goto init_fail;
+ }
+
+ if (phy_node) {
+ priv->phy_dev = of_phy_connect(priv->ndev, phy_node,
+ &moxart_adjust_link,
+ 0, of_get_phy_mode(node));
+ if (!priv->phy_dev) {
+ dev_err(p_dev, "of_phy_connect failed\n");
+ ret = -ENODEV;
+ goto init_fail;
+ }
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ndev->base_addr = res->start;
priv->base = devm_ioremap_resource(p_dev, res);
diff --git a/drivers/net/ethernet/moxa/moxart_ether.h b/drivers/net/ethernet/moxa/moxart_ether.h
index 2be9280..b8877bf 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.h
+++ b/drivers/net/ethernet/moxa/moxart_ether.h
@@ -297,6 +297,8 @@ struct moxart_mac_priv_t {
unsigned int reg_imr;
struct napi_struct napi;
struct net_device *ndev;
+ struct phy_device *phy_dev;
+ int speed, duplex, link;
dma_addr_t rx_base;
dma_addr_t rx_mapping[RX_DESC_NUM];
--
1.8.2.1
^ permalink raw reply related
* [PATCH v2 1/6] net: MOXA ART: clear TX descriptor length bits between sends
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
Add TX_DESC1_BUF_SIZE_MASK to bits that are cleared, before the TX buffer
length is set. Failing to do so can cause the controller to drop dead
i.e. all TX interrupts stop, resulting in complete communication failure.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Applies to next-20131125
drivers/net/ethernet/moxa/moxart_ether.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index cbd0133..3c14afd 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -349,7 +349,8 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
txdes1 = readl(desc + TX_REG_OFFSET_DESC1);
txdes1 |= TX_DESC1_LTS | TX_DESC1_FTS;
- txdes1 &= ~(TX_DESC1_FIFO_COMPLETE | TX_DESC1_INTR_COMPLETE);
+ txdes1 &= ~(TX_DESC1_FIFO_COMPLETE | TX_DESC1_INTR_COMPLETE |
+ TX_DESC1_BUF_SIZE_MASK);
txdes1 |= (len & TX_DESC1_BUF_SIZE_MASK);
writel(txdes1, desc + TX_REG_OFFSET_DESC1);
writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0);
--
1.8.2.1
^ permalink raw reply related
* Re: [PATCH] sit: use kfree_skb to replace dev_kfree_skb
From: Eric Dumazet @ 2013-11-25 14:58 UTC (permalink / raw)
To: Gao feng; +Cc: netdev
In-Reply-To: <1385371284-15105-1-git-send-email-gaofeng@cn.fujitsu.com>
On Mon, 2013-11-25 at 17:21 +0800, Gao feng wrote:
> In failure case, we should use kfree_skb not
> dev_kfree_skb to free skbuff, dev_kfree_skb
> is defined as consume_skb.
>
> Trace takes advantage of this point.
>
> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
> net/ipv6/sit.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Seems fine to me, thanks !
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Attention:
From: Mr. Ali Saeed @ 2013-11-25 14:00 UTC (permalink / raw)
Greetings,
I have a business proposal, please contact me for more info.
Best Regards
Mr. Ali Saeed
alioil.saeed@qq.com
--------------------------
INFO UGM: Saya alumni UGM!
http://ugm.ac.id/id/video/21-video.saya.alumni.ugm
^ permalink raw reply
* Re: [PATCH net-next] net: remove outdated comment for ipv4 and ipv6 protocol handler
From: Sergei Shtylyov @ 2013-11-25 13:44 UTC (permalink / raw)
To: baker.kernel, davem; +Cc: netdev
In-Reply-To: <1385365686-17804-1-git-send-email-baker.kernel@gmail.com>
Hello.
On 25-11-2013 11:48, baker.kernel@gmail.com wrote:
> From: Baker Zhang <Baker.kernel@gmail.com>
> since f9242b6b28d61295f2bf7e8adfb1060b382e5381,
Please also specify that commit's summary line in parens.
> there are not pretended hash tables for ipv4 or
> ipv6 protocol handler.
> Signed-off-by: Baker Zhang <Baker.kernel@gmail.com>
WBR, Sergei
^ permalink raw reply
* RE: [PATCH] net: sched: tbf: fix calculation of max_size
From: David Laight @ 2013-11-25 12:22 UTC (permalink / raw)
To: Yang Yingliang, Eric Dumazet; +Cc: netdev, davem, brouer, jpirko, jbrouer
In-Reply-To: <52933CC7.9070805@huawei.com>
> From: Yang Yingliang <yangyingliang@huawei.com>
>
> Current max_size is caluated from rate table. Now, the rate table
> has been replaced and it's wrong to caculate max_size based on this
> rate table. It can lead wrong calculation of max_size.
>
> The burst in kernel may be lower than user asked, because burst may gets
> some loss when transform it to buffer(E.g. "burst 40kb rate 30mbit/s")
> and it seems we cannot avoid this loss. And burst's value(max_size) based
> on rate table may be equal user asked. If a packet's length is max_size,
> this packet will be stalled in tbf_dequeue() because its length is above
> the burst in kernel so that it cannot get enough tokens. The max_size guards
> against enqueuing packet sizes above q->buffer "time" in tbf_enqueue().
Why not adjust the calculations so that the number of allocated tokens
can go negative?
So allow the transfer if the number of tokens is +ve and then subtract
the number needed for the message itself.
I think this would change the semantics of the configured 'burst' value
very slightly (to 'at least' from 'at most') but the average would still
be correct.
FWIW I've done similar rate limiters that run directly in units of 'time'.
The fact that system time advances automatically generates credit.
David
^ permalink raw reply
* [PATCH] net: sched: tbf: fix calculation of max_size
From: Yang Yingliang @ 2013-11-25 12:04 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem, brouer, jpirko, jbrouer
In-Reply-To: <5292C76E.1070701@huawei.com>
From: Yang Yingliang <yangyingliang@huawei.com>
Current max_size is caluated from rate table. Now, the rate table
has been replaced and it's wrong to caculate max_size based on this
rate table. It can lead wrong calculation of max_size.
The burst in kernel may be lower than user asked, because burst may gets
some loss when transform it to buffer(E.g. "burst 40kb rate 30mbit/s")
and it seems we cannot avoid this loss. And burst's value(max_size) based
on rate table may be equal user asked. If a packet's length is max_size,
this packet will be stalled in tbf_dequeue() because its length is above
the burst in kernel so that it cannot get enough tokens. The max_size guards
against enqueuing packet sizes above q->buffer "time" in tbf_enqueue().
This patch fixes the calculation of max_size by using psched_l2t_ns() and
q->buffer to recalculate burst(max_size).
Also, add support to get burst from userland directly. We can avoid loss
in byte-to-time transform by using burst directly. Iproute2 will need a
patch to send burst to kernel.
Suggested-by: Jesper Dangaard Brouer <jbrouer@redhat.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
include/uapi/linux/pkt_sched.h | 2 +
net/sched/sch_tbf.c | 110 ++++++++++++++++++++++++++---------------
2 files changed, 72 insertions(+), 40 deletions(-)
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 307f293..b5a0976 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -173,6 +173,8 @@ enum {
TCA_TBF_PTAB,
TCA_TBF_RATE64,
TCA_TBF_PRATE64,
+ TCA_TBF_BURST,
+ TCA_TBF_PBURST,
__TCA_TBF_MAX,
};
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index a609005..3d01bf0 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -281,8 +281,12 @@ static const struct nla_policy tbf_policy[TCA_TBF_MAX + 1] = {
[TCA_TBF_PTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
[TCA_TBF_RATE64] = { .type = NLA_U64 },
[TCA_TBF_PRATE64] = { .type = NLA_U64 },
+ [TCA_TBF_BURST] = { .type = NLA_U32 },
+ [TCA_TBF_PBURST] = { .type = NLA_U32 },
};
+#define MAX_PKT_LEN 65535
+
static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
{
int err;
@@ -292,7 +296,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
struct qdisc_rate_table *rtab = NULL;
struct qdisc_rate_table *ptab = NULL;
struct Qdisc *child = NULL;
- int max_size, n;
+ int max_size;
u64 rate64 = 0, prate64 = 0;
err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy);
@@ -304,38 +308,20 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
goto done;
qopt = nla_data(tb[TCA_TBF_PARMS]);
- rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]);
- if (rtab == NULL)
- goto done;
-
- if (qopt->peakrate.rate) {
- if (qopt->peakrate.rate > qopt->rate.rate)
- ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]);
- if (ptab == NULL)
- goto done;
+ if (qopt->rate.linklayer == TC_LINKLAYER_UNAWARE) {
+ rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]);
+ if (rtab) {
+ qdisc_put_rtab(rtab);
+ rtab = NULL;
+ }
}
-
- for (n = 0; n < 256; n++)
- if (rtab->data[n] > qopt->buffer)
- break;
- max_size = (n << qopt->rate.cell_log) - 1;
- if (ptab) {
- int size;
-
- for (n = 0; n < 256; n++)
- if (ptab->data[n] > qopt->mtu)
- break;
- size = (n << qopt->peakrate.cell_log) - 1;
- if (size < max_size)
- max_size = size;
+ if (qopt->peakrate.linklayer == TC_LINKLAYER_UNAWARE) {
+ ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]);
+ if (ptab) {
+ qdisc_put_rtab(ptab);
+ ptab = NULL;
+ }
}
- if (max_size < 0)
- goto done;
-
- if (max_size < psched_mtu(qdisc_dev(sch)))
- pr_warn_ratelimited("sch_tbf: burst %u is lower than device %s mtu (%u) !\n",
- max_size, qdisc_dev(sch)->name,
- psched_mtu(qdisc_dev(sch)));
if (q->qdisc != &noop_qdisc) {
err = fifo_set_limit(q->qdisc, qopt->limit);
@@ -357,30 +343,74 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
}
q->limit = qopt->limit;
q->mtu = PSCHED_TICKS2NS(qopt->mtu);
- q->max_size = max_size;
q->buffer = PSCHED_TICKS2NS(qopt->buffer);
q->tokens = q->buffer;
q->ptokens = q->mtu;
if (tb[TCA_TBF_RATE64])
rate64 = nla_get_u64(tb[TCA_TBF_RATE64]);
- psched_ratecfg_precompute(&q->rate, &rtab->rate, rate64);
- if (ptab) {
+ psched_ratecfg_precompute(&q->rate, &qopt->rate, rate64);
+ if (!q->rate.rate_bytes_ps)
+ goto unlock_done;
+
+ if (tb[TCA_TBF_BURST]) {
+ u32 burst = nla_get_u32(tb[TCA_TBF_BURST]);
+ q->buffer = psched_l2t_ns(&q->rate, burst);
+ max_size = min_t(u32, burst, MAX_PKT_LEN);
+ } else {
+ for (max_size = 0; max_size < MAX_PKT_LEN; max_size++)
+ if (psched_l2t_ns(&q->rate, max_size) > q->buffer)
+ break;
+ max_size--;
+ if (max_size < 0)
+ goto unlock_done;
+ }
+
+ if (qopt->peakrate.rate) {
+ int size = 0;
if (tb[TCA_TBF_PRATE64])
prate64 = nla_get_u64(tb[TCA_TBF_PRATE64]);
- psched_ratecfg_precompute(&q->peak, &ptab->rate, prate64);
+ psched_ratecfg_precompute(&q->peak, &qopt->peakrate, prate64);
+ if (q->peak.rate_bytes_ps <= q->rate.rate_bytes_ps) {
+ pr_err("Rate must be lower than peakrate!\n");
+ goto unlock_done;
+ }
+
+ if (tb[TCA_TBF_PBURST]) {
+ u32 pburst = nla_get_u32(tb[TCA_TBF_PBURST]);
+ q->mtu = psched_l2t_ns(&q->peak, pburst);
+ size = min_t(u32, pburst, MAX_PKT_LEN);
+ } else {
+ for (size = 0; size < MAX_PKT_LEN; size++)
+ if (psched_l2t_ns(&q->peak, size) > q->mtu)
+ break;
+ size--;
+ if (size < 0)
+ goto unlock_done;
+ }
+ max_size = min_t(u32, max_size, size);
q->peak_present = true;
} else {
q->peak_present = false;
}
+ if (!max_size)
+ goto unlock_done;
+
+ if (max_size < psched_mtu(qdisc_dev(sch)))
+ pr_warn_ratelimited("sch_tbf: burst %u is lower than device %s mtu (%u) !\n",
+ max_size, qdisc_dev(sch)->name,
+ psched_mtu(qdisc_dev(sch)));
+
+ q->max_size = max_size;
+
sch_tree_unlock(sch);
- err = 0;
+ return 0;
+
+unlock_done:
+ sch_tree_unlock(sch);
+ err = -EINVAL;
done:
- if (rtab)
- qdisc_put_rtab(rtab);
- if (ptab)
- qdisc_put_rtab(ptab);
return err;
}
-- 1.8.0
^ permalink raw reply related
* support
From: Augusto Duncan @ 2013-11-23 21:54 UTC (permalink / raw)
To: Guenter
In-Reply-To: <A67B160B0F7E4159995ECC776D5077E9@server2434eo>
Greetings Guenter
Our firm has discovered your mail on occupation site.
If you are interested in half-day job reply to dr.thorndike@daytime.in.ua
Enjoy,
Augusto Duncan
^ permalink raw reply
* Re: [PATCH net] macvtap: fix tx_dropped counting error
From: Michael S. Tsirkin @ 2013-11-25 11:50 UTC (permalink / raw)
To: Jason Wang; +Cc: davem, netdev, linux-kernel, Vlad Yasevich, Eric Dumazet
In-Reply-To: <1385371144-11071-1-git-send-email-jasowang@redhat.com>
On Mon, Nov 25, 2013 at 05:19:04PM +0800, Jason Wang wrote:
> After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
> (macvlan: lockless tx path), tx stat counter were converted to percpu stat
> structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the
> management won't notice the dropping packet in macvtap tx path.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Vlad Yasevich <vyasevic@redhat.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/net/macvtap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index dc76670..0605da8 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -744,7 +744,7 @@ err:
> rcu_read_lock();
> vlan = rcu_dereference(q->vlan);
> if (vlan)
> - vlan->dev->stats.tx_dropped++;
> + this_cpu_inc(vlan->pcpu_stats->tx_dropped);
> rcu_read_unlock();
>
> return err;
> --
> 1.8.3.2
^ permalink raw reply
* Re: [PATCH] rebalance locks by converting write_lock_bh towrite_lock+local_bh_disable
From: Nicholas Mc Guire @ 2013-11-25 10:37 UTC (permalink / raw)
To: David Laight; +Cc: David Miller, kuznet, eric.dumazet, roque, peterz, netdev
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7441@saturn3.aculab.com>
On Mon, 25 Nov 2013, David Laight wrote:
> > in one of the cases I do not understand the intent behind the split:
> > in net/core/sock.c:lock_sock_fast
> >
> > spin_lock_bh(&sk->sk_lock.slock);
> > ...
> > spin_unlock(&sk->sk_lock.slock);
> > /*
> > * The sk_lock has mutex_lock() semantics here:
> > */
> > mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
> > local_bh_enable();
> >
> > I think that
> >
> > spin_lock_bh(&sk->sk_lock.slock);
> > ...
> > /*
> > * The sk_lock has mutex_lock() semantics here:
> > */
> > mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
> > spin_unlock_bh(&sk->sk_lock.slock);
> >
> > should be equivalent ?
>
> You've added a lock ordering that wasn't there before.
> Also I suspect that mutex_acquire() might be allowed to sleep,
> whereas you shouldn't sleep with a spin lock held.
>
mutex_acquire is not a lock but a lockdep entry.
As far as I understand it it nither can sleep nor is there a change of
order here. Am I missing something ?
thx!
hofrat
^ permalink raw reply
* Re: [PATCH 1/1] dccp: restore header formatting
From: David Miller @ 2013-11-25 9:51 UTC (permalink / raw)
To: gerrit; +Cc: netdev
In-Reply-To: <20131124191823.427c4a8a@liptov.cs.ualberta.ca>
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Date: Sun, 24 Nov 2013 19:18:23 -0700
> -int dccp_ackvec_init(void);
> +int dccp_ackvec_init(void);
This is absolutely not acceptable, there is no reason to have two spaces
between the return type and the function name.
^ permalink raw reply
* RE: [PATCH] rebalance locks by converting write_lock_bh towrite_lock+local_bh_disable
From: David Laight @ 2013-11-25 9:40 UTC (permalink / raw)
To: Nicholas Mc Guire, David Miller
Cc: kuznet, eric.dumazet, roque, peterz, netdev
In-Reply-To: <20131123235823.GA23670@opentech.at>
> in one of the cases I do not understand the intent behind the split:
> in net/core/sock.c:lock_sock_fast
>
> spin_lock_bh(&sk->sk_lock.slock);
> ...
> spin_unlock(&sk->sk_lock.slock);
> /*
> * The sk_lock has mutex_lock() semantics here:
> */
> mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
> local_bh_enable();
>
> I think that
>
> spin_lock_bh(&sk->sk_lock.slock);
> ...
> /*
> * The sk_lock has mutex_lock() semantics here:
> */
> mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
> spin_unlock_bh(&sk->sk_lock.slock);
>
> should be equivalent ?
You've added a lock ordering that wasn't there before.
Also I suspect that mutex_acquire() might be allowed to sleep,
whereas you shouldn't sleep with a spin lock held.
David
^ permalink raw reply
* [PATCH] sit: use kfree_skb to replace dev_kfree_skb
From: Gao feng @ 2013-11-25 9:21 UTC (permalink / raw)
To: netdev; +Cc: Gao feng
In failure case, we should use kfree_skb not
dev_kfree_skb to free skbuff, dev_kfree_skb
is defined as consume_skb.
Trace takes advantage of this point.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
net/ipv6/sit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 8435267..366fbba 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -951,7 +951,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
if (!new_skb) {
ip_rt_put(rt);
dev->stats.tx_dropped++;
- dev_kfree_skb(skb);
+ kfree_skb(skb);
return NETDEV_TX_OK;
}
if (skb->sk)
@@ -977,7 +977,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
tx_error_icmp:
dst_link_failure(skb);
tx_error:
- dev_kfree_skb(skb);
+ kfree_skb(skb);
out:
dev->stats.tx_errors++;
return NETDEV_TX_OK;
@@ -1017,7 +1017,7 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb,
tx_err:
dev->stats.tx_errors++;
- dev_kfree_skb(skb);
+ kfree_skb(skb);
return NETDEV_TX_OK;
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH net] macvtap: fix tx_dropped counting error
From: Jason Wang @ 2013-11-25 9:19 UTC (permalink / raw)
To: davem, netdev, linux-kernel
Cc: Jason Wang, Michael S. Tsirkin, Vlad Yasevich, Eric Dumazet
After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
(macvlan: lockless tx path), tx stat counter were converted to percpu stat
structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the
management won't notice the dropping packet in macvtap tx path.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Vlad Yasevich <vyasevic@redhat.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/macvtap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index dc76670..0605da8 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -744,7 +744,7 @@ err:
rcu_read_lock();
vlan = rcu_dereference(q->vlan);
if (vlan)
- vlan->dev->stats.tx_dropped++;
+ this_cpu_inc(vlan->pcpu_stats->tx_dropped);
rcu_read_unlock();
return err;
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH 1/4] bonding: L2DA mode added
From: Anton Nayshtut @ 2013-11-25 9:10 UTC (permalink / raw)
To: Nikolay Aleksandrov, Eric Dumazet
Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek, David S. Miller,
Cong Wang, Nicolas Schichan, Eric Dumazet,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Erez Kirshenbaum, Boris Lapshin
In-Reply-To: <528E28D7.4010306@redhat.com>
Eric, Nik, Andy,
Thanks for your comments.
I'll investigate the override option approach first, and then will
re-implement the patch using RCU with corresponding
Documentation/networking/bonding.txt changes, if still needed.
P.S. Sorry for delay with my reply. It was caused by personal reasons.
Best Regards,
Anton
On 21/11/2013 17:37, Nikolay Aleksandrov wrote:
> On 11/21/2013 04:32 PM, Eric Dumazet wrote:
>> On Thu, 2013-11-21 at 16:55 +0200, Anton Nayshtut wrote:
>>> This patches introduces L2DA bonding module with all the data structures and
>>> interfaces. It's not integrated yet.
>>
>> I veto any kind of new bonding mode not using RCU.
>>
>> Adding another rwlock in 2013 is simply not an option.
>>
>> Thanks
>>
>>
> +1
> Also,
> I haven't read the patch-set closely but based on the description in the first
> patch I think you can already get this (or very similar) functionality by using
> the slave override option in the bonding. You can match the destination L2
> address and override the slave based on that.
>
> Nik
>
^ permalink raw reply
* Re: FEC performance degradation on iMX28 with forced link media
From: Hector Palacios @ 2013-11-25 8:56 UTC (permalink / raw)
To: Marek Vasut; +Cc: netdev@vger.kernel.org, fabio.estevam@freescale.com
In-Reply-To: <201311240540.23813.marex@denx.de>
On 11/24/2013 05:40 AM, Marek Vasut wrote:
> Hi Hector,
>
>> Hello,
>>
>> When forcing the Ethernet PHY link media with ethtool/mii-tool on the
>> i.MX28 I've seen important performance degradation as the packet size
>> increases.
>>
>> On the target:
>> # mii-tool eth0 -F 10baseT-FD
>> # netpipe
>>
>> On the host:
>> # netpipe -h <target-ip> -n 1
>> ...
>> 44: 1024 bytes 1 times --> 6.56 Mbps in 1191.00 usec
>> 45: 1027 bytes 1 times --> 6.56 Mbps in 1193.52 usec
>> 46: 1533 bytes 1 times --> 0.60 Mbps in 19600.54 usec
>> 47: 1536 bytes 1 times --> 0.46 Mbps in 25262.52 usec
>> 48: 1539 bytes 1 times --> 0.57 Mbps in 20745.54 usec
>> 49: 2045 bytes 1 times --> 0.74 Mbps in 20971.95 usec
>> ...
>> On loop 46, as the packet size exceeds the MTU (1500) performance falls
>> from 6.56Mbps to 0.60Mbps.
>>
>> Going back to 100baseTX-FD, but still forced (autonegotiation off), the
>> same occurs: On the target:
>> # mii-tool eth0 -F 100baseTx-FD
>> # netpipe
>>
>> On the host:
>> # netpipe -h <target-ip> -n 1
>> ...
>> 58: 6141 bytes 1 times --> 39.74 Mbps in 1179.03 usec
>> 59: 6144 bytes 1 times --> 41.83 Mbps in 1120.51 usec
>> 60: 6147 bytes 1 times --> 41.39 Mbps in 1133.03 usec
>> 61: 8189 bytes 1 times --> 6.36 Mbps in 9823.94 usec
>> 62: 8192 bytes 1 times --> 6.56 Mbps in 9521.46 usec
>> 63: 8195 bytes 1 times --> 6.56 Mbps in 9532.99 usec
>> ...
>> only this time it happens with a larger packet size (8189 bytes).
>>
>> With autonegotiation on, performance is ok and does not suffer these drops.
>>
>> I've reproduced this on the mx28evk board but it also happens in my
>> hardware, with different PHY on v3.10.
>> I also tried on an old v2.6.35 kernel and the issue was reproducible as
>> well, though it happened with larger packet sizes than it happens with
>> v3.10:
>> ...
>> 75: 32771 bytes 1 times --> 49.64 Mbps in 5036.50 usec
>> 76: 49149 bytes 1 times --> 46.18 Mbps in 8120.48 usec
>> 77: 49152 bytes 1 times --> 43.30 Mbps in 8660.46 usec
>> 78: 49155 bytes 1 times --> 40.10 Mbps in 9351.46 usec
>> 79: 65533 bytes 1 times --> 2.03 Mbps in 246061.04 usec
>> 80: 65536 bytes 1 times --> 2.21 Mbps in 226516.50 usec
>> 81: 65539 bytes 1 times --> 1.45 Mbps in 344196.46 usec
>> ...
>>
>> Could there be any issue with packet fragmentation?
>> I tried the same on imx6sabresd but here the issue is not reproducible. I
>> don't know if the higher CPU frequency might be hiding the problem,
>> though.
>>
>> Any idea about what can make the difference between forcing media vs
>> autonegotiation?
>
> Let me ask, this might be unrelated, but I will still go ahead. Do you also
> observe packetloss? You can check with iperf:
>
> On host machine (PC): iperf -u -s -l 4M -i 60
> On target: iperf -u -c <hostip> -t 3600 -B 100M -i 60
Yes, with forced 100baseTX-FD there is a small packet loss:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0-60.0 sec 339 MBytes 47.4 Mbits/sec 0.075 ms 61/242070 (0.025%)
[ 3] 60.0-120.0 sec 339 MBytes 47.4 Mbits/sec 0.209 ms 45/242122 (0.019%)
[ 3] 120.0-180.0 sec 339 MBytes 47.5 Mbits/sec 0.084 ms 70/242237 (0.029%)
[ 3] 180.0-240.0 sec 339 MBytes 47.4 Mbits/sec 0.030 ms 80/241993 (0.033%)
[ 3] 240.0-300.0 sec 340 MBytes 47.5 Mbits/sec 0.042 ms 111/242363 (0.046%)
[ 3] 300.0-360.0 sec 339 MBytes 47.4 Mbits/sec 0.038 ms 93/241972 (0.038%)
[ 3] 360.0-420.0 sec 339 MBytes 47.5 Mbits/sec 0.030 ms 78/242214 (0.032%)
[ 3] 420.0-480.0 sec 339 MBytes 47.4 Mbits/sec 0.090 ms 77/241980 (0.032%)
[ 3] 480.0-540.0 sec 339 MBytes 47.4 Mbits/sec 0.025 ms 125/242058 (0.052%)
With autonegotiated 100baseTX-FD, there is not:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0-60.0 sec 336 MBytes 47.0 Mbits/sec 0.038 ms 0/239673 (0%)
[ 3] 60.0-120.0 sec 337 MBytes 47.1 Mbits/sec 0.078 ms 0/240353 (0%)
[ 3] 120.0-180.0 sec 337 MBytes 47.1 Mbits/sec 0.047 ms 0/240054 (0%)
[ 3] 180.0-240.0 sec 337 MBytes 47.1 Mbits/sec 0.038 ms 0/240195 (0%)
[ 3] 240.0-300.0 sec 337 MBytes 47.1 Mbits/sec 0.038 ms 0/240109 (0%)
[ 3] 300.0-360.0 sec 337 MBytes 47.1 Mbits/sec 0.035 ms 0/240101 (0%)
[ 3] 360.0-420.0 sec 337 MBytes 47.0 Mbits/sec 0.031 ms 0/240032 (0%)
[ 3] 420.0-480.0 sec 336 MBytes 47.0 Mbits/sec 0.036 ms 0/239912 (0%)
Best regards,
--
Hector Palacios
^ permalink raw reply
* bridge vlan filtering question
From: Mike Rapoport @ 2013-11-25 7:54 UTC (permalink / raw)
To: netdev
Hi all,
I'm trying to use brigde vlan filtering and I cannot get any traffic
through the bridge.
After looking at the code I've noticed that br_get_pvid is always
returning VLAN_N_VID because VLAN_TAG_PRESENT is never set in the pvid
field of net_port_vlans.
Am I missing something or is this an actual bug?
--
Sincerely yours,
Mike.
^ permalink raw reply
* [PATCH net-next] net: remove outdated comment for ipv4 and ipv6 protocol handler
From: baker.kernel @ 2013-11-25 7:48 UTC (permalink / raw)
To: davem; +Cc: netdev, Baker Zhang
From: Baker Zhang <Baker.kernel@gmail.com>
since f9242b6b28d61295f2bf7e8adfb1060b382e5381,
there are not pretended hash tables for ipv4 or
ipv6 protocol handler.
Signed-off-by: Baker Zhang <Baker.kernel@gmail.com>
---
inet_add_protocol/inet_del_protocol and inet6_del_protocol
are very simple in current version.
so I remove the outdated comment instead of fixing them,
just like inet6_add_protocol.
net/ipv4/protocol.c | 8 --------
net/ipv6/protocol.c | 4 ----
2 files changed, 12 deletions(-)
diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
index ce84846..46d6a1c 100644
--- a/net/ipv4/protocol.c
+++ b/net/ipv4/protocol.c
@@ -31,10 +31,6 @@
const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS] __read_mostly;
const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
-/*
- * Add a protocol handler to the hash tables
- */
-
int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
{
if (!prot->netns_ok) {
@@ -55,10 +51,6 @@ int inet_add_offload(const struct net_offload *prot, unsigned char protocol)
}
EXPORT_SYMBOL(inet_add_offload);
-/*
- * Remove a protocol from the hash tables.
- */
-
int inet_del_protocol(const struct net_protocol *prot, unsigned char protocol)
{
int ret;
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
index 22d1bd4..e048cf1 100644
--- a/net/ipv6/protocol.c
+++ b/net/ipv6/protocol.c
@@ -36,10 +36,6 @@ int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol
}
EXPORT_SYMBOL(inet6_add_protocol);
-/*
- * Remove a protocol from the hash tables.
- */
-
int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char protocol)
{
int ret;
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH] pipe_to_sendpage: Ensure that MSG_MORE is set if we set MSG_SENDPAGE_NOTLAST
From: Richard Weinberger @ 2013-11-25 7:42 UTC (permalink / raw)
To: Eric Dumazet
Cc: linux-kernel, linux-fsdevel, viro, shawnlandden, linux-crypto,
netdev, herbert, Tom Herbert, David S. Miller, stable
In-Reply-To: <1385342706.10637.125.camel@edumazet-glaptop2.roam.corp.google.com>
Am Sonntag, 24. November 2013, 17:25:06 schrieb Eric Dumazet:
> On Mon, 2013-11-25 at 00:42 +0100, Richard Weinberger wrote:
> > Commit 35f9c09fe (tcp: tcp_sendpages() should call tcp_push() once)
> > added an internal flag MSG_SENDPAGE_NOTLAST.
> > We have to ensure that MSG_MORE is also set if we set
> > MSG_SENDPAGE_NOTLAST.
> > Otherwise users that check against MSG_MORE will not see it.
> >
> > This fixes sendfile() on AF_ALG.
> >
> > Cc: Tom Herbert <therbert@google.com>
> > Cc: Eric Dumazet <eric.dumazet@gmail.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Cc: <stable@vger.kernel.org> # 3.4.x
> > Reported-and-tested-by: Shawn Landden <shawnlandden@gmail.com>
> > Signed-off-by: Richard Weinberger <richard@nod.at>
> > ---
> >
> > fs/splice.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/splice.c b/fs/splice.c
> > index 3b7ee65..b93f1b8 100644
> > --- a/fs/splice.c
> > +++ b/fs/splice.c
> > @@ -701,7 +701,7 @@ static int pipe_to_sendpage(struct pipe_inode_info
> > *pipe,>
> > more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0;
> >
> > if (sd->len < sd->total_len && pipe->nrbufs > 1)
> >
> > - more |= MSG_SENDPAGE_NOTLAST;
> > + more |= MSG_SENDPAGE_NOTLAST | MSG_MORE;
> >
> > return file->f_op->sendpage(file, buf->page, buf->offset,
> >
> > sd->len, &pos, more);
>
> I do not think this patch is right. It looks like a revert of a useful
> patch for TCP zero copy. Given the time it took to discover this
> regression, I bet tcp zero copy has more users than AF_ALG, by 5 or 6
> order of magnitude ;)
Yeah, but AF_ALG broke. That's why I did the patch.
> Here we want to make the difference between the two flags, not merge
> them.
>
> If AF_ALG do not care of the difference, try instead :
>
> diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
> index ef5356cd280a..850246206b12 100644
> --- a/crypto/algif_hash.c
> +++ b/crypto/algif_hash.c
> @@ -114,6 +114,9 @@ static ssize_t hash_sendpage(struct socket *sock, struct
> page *page, struct hash_ctx *ctx = ask->private;
> int err;
>
> + if (flags & MSG_SENDPAGE_NOTLAST)
> + flags |= MSG_MORE;
> +
In the commit message of your patch you wrote "For all sendpage() providers,
its a transparent change.". Why does AF_ALG need special handling?
If users have to care about MSG_SENDPAGE_NOTLAST it is no longer really an
internal flag.
Thanks,
//richard
^ permalink raw reply
* [PATCH] rds: prevent BUG_ON triggered on congestion update to loopback
From: Venkat Venkatsubra @ 2013-11-25 6:47 UTC (permalink / raw)
To: rds-devel
Cc: David S. Miller, netdev, Venkat Venkatsubra, Honggang Li,
Josh Hunt, Bang Nguyen
From: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
After congestion update on a local connection, when rds_ib_xmit returns
less bytes than that are there in the message, rds_send_xmit calls
back rds_ib_xmit with an offset that causes BUG_ON(off & RDS_FRAG_SIZE)
to trigger.
Reported-by: Josh Hunt <joshhunt00@gmail.com>
Tested-by: Honggang Li <honli@redhat.com>
Acked-by: Bang Nguyen <bang.nguyen@oracle.com>
Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/rds/ib_send.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index e590949..37be6e2 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -552,9 +552,8 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
&& rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
scat = &rm->data.op_sg[sg];
- ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
- ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
- return ret;
+ ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
+ return sizeof(struct rds_header) + ret;
}
/* FIXME we may overallocate here */
--
1.7.6
^ permalink raw reply related
* [PATCH] update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST
From: Shawn Landden @ 2013-11-25 6:36 UTC (permalink / raw)
To: Hannes Frederic Sowa
Cc: Eric Dumazet, linux-kernel, linux-fsdevel, viro, linux-crypto,
netdev, Herbert Xu, Tom Herbert, David S. Miller, stable,
Shawn Landden
In-Reply-To: <20131125042633.GA4156@order.stressinduktion.org>
Commit 35f9c09fe (tcp: tcp_sendpages() should call tcp_push() once)
added an internal flag MSG_SENDPAGE_NOTLAST, similar to
MSG_MORE.
algif_hash, algif_skcipher, and udp used MSG_MORE from tcp_sendpages()
and need to see the new flag as identical to MSG_MORE.
This fixes sendfile() on AF_ALG.
v3: also fix udp
Cc: Tom Herbert <therbert@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: <stable@vger.kernel.org> # 3.4.x + 3.2.x
Reported-and-tested-by: Shawn Landden <shawnlandden@gmail.com>
Original-patch: Richard Weinberger <richard@nod.at>
Signed-off-by: Shawn Landden <shawn@churchofgit.com>
---
crypto/algif_hash.c | 3 +++
crypto/algif_skcipher.c | 3 +++
net/ipv4/udp.c | 3 +++
3 files changed, 9 insertions(+)
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index ef5356c..8502462 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -114,6 +114,9 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page,
struct hash_ctx *ctx = ask->private;
int err;
+ if (flags & MSG_SENDPAGE_NOTLAST)
+ flags |= MSG_MORE;
+
lock_sock(sk);
sg_init_table(ctx->sgl.sg, 1);
sg_set_page(ctx->sgl.sg, page, size, offset);
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 6a6dfc0..a19c027 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -378,6 +378,9 @@ static ssize_t skcipher_sendpage(struct socket *sock, struct page *page,
struct skcipher_sg_list *sgl;
int err = -EINVAL;
+ if (flags & MSG_SENDPAGE_NOTLAST)
+ flags |= MSG_MORE;
+
lock_sock(sk);
if (!ctx->more && ctx->used)
goto unlock;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 5944d7d..8bd04df 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1098,6 +1098,9 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset,
struct udp_sock *up = udp_sk(sk);
int ret;
+ if (flags & MSG_SENDPAGE_NOTLAST)
+ flags |= MSG_MORE;
+
if (!up->pending) {
struct msghdr msg = { .msg_flags = flags|MSG_MORE };
--
1.8.4.4
^ permalink raw reply related
* [PATCH] phy: Add Vitesse 8514 phy ID
From: shh.xie @ 2013-11-25 4:40 UTC (permalink / raw)
To: linux-kernel, davem; +Cc: netdev, linuxppc-dev, Shaohui Xie
From: Shaohui Xie <Shaohui.Xie@freescale.com>
Phy is compatible with Vitesse 82xx
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
drivers/net/phy/vitesse.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 508e435..14372c6 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -64,6 +64,7 @@
#define PHY_ID_VSC8234 0x000fc620
#define PHY_ID_VSC8244 0x000fc6c0
+#define PHY_ID_VSC8514 0x00070670
#define PHY_ID_VSC8574 0x000704a0
#define PHY_ID_VSC8662 0x00070660
#define PHY_ID_VSC8221 0x000fc550
@@ -131,6 +132,7 @@ static int vsc82xx_config_intr(struct phy_device *phydev)
err = phy_write(phydev, MII_VSC8244_IMASK,
(phydev->drv->phy_id == PHY_ID_VSC8234 ||
phydev->drv->phy_id == PHY_ID_VSC8244 ||
+ phydev->drv->phy_id == PHY_ID_VSC8514 ||
phydev->drv->phy_id == PHY_ID_VSC8574) ?
MII_VSC8244_IMASK_MASK :
MII_VSC8221_IMASK_MASK);
@@ -246,6 +248,18 @@ static struct phy_driver vsc82xx_driver[] = {
.config_intr = &vsc82xx_config_intr,
.driver = { .owner = THIS_MODULE,},
}, {
+ .phy_id = PHY_ID_VSC8514,
+ .name = "Vitesse VSC8514",
+ .phy_id_mask = 0x000ffff0,
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = &vsc824x_config_init,
+ .config_aneg = &vsc82x4_config_aneg,
+ .read_status = &genphy_read_status,
+ .ack_interrupt = &vsc824x_ack_interrupt,
+ .config_intr = &vsc82xx_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+}, {
.phy_id = PHY_ID_VSC8574,
.name = "Vitesse VSC8574",
.phy_id_mask = 0x000ffff0,
@@ -315,6 +329,7 @@ module_exit(vsc82xx_exit);
static struct mdio_device_id __maybe_unused vitesse_tbl[] = {
{ PHY_ID_VSC8234, 0x000ffff0 },
{ PHY_ID_VSC8244, 0x000fffc0 },
+ { PHY_ID_VSC8514, 0x000ffff0 },
{ PHY_ID_VSC8574, 0x000ffff0 },
{ PHY_ID_VSC8662, 0x000ffff0 },
{ PHY_ID_VSC8221, 0x000ffff0 },
--
1.8.4.1
^ permalink raw reply related
* Re: [PATCH] update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST
From: Hannes Frederic Sowa @ 2013-11-25 4:26 UTC (permalink / raw)
To: Shawn Landden
Cc: Eric Dumazet, Linux Kernel Mailing List, linux-fsdevel, viro,
linux-crypto, netdev, Herbert Xu, Tom Herbert, David S. Miller,
stable
In-Reply-To: <1385345339-2184-1-git-send-email-shawn@churchofgit.com>
On Sun, Nov 24, 2013 at 06:08:59PM -0800, Shawn Landden wrote:
> Commit 35f9c09fe (tcp: tcp_sendpages() should call tcp_push() once)
> added an internal flag MSG_SENDPAGE_NOTLAST, similar to
> MSG_MORE.
>
> algif_hash and algif_skcipher used MSG_MORE from tcp_sendpages()
> and need to see the new flag as identical to MSG_MORE.
>
> This fixes sendfile() on AF_ALG.
Don't we need a similar fix for udp_sendpage?
Greetings,
Hannes
^ permalink raw reply
* Re: [PATCH net v3 1/2] net: sched: tbf: fix calculation of max_size
From: Yang Yingliang @ 2013-11-25 3:43 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem, brouer, jpirko, jbrouer
In-Reply-To: <1385318452.10637.116.camel@edumazet-glaptop2.roam.corp.google.com>
On 2013/11/25 2:40, Eric Dumazet wrote:
> On Sun, 2013-11-24 at 15:28 +0800, Yang Yingliang wrote:
>> O>
>>>> With the follow command:
>>>> tc qdisc add dev eth1 root handle 1: tbf latency 50ms burst 10KB rate 30gbit mtu 64k
>>>>
>>>
>> Ideally burst should be 10KB in kernel space.
>> But at hight rates, when burst is converted to
>> time in tick in userland, it gets much more loss
>> than low rates. So the burst can't actually
>> reach 10KB in kernel.
>
> If you think tc can help to fix user choices, please provide an
> iproute2 patch.
Unfortunately, it can't. It always has some loss when burst in bytes
is converted to buffer in ticks, we cannot avoid it, except we send burst
to kernel directly, this need to modify the code both in iproute2 and kernel.
>
> Quite frankly, using a burst of 10KB and a rate of 30gbit is simply a
> user error. It cannot possibly work. At all.
Yep, I agree it's a user error. But the error may cause network down, and
we have a way to avoid it, I think we should fix it. :)
>
> As stated in many tbf docs, burst must be larger than device mtu (1514)
>
> By extension, with GRO/GSO, burst should be larger than 68130, otherwise
> we need to segment the packets, and this is horribly expensive for high
> rates.
>
> I personally tc/tbf needs some changes, because the logical way would be
> to use the 1514 value for low rates, but if we use this value, the
> kernel gets a value of 1511, which doesn't work.
Yep, I agree with your logical way. But I think current logic in kernel
cannot support to only do some changes in tc/tbf. We need changes both
in tc and kernel. I'll post a patch which uses TCA_TBF_BURST to get burst
from tc directly and this patch also need to keep backward compatible with
old tc.
Regards,
Yang
^ permalink raw reply
* [PATCH 2/2] atm: solos-pci: remove unnecessary pci_set_drvdata()
From: Jingoo Han @ 2013-11-25 3:33 UTC (permalink / raw)
To: 'David S. Miller'
Cc: 'Chas Williams', netdev, linux-atm-general,
'Jingoo Han', 'Nathan Williams',
'David Woodhouse'
In-Reply-To: <002801cee98e$d93e9c30$8bbbd490$%han@samsung.com>
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/atm/solos-pci.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 32784d1..e3fb496 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1335,7 +1335,6 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
out_unmap_both:
kfree(card->dma_bounce);
- pci_set_drvdata(dev, NULL);
pci_iounmap(dev, card->buffers);
out_unmap_config:
pci_iounmap(dev, card->config_regs);
@@ -1457,7 +1456,6 @@ static void fpga_remove(struct pci_dev *dev)
pci_release_regions(dev);
pci_disable_device(dev);
- pci_set_drvdata(dev, NULL);
kfree(card);
}
--
1.7.10.4
^ permalink raw reply related
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