* [PATCH v2 4/5] net: ethernet: ti: cpsw: don't duplicate common res in rx handler
From: Ivan Khoronzhuk @ 2017-01-19 16:58 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
Ivan Khoronzhuk
In-Reply-To: <1484845107-30331-1-git-send-email-ivan.khoronzhuk@linaro.org>
No need to duplicate the same function in rx handler to get info
if any interface is running.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 40 ++++++++++++++++------------------------
1 file changed, 16 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c681d39..1f14afd 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -671,6 +671,18 @@ static void cpsw_intr_disable(struct cpsw_common *cpsw)
return;
}
+static int cpsw_get_usage_count(struct cpsw_common *cpsw)
+{
+ u32 i;
+ u32 usage_count = 0;
+
+ for (i = 0; i < cpsw->data.slaves; i++)
+ if (netif_running(cpsw->slaves[i].ndev))
+ usage_count++;
+
+ return usage_count;
+}
+
static void cpsw_tx_handler(void *token, int len, int status)
{
struct netdev_queue *txq;
@@ -703,18 +715,10 @@ static void cpsw_rx_handler(void *token, int len, int status)
cpsw_dual_emac_src_port_detect(cpsw, status, ndev, skb);
if (unlikely(status < 0) || unlikely(!netif_running(ndev))) {
- bool ndev_status = false;
- struct cpsw_slave *slave = cpsw->slaves;
- int n;
-
- if (cpsw->data.dual_emac) {
- /* In dual emac mode check for all interfaces */
- for (n = cpsw->data.slaves; n; n--, slave++)
- if (netif_running(slave->ndev))
- ndev_status = true;
- }
-
- if (ndev_status && (status >= 0)) {
+ /* In dual emac mode check for all interfaces */
+ if (cpsw->data.dual_emac &&
+ cpsw_get_usage_count(cpsw) &&
+ (status >= 0)) {
/* The packet received is for the interface which
* is already down and the other interface is up
* and running, instead of freeing which results
@@ -1234,18 +1238,6 @@ static void cpsw_get_ethtool_stats(struct net_device *ndev,
}
}
-static int cpsw_get_usage_count(struct cpsw_common *cpsw)
-{
- u32 i;
- u32 usage_count = 0;
-
- for (i = 0; i < cpsw->data.slaves; i++)
- if (netif_running(cpsw->slaves[i].ndev))
- usage_count++;
-
- return usage_count;
-}
-
static inline int cpsw_tx_packet_submit(struct cpsw_priv *priv,
struct sk_buff *skb,
struct cpdma_chan *txch)
--
2.7.4
^ permalink raw reply related
* [PATCH v2 0/5] net: ethernet: ti: cpsw: correct common res usage
From: Ivan Khoronzhuk @ 2017-01-19 16:58 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
Ivan Khoronzhuk
This series is intended to remove unneeded redundancies connected with
common resource usage function.
Since v1:
- changed name to cpsw_get_usage_count()
- added comments to open/closw for cpsw_get_usage_count()
- added patch:
net: ethernet: ti: cpsw: clarify ethtool ops changing num of descs
Based on net-next/master
Ivan Khoronzhuk (5):
net: ethernet: ti: cpsw: remove dual check from common res usage
function
net: ethernet: ti: cpsw: don't disable interrupts in ndo_open
net: ethernet: ti: cpsw: don't duplicate ndev_running
net: ethernet: ti: cpsw: don't duplicate common res in rx handler
net: ethernet: ti: cpsw: clarify ethtool ops changing num of descs
drivers/net/ethernet/ti/cpsw.c | 200 ++++++++++++++++++-----------------------
1 file changed, 88 insertions(+), 112 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCH v2 3/5] net: ethernet: ti: cpsw: don't duplicate ndev_running
From: Ivan Khoronzhuk @ 2017-01-19 16:58 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
Ivan Khoronzhuk
In-Reply-To: <1484845107-30331-1-git-send-email-ivan.khoronzhuk@linaro.org>
No need to create additional vars to identify if interface is running.
So simplify code by removing redundant var and checking usage counter
instead.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f798905..c681d39 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -357,7 +357,6 @@ struct cpsw_slave {
struct phy_device *phy;
struct net_device *ndev;
u32 port_vlan;
- u32 open_stat;
};
static inline u32 slave_read(struct cpsw_slave *slave, u32 offset)
@@ -1235,13 +1234,13 @@ static void cpsw_get_ethtool_stats(struct net_device *ndev,
}
}
-static int cpsw_common_res_usage_state(struct cpsw_common *cpsw)
+static int cpsw_get_usage_count(struct cpsw_common *cpsw)
{
u32 i;
u32 usage_count = 0;
for (i = 0; i < cpsw->data.slaves; i++)
- if (cpsw->slaves[i].open_stat)
+ if (netif_running(cpsw->slaves[i].ndev))
usage_count++;
return usage_count;
@@ -1501,8 +1500,11 @@ static int cpsw_ndo_open(struct net_device *ndev)
CPSW_MAJOR_VERSION(reg), CPSW_MINOR_VERSION(reg),
CPSW_RTL_VERSION(reg));
- /* initialize host and slave ports */
- if (!cpsw_common_res_usage_state(cpsw))
+ /* Initialize host and slave ports.
+ * Given ndev is marked as opened already, so init port only if 1 ndev
+ * is opened
+ */
+ if (cpsw_get_usage_count(cpsw) < 2)
cpsw_init_host_port(priv);
for_each_slave(priv, cpsw_slave_open, priv);
@@ -1513,7 +1515,10 @@ static int cpsw_ndo_open(struct net_device *ndev)
cpsw_ale_add_vlan(cpsw->ale, cpsw->data.default_vlan,
ALE_ALL_PORTS, ALE_ALL_PORTS, 0, 0);
- if (!cpsw_common_res_usage_state(cpsw)) {
+ /* Given ndev is marked as opened already, so if more ndev
+ * are opened - no need to init shared resources.
+ */
+ if (cpsw_get_usage_count(cpsw) < 2) {
/* disable priority elevation */
__raw_writel(0, &cpsw->regs->ptype);
@@ -1556,9 +1561,6 @@ static int cpsw_ndo_open(struct net_device *ndev)
cpdma_ctlr_start(cpsw->dma);
cpsw_intr_enable(cpsw);
- if (cpsw->data.dual_emac)
- cpsw->slaves[priv->emac_port].open_stat = true;
-
return 0;
err_cleanup:
@@ -1578,7 +1580,10 @@ static int cpsw_ndo_stop(struct net_device *ndev)
netif_tx_stop_all_queues(priv->ndev);
netif_carrier_off(priv->ndev);
- if (cpsw_common_res_usage_state(cpsw) <= 1) {
+ /* Given ndev is marked as close already,
+ * so disable shared resources if no open devices
+ */
+ if (!cpsw_get_usage_count(cpsw)) {
napi_disable(&cpsw->napi_rx);
napi_disable(&cpsw->napi_tx);
cpts_unregister(cpsw->cpts);
@@ -1592,8 +1597,6 @@ static int cpsw_ndo_stop(struct net_device *ndev)
cpsw_split_res(ndev);
pm_runtime_put_sync(cpsw->dev);
- if (cpsw->data.dual_emac)
- cpsw->slaves[priv->emac_port].open_stat = false;
return 0;
}
@@ -2418,7 +2421,7 @@ static int cpsw_set_channels(struct net_device *ndev,
netif_dormant_off(slave->ndev);
}
- if (cpsw_common_res_usage_state(cpsw)) {
+ if (cpsw_get_usage_count(cpsw)) {
ret = cpsw_fill_rx_channels(priv);
if (ret)
goto err;
@@ -2537,7 +2540,7 @@ static int cpsw_set_ringparam(struct net_device *ndev,
netif_dormant_off(slave->ndev);
}
- if (cpsw_common_res_usage_state(cpsw)) {
+ if (cpsw_get_usage_count(cpsw)) {
cpdma_chan_split_pool(cpsw->dma);
ret = cpsw_fill_rx_channels(priv);
--
2.7.4
^ permalink raw reply related
* [PATCH v2 5/5] net: ethernet: ti: cpsw: clarify ethtool ops changing num of descs
From: Ivan Khoronzhuk @ 2017-01-19 16:58 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
Ivan Khoronzhuk
In-Reply-To: <1484845107-30331-1-git-send-email-ivan.khoronzhuk@linaro.org>
After adding cpsw_set_ringparam ethtool op, better to carry out
common parts of similar ops splitting descriptors in runtime. It
allows to reuse these parts and shows what the ops actually do.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 132 ++++++++++++++++++-----------------------
1 file changed, 59 insertions(+), 73 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1f14afd..897ebbe 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2358,17 +2358,11 @@ static int cpsw_update_channels(struct cpsw_priv *priv,
return 0;
}
-static int cpsw_set_channels(struct net_device *ndev,
- struct ethtool_channels *chs)
+static void cpsw_suspend_data_pass(struct net_device *ndev)
{
- struct cpsw_priv *priv = netdev_priv(ndev);
- struct cpsw_common *cpsw = priv->cpsw;
+ struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
struct cpsw_slave *slave;
- int i, ret;
-
- ret = cpsw_check_ch_settings(cpsw, chs);
- if (ret < 0)
- return ret;
+ int i;
/* Disable NAPI scheduling */
cpsw_intr_disable(cpsw);
@@ -2386,6 +2380,51 @@ static int cpsw_set_channels(struct net_device *ndev,
/* Handle rest of tx packets and stop cpdma channels */
cpdma_ctlr_stop(cpsw->dma);
+}
+
+static int cpsw_resume_data_pass(struct net_device *ndev)
+{
+ struct cpsw_priv *priv = netdev_priv(ndev);
+ struct cpsw_common *cpsw = priv->cpsw;
+ struct cpsw_slave *slave;
+ int i, ret;
+
+ /* Allow rx packets handling */
+ for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++)
+ if (slave->ndev && netif_running(slave->ndev))
+ netif_dormant_off(slave->ndev);
+
+ /* After this receive is started */
+ if (cpsw_get_usage_count(cpsw)) {
+ ret = cpsw_fill_rx_channels(priv);
+ if (ret)
+ return ret;
+
+ cpdma_ctlr_start(cpsw->dma);
+ cpsw_intr_enable(cpsw);
+ }
+
+ /* Resume transmit for every affected interface */
+ for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++)
+ if (slave->ndev && netif_running(slave->ndev))
+ netif_tx_start_all_queues(slave->ndev);
+
+ return 0;
+}
+
+static int cpsw_set_channels(struct net_device *ndev,
+ struct ethtool_channels *chs)
+{
+ struct cpsw_priv *priv = netdev_priv(ndev);
+ struct cpsw_common *cpsw = priv->cpsw;
+ struct cpsw_slave *slave;
+ int i, ret;
+
+ ret = cpsw_check_ch_settings(cpsw, chs);
+ if (ret < 0)
+ return ret;
+
+ cpsw_suspend_data_pass(ndev);
ret = cpsw_update_channels(priv, chs);
if (ret)
goto err;
@@ -2408,30 +2447,14 @@ static int cpsw_set_channels(struct net_device *ndev,
dev_err(priv->dev, "cannot set real number of rx queues\n");
goto err;
}
-
- /* Enable rx packets handling */
- netif_dormant_off(slave->ndev);
}
- if (cpsw_get_usage_count(cpsw)) {
- ret = cpsw_fill_rx_channels(priv);
- if (ret)
- goto err;
-
+ if (cpsw_get_usage_count(cpsw))
cpsw_split_res(ndev);
- /* After this receive is started */
- cpdma_ctlr_start(cpsw->dma);
- cpsw_intr_enable(cpsw);
- }
-
- /* Resume transmit for every affected interface */
- for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++) {
- if (!(slave->ndev && netif_running(slave->ndev)))
- continue;
- netif_tx_start_all_queues(slave->ndev);
- }
- return 0;
+ ret = cpsw_resume_data_pass(ndev);
+ if (!ret)
+ return 0;
err:
dev_err(priv->dev, "cannot update channels number, closing device\n");
dev_close(ndev);
@@ -2492,8 +2515,7 @@ static int cpsw_set_ringparam(struct net_device *ndev,
{
struct cpsw_priv *priv = netdev_priv(ndev);
struct cpsw_common *cpsw = priv->cpsw;
- struct cpsw_slave *slave;
- int i, ret;
+ int ret;
/* ignore ering->tx_pending - only rx_pending adjustment is supported */
@@ -2505,54 +2527,18 @@ static int cpsw_set_ringparam(struct net_device *ndev,
if (ering->rx_pending == cpdma_get_num_rx_descs(cpsw->dma))
return 0;
- /* Disable NAPI scheduling */
- cpsw_intr_disable(cpsw);
-
- /* Stop all transmit queues for every network device.
- * Disable re-using rx descriptors with dormant_on.
- */
- for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++) {
- if (!(slave->ndev && netif_running(slave->ndev)))
- continue;
-
- netif_tx_stop_all_queues(slave->ndev);
- netif_dormant_on(slave->ndev);
- }
-
- /* Handle rest of tx packets and stop cpdma channels */
- cpdma_ctlr_stop(cpsw->dma);
+ cpsw_suspend_data_pass(ndev);
cpdma_set_num_rx_descs(cpsw->dma, ering->rx_pending);
- for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++) {
- if (!(slave->ndev && netif_running(slave->ndev)))
- continue;
-
- /* Enable rx packets handling */
- netif_dormant_off(slave->ndev);
- }
-
- if (cpsw_get_usage_count(cpsw)) {
+ if (cpsw_get_usage_count(cpsw))
cpdma_chan_split_pool(cpsw->dma);
- ret = cpsw_fill_rx_channels(priv);
- if (ret)
- goto err;
-
- /* After this receive is started */
- cpdma_ctlr_start(cpsw->dma);
- cpsw_intr_enable(cpsw);
- }
+ ret = cpsw_resume_data_pass(ndev);
+ if (!ret)
+ return 0;
- /* Resume transmit for every affected interface */
- for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++) {
- if (!(slave->ndev && netif_running(slave->ndev)))
- continue;
- netif_tx_start_all_queues(slave->ndev);
- }
- return 0;
-err:
- dev_err(priv->dev, "cannot set ring params, closing device\n");
+ dev_err(&ndev->dev, "cannot set ring params, closing device\n");
dev_close(ndev);
return ret;
}
--
2.7.4
^ permalink raw reply related
* [PATCH v2 1/5] net: ethernet: ti: cpsw: remove dual check from common res usage function
From: Ivan Khoronzhuk @ 2017-01-19 16:58 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
Ivan Khoronzhuk
In-Reply-To: <1484845107-30331-1-git-send-email-ivan.khoronzhuk@linaro.org>
Common res usage is possible only in case an interface is
running. In case of not dual emac here can be only one interface,
so while ndo_open and switch mode, only one interface can be opened,
thus if open is called no any interface is running ... and no common
res are used. So remove check on dual emac, it will simplify
code/understanding and will match the name it's called.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 02b03ee..296ddf2 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1240,9 +1240,6 @@ static int cpsw_common_res_usage_state(struct cpsw_common *cpsw)
u32 i;
u32 usage_count = 0;
- if (!cpsw->data.dual_emac)
- return 0;
-
for (i = 0; i < cpsw->data.slaves; i++)
if (cpsw->slaves[i].open_stat)
usage_count++;
--
2.7.4
^ permalink raw reply related
* [PATCH iproute2] ip route: error out on multiple via without nexthop keyword
From: David Ahern @ 2017-01-19 17:08 UTC (permalink / raw)
To: netdev, stephen; +Cc: David Ahern
To specify multiple nexthops in a route the user is expected to use the
"nexthop" keyword which ip route uses to create the RTA_MULTIPATH.
However, ip route always accepts multiple 'via' keywords where only the
last one is used in the route leading to confusion. For example, ip
accepts this syntax:
$ ip ro add vrf red 1.1.1.0/24 via 10.100.1.18 via 10.100.2.18
but the route entered inserted by the kernel is just the last gateway:
1.1.1.0/24 via 10.100.2.18 dev eth2
which is not the full request from the user. Detect the presense of
multiple 'via' and give the user a hint to add nexthop:
$ ip ro add vrf red 1.1.1.0/24 via 10.100.1.18 via 10.100.2.18
Error: argument "via" is wrong: use nexthop syntax to specify multiple via
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
ip/iproute.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ip/iproute.c b/ip/iproute.c
index e433de8be189..52dbdc7dea36 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -881,6 +881,10 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv)
inet_prefix addr;
int family;
+ if (gw_ok) {
+ invarg("use nexthop syntax to specify multiple via\n",
+ *argv);
+ }
gw_ok = 1;
NEXT_ARG();
family = read_family(*argv);
--
2.1.4
^ permalink raw reply related
* Re: [PATCH v2] xen-netfront: Fix Rx stall during network stress and OOM
From: David Miller @ 2017-01-19 17:11 UTC (permalink / raw)
To: vineethp; +Cc: netdev, linux-kernel
In-Reply-To: <66b10c64-936a-8001-6855-2ff1ed626642@amazon.com>
From: Vineeth Remanan Pillai <vineethp@amazon.com>
Date: Thu, 19 Jan 2017 08:35:39 -0800
> From: Vineeth Remanan Pillai <vineethp@amazon.com>
>
> During an OOM scenario, request slots could not be created as skb
> allocation fails. So the netback cannot pass in packets and netfront
> wrongly assumes that there is no more work to be done and it disables
> polling. This causes Rx to stall.
>
> The issue is with the retry logic which schedules the timer if the
> created slots are less than NET_RX_SLOTS_MIN. The count of new request
> slots to be pushed are calculated as a difference between new req_prod
> and rsp_cons which could be more than the actual slots, if there are
> unconsumed responses.
>
> The fix is to calculate the count of newly created slots as the
> difference between new req_prod and old req_prod.
>
> Signed-off-by: Vineeth Remanan Pillai <vineethp@amazon.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
> ---
> Changes in v2:
> - Removed the old implementation of enabling polling on
> skb allocation error.
> - Corrected the refill timer logic to schedule when newly
> created slots since last push is less than NET_RX_SLOTS_MIN.
Your postings aren't showing up on vger.kernel.org at all.
Are you getting a bounce message back? I can only assume you are triggering
one of the various content filters we have.
^ permalink raw reply
* Re: [PATCH v2] xen-netfront: Fix Rx stall during network stress and OOM
From: Vineeth Remanan Pillai @ 2017-01-19 17:17 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel
In-Reply-To: <20170119.121137.735637643552808729.davem@davemloft.net>
On 01/19/2017 09:11 AM, David Miller wrote:
> From: Vineeth Remanan Pillai <vineethp@amazon.com>
> Date: Thu, 19 Jan 2017 08:35:39 -0800
>
>> From: Vineeth Remanan Pillai <vineethp@amazon.com>
>>
>> During an OOM scenario, request slots could not be created as skb
>> allocation fails. So the netback cannot pass in packets and netfront
>> wrongly assumes that there is no more work to be done and it disables
>> polling. This causes Rx to stall.
>>
>> The issue is with the retry logic which schedules the timer if the
>> created slots are less than NET_RX_SLOTS_MIN. The count of new request
>> slots to be pushed are calculated as a difference between new req_prod
>> and rsp_cons which could be more than the actual slots, if there are
>> unconsumed responses.
>>
>> The fix is to calculate the count of newly created slots as the
>> difference between new req_prod and old req_prod.
>>
>> Signed-off-by: Vineeth Remanan Pillai <vineethp@amazon.com>
>> Reviewed-by: Juergen Gross <jgross@suse.com>
>> ---
>> Changes in v2:
>> - Removed the old implementation of enabling polling on
>> skb allocation error.
>> - Corrected the refill timer logic to schedule when newly
>> created slots since last push is less than NET_RX_SLOTS_MIN.
> Your postings aren't showing up on vger.kernel.org at all.
>
> Are you getting a bounce message back? I can only assume you are triggering
> one of the various content filters we have.
>
I haven't received any bounce messages till now. The mail showed up
in xen-devel after about 8 hours yesterday. Not sure what is happening
with vger.kernel.org. My initial patch showed up in all the mailing
list. The
only difference is, I switched to a machine running a later version of git.
Should I try sending it once again?
Thanks
^ permalink raw reply
* [PATCHv3 net-next 0/4] sctp: add sender-side procedures for stream reconf asoc reset and add streams
From: Xin Long @ 2017-01-19 17:19 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: Marcelo Ricardo Leitner, Neil Horman, Vlad Yasevich, davem
Patch 2/4 is to implement sender-side procedures for the SSN/TSN Reset
Request Parameter described in rfc6525 section 5.1.4, patch 1/4 is
ahead of it to define a function to make the request chunk for it.
Patch 4/4 is to implement sender-side procedures for the Add Incoming
and Outgoing Streams Request Parameter Request Parameter described in
rfc6525 section 5.1.5 and 5.1.6, patch 3/4 is ahead of it to define a
function to make the request chunk for it.
v1->v2:
- put these into a smaller group.
- rename some temporary variables in the codes.
- rename the titles of the commits and improve some changelogs.
v2->v3:
- re-split the patchset and make sure it has no dead codes for review.
- move some codes into stream.c from socket.c.
Xin Long (4):
sctp: add support for generating stream reconf ssn/tsn reset request
chunk
sctp: implement sender-side procedures for SSN/TSN Reset Request
Parameter
sctp: add support for generating stream reconf add incoming/outgoing
streams request chunk
sctp: implement sender-side procedures for Add Incoming/Outgoing
Streams Request Parameter
include/linux/sctp.h | 12 +++++
include/net/sctp/sctp.h | 3 ++
include/net/sctp/sm.h | 5 ++
include/uapi/linux/sctp.h | 8 +++
net/sctp/sm_make_chunk.c | 75 ++++++++++++++++++++++++++
net/sctp/socket.c | 58 ++++++++++++++++++++
net/sctp/stream.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 293 insertions(+)
--
2.1.0
^ permalink raw reply
* [PATCHv3 net-next 1/4] sctp: add support for generating stream reconf ssn/tsn reset request chunk
From: Xin Long @ 2017-01-19 17:19 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: Marcelo Ricardo Leitner, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <cover.1484845510.git.lucien.xin@gmail.com>
This patch is to define SSN/TSN Reset Request Parameter described
in rfc6525 section 4.3.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/linux/sctp.h | 5 +++++
include/net/sctp/sm.h | 2 ++
net/sctp/sm_make_chunk.c | 29 +++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index a9e7906..95b8ed3 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -737,4 +737,9 @@ struct sctp_strreset_inreq {
__u16 list_of_streams[0];
} __packed;
+struct sctp_strreset_tsnreq {
+ sctp_paramhdr_t param_hdr;
+ __u32 request_seq;
+} __packed;
+
#endif /* __LINUX_SCTP_H__ */
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 430ed13..ac37c17 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -265,6 +265,8 @@ struct sctp_chunk *sctp_make_strreset_req(
const struct sctp_association *asoc,
__u16 stream_num, __u16 *stream_list,
bool out, bool in);
+struct sctp_chunk *sctp_make_strreset_tsnreq(
+ const struct sctp_association *asoc);
void sctp_chunk_assign_tsn(struct sctp_chunk *);
void sctp_chunk_assign_ssn(struct sctp_chunk *);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index ad3445b..801450c 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3660,3 +3660,32 @@ struct sctp_chunk *sctp_make_strreset_req(
return retval;
}
+
+/* RE-CONFIG 4.3 (SSN/TSN RESET ALL)
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Parameter Type = 15 | Parameter Length = 8 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Re-configuration Request Sequence Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct sctp_chunk *sctp_make_strreset_tsnreq(
+ const struct sctp_association *asoc)
+{
+ struct sctp_strreset_tsnreq tsnreq;
+ __u16 length = sizeof(tsnreq);
+ struct sctp_chunk *retval;
+
+ retval = sctp_make_reconf(asoc, length);
+ if (!retval)
+ return NULL;
+
+ tsnreq.param_hdr.type = SCTP_PARAM_RESET_TSN_REQUEST;
+ tsnreq.param_hdr.length = htons(length);
+ tsnreq.request_seq = htonl(asoc->strreset_outseq);
+
+ sctp_addto_chunk(retval, sizeof(tsnreq), &tsnreq);
+
+ return retval;
+}
--
2.1.0
^ permalink raw reply related
* [PATCHv3 net-next 2/4] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter
From: Xin Long @ 2017-01-19 17:19 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: Marcelo Ricardo Leitner, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <cover.1484845510.git.lucien.xin@gmail.com>
This patch is to implement Sender-Side Procedures for the SSN/TSN
Reset Request Parameter descibed in rfc6525 section 5.1.4.
It is also to add sockopt SCTP_RESET_ASSOC in rfc6525 section 6.3.3
for users.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/net/sctp/sctp.h | 1 +
include/uapi/linux/sctp.h | 1 +
net/sctp/socket.c | 29 +++++++++++++++++++++++++++++
net/sctp/stream.c | 33 +++++++++++++++++++++++++++++++++
4 files changed, 64 insertions(+)
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 3cfd365b..b93820f 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -198,6 +198,7 @@ int sctp_offload_init(void);
*/
int sctp_send_reset_streams(struct sctp_association *asoc,
struct sctp_reset_streams *params);
+int sctp_send_reset_assoc(struct sctp_association *asoc);
/*
* Module global variables
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index 03c27ce..c0bd8c3 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -117,6 +117,7 @@ typedef __s32 sctp_assoc_t;
#define SCTP_PR_ASSOC_STATUS 115
#define SCTP_ENABLE_STREAM_RESET 118
#define SCTP_RESET_STREAMS 119
+#define SCTP_RESET_ASSOC 120
/* PR-SCTP policies */
#define SCTP_PR_SCTP_NONE 0x0000
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index bee4dd3..2c5c9ca 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3812,6 +3812,32 @@ static int sctp_setsockopt_reset_streams(struct sock *sk,
return retval;
}
+static int sctp_setsockopt_reset_assoc(struct sock *sk,
+ char __user *optval,
+ unsigned int optlen)
+{
+ struct sctp_association *asoc;
+ sctp_assoc_t associd;
+ int retval = -EINVAL;
+
+ if (optlen != sizeof(associd))
+ goto out;
+
+ if (copy_from_user(&associd, optval, optlen)) {
+ retval = -EFAULT;
+ goto out;
+ }
+
+ asoc = sctp_id2assoc(sk, associd);
+ if (!asoc)
+ goto out;
+
+ retval = sctp_send_reset_assoc(asoc);
+
+out:
+ return retval;
+}
+
/* API 6.2 setsockopt(), getsockopt()
*
* Applications use setsockopt() and getsockopt() to set or retrieve
@@ -3984,6 +4010,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
case SCTP_RESET_STREAMS:
retval = sctp_setsockopt_reset_streams(sk, optval, optlen);
break;
+ case SCTP_RESET_ASSOC:
+ retval = sctp_setsockopt_reset_assoc(sk, optval, optlen);
+ break;
default:
retval = -ENOPROTOOPT;
break;
diff --git a/net/sctp/stream.c b/net/sctp/stream.c
index 13d5e07..b368191 100644
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -162,3 +162,36 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
out:
return retval;
}
+
+int sctp_send_reset_assoc(struct sctp_association *asoc)
+{
+ struct sctp_chunk *chunk = NULL;
+ int retval;
+ __u16 i;
+
+ if (!asoc->peer.reconf_capable ||
+ !(asoc->strreset_enable & SCTP_ENABLE_RESET_ASSOC_REQ))
+ return -ENOPROTOOPT;
+
+ if (asoc->strreset_outstanding)
+ return -EINPROGRESS;
+
+ chunk = sctp_make_strreset_tsnreq(asoc);
+ if (!chunk)
+ return -ENOMEM;
+
+ for (i = 0; i < asoc->stream->outcnt; i++)
+ asoc->stream->out[i].state = SCTP_STREAM_CLOSED;
+
+ asoc->strreset_outstanding = 1;
+ asoc->strreset_chunk = chunk;
+ sctp_chunk_hold(asoc->strreset_chunk);
+
+ retval = sctp_send_reconf(asoc, chunk);
+ if (retval) {
+ sctp_chunk_put(asoc->strreset_chunk);
+ asoc->strreset_chunk = NULL;
+ }
+
+ return retval;
+}
--
2.1.0
^ permalink raw reply related
* [PATCHv3 net-next 3/4] sctp: add support for generating stream reconf add incoming/outgoing streams request chunk
From: Xin Long @ 2017-01-19 17:19 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: Marcelo Ricardo Leitner, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <cover.1484845510.git.lucien.xin@gmail.com>
This patch is to define Add Incoming/Outgoing Streams Request
Parameter described in rfc6525 section 4.5 and 4.6. They can
be in one same chunk trunk as rfc6525 section 3.1-7 describes,
so make them in one function.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/linux/sctp.h | 7 +++++++
include/net/sctp/sm.h | 3 +++
net/sctp/sm_make_chunk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+)
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 95b8ed3..f1f494f 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -742,4 +742,11 @@ struct sctp_strreset_tsnreq {
__u32 request_seq;
} __packed;
+struct sctp_strreset_addstrm {
+ sctp_paramhdr_t param_hdr;
+ __u32 request_seq;
+ __u16 number_of_streams;
+ __u16 reserved;
+} __packed;
+
#endif /* __LINUX_SCTP_H__ */
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index ac37c17..3675fde 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -267,6 +267,9 @@ struct sctp_chunk *sctp_make_strreset_req(
bool out, bool in);
struct sctp_chunk *sctp_make_strreset_tsnreq(
const struct sctp_association *asoc);
+struct sctp_chunk *sctp_make_strreset_addstrm(
+ const struct sctp_association *asoc,
+ __u16 out, __u16 in);
void sctp_chunk_assign_tsn(struct sctp_chunk *);
void sctp_chunk_assign_ssn(struct sctp_chunk *);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 801450c..a44546d 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3689,3 +3689,49 @@ struct sctp_chunk *sctp_make_strreset_tsnreq(
return retval;
}
+
+/* RE-CONFIG 4.5/4.6 (ADD STREAM)
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Parameter Type = 17 | Parameter Length = 12 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Re-configuration Request Sequence Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Number of new streams | Reserved |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct sctp_chunk *sctp_make_strreset_addstrm(
+ const struct sctp_association *asoc,
+ __u16 out, __u16 in)
+{
+ struct sctp_strreset_addstrm addstrm;
+ __u16 size = sizeof(addstrm);
+ struct sctp_chunk *retval;
+
+ retval = sctp_make_reconf(asoc, (!!out + !!in) * size);
+ if (!retval)
+ return NULL;
+
+ if (out) {
+ addstrm.param_hdr.type = SCTP_PARAM_RESET_ADD_OUT_STREAMS;
+ addstrm.param_hdr.length = htons(size);
+ addstrm.number_of_streams = htons(out);
+ addstrm.request_seq = htonl(asoc->strreset_outseq);
+ addstrm.reserved = 0;
+
+ sctp_addto_chunk(retval, size, &addstrm);
+ }
+
+ if (in) {
+ addstrm.param_hdr.type = SCTP_PARAM_RESET_ADD_IN_STREAMS;
+ addstrm.param_hdr.length = htons(size);
+ addstrm.number_of_streams = htons(in);
+ addstrm.request_seq = htonl(asoc->strreset_outseq + !!out);
+ addstrm.reserved = 0;
+
+ sctp_addto_chunk(retval, size, &addstrm);
+ }
+
+ return retval;
+}
--
2.1.0
^ permalink raw reply related
* [PATCHv3 net-next 4/4] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter
From: Xin Long @ 2017-01-19 17:19 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: Marcelo Ricardo Leitner, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <cover.1484845510.git.lucien.xin@gmail.com>
This patch is to implement Sender-Side Procedures for the Add
Outgoing and Incoming Streams Request Parameter described in
rfc6525 section 5.1.5-5.1.6.
It is also to add sockopt SCTP_ADD_STREAMS in rfc6525 section
6.3.4 for users.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/net/sctp/sctp.h | 2 +
include/uapi/linux/sctp.h | 7 ++++
net/sctp/socket.c | 29 ++++++++++++++
net/sctp/stream.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 137 insertions(+)
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index b93820f..68ee1a6 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -199,6 +199,8 @@ int sctp_offload_init(void);
int sctp_send_reset_streams(struct sctp_association *asoc,
struct sctp_reset_streams *params);
int sctp_send_reset_assoc(struct sctp_association *asoc);
+int sctp_send_add_streams(struct sctp_association *asoc,
+ struct sctp_add_streams *params);
/*
* Module global variables
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index c0bd8c3..a91a9cc 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -118,6 +118,7 @@ typedef __s32 sctp_assoc_t;
#define SCTP_ENABLE_STREAM_RESET 118
#define SCTP_RESET_STREAMS 119
#define SCTP_RESET_ASSOC 120
+#define SCTP_ADD_STREAMS 121
/* PR-SCTP policies */
#define SCTP_PR_SCTP_NONE 0x0000
@@ -1027,4 +1028,10 @@ struct sctp_reset_streams {
uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */
};
+struct sctp_add_streams {
+ sctp_assoc_t sas_assoc_id;
+ uint16_t sas_instrms;
+ uint16_t sas_outstrms;
+};
+
#endif /* _UAPI_SCTP_H */
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 2c5c9ca..ae0a99e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3838,6 +3838,32 @@ static int sctp_setsockopt_reset_assoc(struct sock *sk,
return retval;
}
+static int sctp_setsockopt_add_streams(struct sock *sk,
+ char __user *optval,
+ unsigned int optlen)
+{
+ struct sctp_association *asoc;
+ struct sctp_add_streams params;
+ int retval = -EINVAL;
+
+ if (optlen != sizeof(params))
+ goto out;
+
+ if (copy_from_user(¶ms, optval, optlen)) {
+ retval = -EFAULT;
+ goto out;
+ }
+
+ asoc = sctp_id2assoc(sk, params.sas_assoc_id);
+ if (!asoc)
+ goto out;
+
+ retval = sctp_send_add_streams(asoc, ¶ms);
+
+out:
+ return retval;
+}
+
/* API 6.2 setsockopt(), getsockopt()
*
* Applications use setsockopt() and getsockopt() to set or retrieve
@@ -4013,6 +4039,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
case SCTP_RESET_ASSOC:
retval = sctp_setsockopt_reset_assoc(sk, optval, optlen);
break;
+ case SCTP_ADD_STREAMS:
+ retval = sctp_setsockopt_add_streams(sk, optval, optlen);
+ break;
default:
retval = -ENOPROTOOPT;
break;
diff --git a/net/sctp/stream.c b/net/sctp/stream.c
index b368191..ba41837 100644
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -195,3 +195,102 @@ int sctp_send_reset_assoc(struct sctp_association *asoc)
return retval;
}
+
+int sctp_send_add_streams(struct sctp_association *asoc,
+ struct sctp_add_streams *params)
+{
+ struct sctp_stream *stream = asoc->stream;
+ struct sctp_chunk *chunk = NULL;
+ int retval = -EINVAL;
+ __u16 out, in;
+
+ if (!asoc->peer.reconf_capable ||
+ !(asoc->strreset_enable & SCTP_ENABLE_CHANGE_ASSOC_REQ)) {
+ retval = -ENOPROTOOPT;
+ goto out;
+ }
+
+ if (asoc->strreset_outstanding) {
+ retval = -EINPROGRESS;
+ goto out;
+ }
+
+ out = params->sas_outstrms;
+ in = params->sas_instrms;
+
+ if (!out && !in)
+ goto out;
+
+ if (out) {
+ __u16 nums = stream->outcnt + out;
+
+ /* Check for overflow, can't use nums here */
+ if (stream->outcnt + out > SCTP_MAX_STREAM)
+ goto out;
+
+ /* Use ksize to check if stream array really needs to realloc */
+ if (ksize(stream->out) / sizeof(*stream->out) < nums) {
+ struct sctp_stream_out *streamout;
+
+ streamout = kcalloc(nums, sizeof(*streamout),
+ GFP_KERNEL);
+ if (!streamout) {
+ retval = -ENOMEM;
+ goto out;
+ }
+
+ memcpy(streamout, stream->out,
+ sizeof(*streamout) * stream->outcnt);
+
+ kfree(stream->out);
+ stream->out = streamout;
+ }
+
+ stream->outcnt = nums;
+ }
+
+ if (in) {
+ __u16 nums = stream->incnt + in;
+
+ if (stream->incnt + in > SCTP_MAX_STREAM)
+ goto out;
+
+ if (ksize(stream->in) / sizeof(*stream->in) < nums) {
+ struct sctp_stream_in *streamin;
+
+ streamin = kcalloc(nums, sizeof(*streamin),
+ GFP_KERNEL);
+ if (!streamin) {
+ retval = -ENOMEM;
+ goto out;
+ }
+
+ memcpy(streamin, stream->in,
+ sizeof(*streamin) * stream->incnt);
+
+ kfree(stream->in);
+ stream->in = streamin;
+ }
+
+ stream->incnt = nums;
+ }
+
+ chunk = sctp_make_strreset_addstrm(asoc, out, in);
+ if (!chunk) {
+ retval = -ENOMEM;
+ goto out;
+ }
+
+ asoc->strreset_outstanding = !!out + !!in;
+ asoc->strreset_chunk = chunk;
+ sctp_chunk_hold(asoc->strreset_chunk);
+
+ retval = sctp_send_reconf(asoc, chunk);
+ if (retval) {
+ sctp_chunk_put(asoc->strreset_chunk);
+ asoc->strreset_chunk = NULL;
+ }
+
+out:
+ return retval;
+}
--
2.1.0
^ permalink raw reply related
* Re: [PATCH v2 0/5] net: ethernet: ti: cpsw: correct common res usage
From: Grygorii Strashko @ 2017-01-19 17:33 UTC (permalink / raw)
To: Ivan Khoronzhuk, mugunthanvnm; +Cc: netdev, linux-omap, linux-kernel
In-Reply-To: <1484845107-30331-1-git-send-email-ivan.khoronzhuk@linaro.org>
On 01/19/2017 10:58 AM, Ivan Khoronzhuk wrote:
> This series is intended to remove unneeded redundancies connected with
> common resource usage function.
>
> Since v1:
> - changed name to cpsw_get_usage_count()
> - added comments to open/closw for cpsw_get_usage_count()
> - added patch:
> net: ethernet: ti: cpsw: clarify ethtool ops changing num of descs
>
> Based on net-next/master
>
> Ivan Khoronzhuk (5):
> net: ethernet: ti: cpsw: remove dual check from common res usage
> function
> net: ethernet: ti: cpsw: don't disable interrupts in ndo_open
> net: ethernet: ti: cpsw: don't duplicate ndev_running
> net: ethernet: ti: cpsw: don't duplicate common res in rx handler
> net: ethernet: ti: cpsw: clarify ethtool ops changing num of descs
>
> drivers/net/ethernet/ti/cpsw.c | 200 ++++++++++++++++++-----------------------
> 1 file changed, 88 insertions(+), 112 deletions(-)
>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
--
regards,
-grygorii
^ permalink raw reply
* [PATCH iproute2 net-next] tc: m_csum: add support for SCTP checksum
From: Davide Caratti @ 2017-01-19 17:26 UTC (permalink / raw)
To: Stephen Hemminger, Gregoire Baron; +Cc: netdev
'sctp' parameter can now be used as 'csum' target to enable CRC32c
computation on SCTP packets.
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
tc/m_csum.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tc/m_csum.c b/tc/m_csum.c
index d5b1af6..0ee8cad 100644
--- a/tc/m_csum.c
+++ b/tc/m_csum.c
@@ -24,7 +24,7 @@ explain(void)
{
fprintf(stderr, "Usage: ... csum <UPDATE>\n"
"Where: UPDATE := <TARGET> [<UPDATE>]\n"
- " TARGET := { ip4h | icmp | igmp | tcp | udp | udplite | <SWEETS> }\n"
+ " TARGET := { ip4h | icmp | igmp | tcp | udp | udplite | sctp | <SWEETS> }\n"
" SWEETS := { and | or | \'+\' }\n");
}
@@ -65,6 +65,9 @@ parse_csum_args(int *argc_p, char ***argv_p, struct tc_csum *sel)
else if (matches(*argv, "udplite") == 0)
sel->update_flags |= TCA_CSUM_UPDATE_FLAG_UDPLITE;
+ else if (matches(*argv, "sctp") == 0)
+ sel->update_flags |= TCA_CSUM_UPDATE_FLAG_SCTP;
+
else if ((matches(*argv, "and") == 0) ||
(matches(*argv, "or") == 0) ||
(matches(*argv, "+") == 0))
@@ -160,6 +163,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
char *uflag_4 = "";
char *uflag_5 = "";
char *uflag_6 = "";
+ char *uflag_7 = "";
int uflag_count = 0;
@@ -191,13 +195,14 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
CSUM_UFLAG_BUFFER(uflag_4, TCA_CSUM_UPDATE_FLAG_TCP, "tcp");
CSUM_UFLAG_BUFFER(uflag_5, TCA_CSUM_UPDATE_FLAG_UDP, "udp");
CSUM_UFLAG_BUFFER(uflag_6, TCA_CSUM_UPDATE_FLAG_UDPLITE, "udplite");
+ CSUM_UFLAG_BUFFER(uflag_7, TCA_CSUM_UPDATE_FLAG_SCTP, "sctp");
if (!uflag_count) {
uflag_1 = "?empty";
}
- fprintf(f, "csum (%s%s%s%s%s%s) action %s\n",
+ fprintf(f, "csum (%s%s%s%s%s%s%s) action %s\n",
uflag_1, uflag_2, uflag_3,
- uflag_4, uflag_5, uflag_6,
+ uflag_4, uflag_5, uflag_6, uflag_7,
action_n2a(sel->action));
fprintf(f, "\tindex %u ref %d bind %d", sel->index, sel->refcnt,
sel->bindcnt);
--
2.7.4
^ permalink raw reply related
* Re: Setting link down or up in software
From: Florian Fainelli @ 2017-01-19 17:59 UTC (permalink / raw)
To: Måns Rullgård, Mason
Cc: Zefir Kurtisi, netdev, Andrew Lunn, Thibaud Cornic
In-Reply-To: <yw1xbmv3j5ly.fsf@unicorn.mansr.com>
On 01/19/2017 09:56 AM, Måns Rullgård wrote:
> Mason <slash.tmp@free.fr> writes:
>
>> One thing I find confusing... If the 8035 could work with the generic
>> PHY driver, what's the point of the at803x.ko driver?
>
> Almost all Ethernet PHYs support the basic operation defined the by the
> standard. Many have additional non-standardised features that require a
> specific driver. Interrupts, for example.
Or special initial configuration wrt. (RG)MII modes, and runtime
configuration (EEE, link speeds, workarounds), obtaining useful counters
etc.
The generic PHY driver only deals with the standard MII registers (and
just a subset of it actually) while the PHY driver allows you to deal
with all the hardware specifics, the whole point behind having both
specialization and abstraction.
--
Florian
^ permalink raw reply
* Re: [RFC] RESEND - rdmatool - tool for RDMA users
From: Jason Gunthorpe @ 2017-01-19 18:03 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Bart Van Assche, Or Gerlitz, Ariel Almog,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Linux Netdev List
In-Reply-To: <20170119063326.GJ32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
On Thu, Jan 19, 2017 at 08:33:26AM +0200, Leon Romanovsky wrote:
> On Wed, Jan 18, 2017 at 01:45:14PM -0800, Bart Van Assche wrote:
> > On 01/18/2017 10:31 AM, Jason Gunthorpe wrote:
> > > I think it depends on what this tool is supposed to cover, but based
> > > on the description, I would start with netlink-only.
> > >
> > > The only place verbs covers a similar ground is in 'device
> > > capabilities' - for some of that you might want to open a new-uAPI
> > > verbs fd, but even the capability data from that would not be
> > > totally offensive to be accessed over netlink.
> > >
> > > IMHO netlink should cover almost everything found in sysfs today.
> >
> > We would need a very strong argument to introduce a netlink API that
> > duplicates existing sysfs API functionality. Since the sysfs API is
> > extensible, why not extend that API further? E.g. the SCST sysfs API
> > shows that more is possible with sysfs than what most kernel drivers
> > realize.
>
> We didn't look deeply on sysfs mainly because it is unpopular
> in netdev community. Maybe we were misled and it is simply not true.
sysfs is unpopular because the 'one value per file' dogma is laregly
unsuitable for complex mulit-value atomic changes which are common in
netdev. You can force it to work, but it is pretty horrible..
It is also very expensive if you want to shuttle a lot of data, eg I
could not see doing something like 'netstat' for IB through sysfs
Maybe you should start by showing some examples of command out you
wish to have in a rdmatool ..
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] net: ethtool: avoid allocation failure for dump_regs
From: Kalle Valo @ 2017-01-19 18:08 UTC (permalink / raw)
To: John W. Linville
Cc: David Arcari, David Miller, netdev-u79uwXL29TY76Z2rM5mHXA,
Johannes Berg, linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170119155620.GD6245-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
"John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org> writes:
> I forgot to Cc Johannes and Kalle...
Also adding linux-wireless.
> On Thu, Jan 19, 2017 at 09:15:09AM -0500, John W. Linville wrote:
>> On Thu, Jan 19, 2017 at 07:35:22AM -0500, David Arcari wrote:
>> > On 01/18/2017 11:45 AM, David Miller wrote:
>> > > From: David Arcari <darcari-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> > > Date: Wed, 18 Jan 2017 08:34:05 -0500
>> > >
>> > >> If the user executes 'ethtool -d' for an interface and the associated
>> > >> get_regs_len() function returns 0, the user will see a call trace from
>> > >> the vmalloc() call in ethtool_get_regs(). This patch modifies
>> > >> ethtool_get_regs() to avoid the call to vmalloc when the size is zero.
>> > >>
>> > >> Signed-off-by: David Arcari <darcari-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> > > I think when the driver indicates this, it is equivalent to saying that
>> > > the operation isn't supported.
>> > >
>> > > Also, this guards us against ->get_regs() methods that don't handle
>> > > zero length requests properly. I see many which are going to do
>> > > really terrible things in that situation.
>> > >
>> > > Therefore, if get_regs_len() returns zero, treat it the safe as if the
>> > > ethtool operations were NULL.
>> > >
>> > > Thanks.
>> >
>> > That was actually the fix that I was originally considering, but it
>> > turns out
>> > there is a problem with it.
>> >
>> > I found that the vmalloc error was occurring because
>> > ieee80211_get_regs_len() in
>> > net/mac80211/ethtool.c was returning zero. The ieee80211_get_regs in
>> > the same
>> > file returns the hw version. It turns out that this information is used
>> > by the
>> > at76c50x-usb driver in the user space ethtool to report which HW variant
>> > is in
>> > use. Returning an error when regs_len() returns zero would break this
>> > functionality.
>> >
>> > -Dave
>>
>> I'm responsible for this mess. The original idea was for various
>> mac80211-based drivers to override the ethtool operation and provide
>> their own dump operation, but the mac80211 crowd never embraced
>> the idea.
>>
>> In the meantime, I added the default implementation which just
>> passed-up wdev->wiphy->hw_version as the version info for a 0-length
>> register dump. I then implemented a driver-specific regiser dump
>> handler for userland ethtool that would interpret the hardware version
>> information for the at76c50x-usb driver.
>>
>> So the net of it is, if we treat a return of 0 from get_regs_len()
>> as "not supported", we break this one driver-specific feature for
>> userland ethtool. Realistically, there are probably very few users
>> to care. But I can't guarantee that the number is zero.
I know the number is not zero, because I remember using it years back
with something else than at76c50x-usb. But is the number more than one,
I don't know :)
>> Possible solutions:
>>
>> -- break userland ethtool for at76c50x-usb
>> -- avoid 0-len allocation attempt (David Arcari's patch)
>> -- make allocator accept a 0 length value w/o oops'ing
>> -- change mac8011 code to return non-zero from get_regs_len()
>>
>> Thoughts? The last option holds a certain attraction, but I'm not
>> sure how to make it useful...?
If it were only about at76c50x-usb I would say go for it, nobody sane
should use that device anymore. But on the other hand I'm worried that
this interface might be used by other (proprietary) user space tools
with other, more important, drivers. A difficult situation.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH] rtlwifi: rtl8192x: Enabling and disabling hardware interrupts after enabling local irq flags
From: Larry Finger @ 2017-01-19 18:08 UTC (permalink / raw)
To: Lino Sanfilippo, Bharat Kumar Gogada
Cc: chaoming_li-kXabqFNEczNtrwSWzY7KCg,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, kvalo-sgV2jX0FEOL9JmXXK+q4OQ,
netdev-u79uwXL29TY76Z2rM5mHXA, rgummal-gjFFaj9aHVfQT0dZR+AlfA,
Bharat Kumar Gogada
In-Reply-To: <trinity-12e38a0e-85af-457b-9d4e-3c40ab1f6fd1-1484836538110@3capp-gmx-bs75>
On 01/19/2017 08:35 AM, Lino Sanfilippo wrote:
> Hi,
>
> altek/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
>> index a47be73..143766c4 100644
>> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
>> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
>> @@ -1306,9 +1306,9 @@ void rtl92ce_enable_interrupt(struct ieee80211_hw *hw)
>> struct rtl_priv *rtlpriv = rtl_priv(hw);
>> struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
>>
>> + rtlpci->irq_enabled = true;
>> rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
>> rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF);
>> - rtlpci->irq_enabled = true;
>> }
>>
>> void rtl92ce_disable_interrupt(struct ieee80211_hw *hw)
>> @@ -1316,9 +1316,9 @@ void rtl92ce_disable_interrupt(struct ieee80211_hw *hw)
>> struct rtl_priv *rtlpriv = rtl_priv(hw);
>> struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
>>
>> + rtlpci->irq_enabled = false;
>> rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED);
>> rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED);
>> - rtlpci->irq_enabled = false;
>> }
>>
>
> AFAIK you also have to use memory barriers here to ensure that
> the concerning instructions are not reordered, and both irq handler
> and process have a consistent perception of irq_enabled, e.g:
>
> rtlpci->irq_enabled = true;
> smp_wmb();
> rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
>
> and in the irq handler
>
> if (rtlpci->irq_enabled == 0) {
> smp_rmb();
> return ret;
> }
I can see the potential race condition between setting interrupts and setting
the flag, and I will likely accept Bharat's patch after testing.
I am likely displaying my ignorance regarding instruction reordering, but what
compiler/cpu combination is likely to move a simple set operation after a call
to an external routine? Is the smp_wmb() operation really needed? I am also
unsure of the smp_rmb() call in the interrupt handler. Neither instruction
should cause any problems, but I'm not sure they are needed.
Larry
^ permalink raw reply
* Re: [PATCH v2] xen-netfront: Fix Rx stall during network stress and OOM
From: David Miller @ 2017-01-19 18:10 UTC (permalink / raw)
To: vineethp; +Cc: netdev, linux-kernel
In-Reply-To: <47b20f33-2fbe-c4f7-68dc-994073dd5105@amazon.com>
From: Vineeth Remanan Pillai <vineethp@amazon.com>
Date: Thu, 19 Jan 2017 09:17:09 -0800
> Should I try sending it once again?
No need, it just showed up.
^ permalink raw reply
* Re: [PATCH 2/2] at803x: double check SGMII side autoneg
From: Florian Fainelli @ 2017-01-19 18:01 UTC (permalink / raw)
To: Zefir Kurtisi, Timur Tabi, netdev; +Cc: andrew
In-Reply-To: <759d6323-ffac-ebe8-b197-4e1165be5673@neratec.com>
On 01/19/2017 01:43 AM, Zefir Kurtisi wrote:
> On 01/18/2017 04:02 PM, Timur Tabi wrote:
>> On 01/18/2017 07:53 AM, Zefir Kurtisi wrote:
>>> No, not necessarily. The SGMII link default configuration is set such that you do
>>> not have to bother at all.
>>
>> Does the SGMII link need to make the speed and duplex of the external link?
>>
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c#n50
>>
>>
>> Here is where I can configure the SGMII link to match whatever phydev says the
>> external link is. This is code that was handed down to me. I've never really
>> understood what the purpose was. Shouldn't I just be able to configure the SGMII
>> link to 1Gbs full-duplex, regardless of what the external link is set to?
>>
>
> This is because the SGMII link is a transparent interface to the upper layer with
> no means to inform the other side of the link type in the lower layer.
>
> It always operates at 675MHz, which with two lines gives 1.25Gbps, which at 10/8
> coding gives exactly 1Gbps net data rate. If the at803x's copper side
> autonegotiates to 1Gbps, the bits traversing over the SGMII match the copper side
> 1:1. In case the copper side autonegotiates to e.g. 100Mbps, each bit at the
> copper side on the SGMII bus is replicated and sent 10x times - or 100x times in
> case of 10Mbps. The MAC side of the ETH needs to be aware of how the SGMII data
> has to be interpreted, and this is why you have to set the bits you are referring to.
>
>>> That is, if in your case you see the warning popping up but the link always
>>> regains connection, then it is an ignorable false positive.
>>
>> Unfortunately, I can't really ignore it because genphy does this:
>>
>> $ ifup eth1
>> [ 1034.754276] qcom-emac QCOM8070:00 eth1: Link is Up - 1Gbps/Full - flow control
>> rx/tx
>>
>> But the at803x driver does this:
>>
>> $ ifup eth1
>> [ 1020.507728] 803x_aneg_done: SGMII link is not ok
>> [ 1020.513517] qcom-emac QCOM8070:00 eth1: Link is Up - 1Gbps/Full - flow control
>> rx/tx
>> [ 1020.522839] qcom-emac QCOM8070:00 eth1: Link is Up - 1Gbps/Full - flow control
>> rx/tx
>>
>> Customers are going to complain.
>>
> Yes, the double link-status message is annoying - I was referring to the other
> message.
>
> To track down who is causing the additional message, I would proceed with
> following technique that helped me dig down a similar problem: since you control
> the events in question and there is no risk of flooding the kernel log, in the top
> of phy.c::phy_print_status() add a dump_stack() call. In the debug log ensure that
> all of the traces end up in the same phydev->adjust_link() callback handler (in
> your case emac_adjust_link()).
>
> In the gianfar's handler there is an additional check whether the link really
> changed before phy_print_status() is called, in emac_adjust_link() this happens
> unconditionally - maybe that is the problem you are facing.
>
> @Florian: is it safe to assume that when phydev->adjust_link() is called there was
> in fact a link change (link, duplex, pause), or does the handler have to double
> check for a change? I see some ETH drivers maintain a private old state instance
> for that, while others don't.
Yes, it is not just safe, it is a contract. The reason most drivers
cache the values from one run on adjust_link to the other is because you
don't want to needlessly read/write registers if nothing has changed, or
just a subset of link parameters did change.
NB: at some point I was considering bringing this caching into the core
PHY library to save some housekeeping code in drivers...
--
Florian
^ permalink raw reply
* Re: [PATCH net-next v3 06/10] net: dsa: Migrate to device_find_class()
From: Florian Fainelli @ 2017-01-19 18:12 UTC (permalink / raw)
To: Russell King - ARM Linux, Andrew Lunn, Greg KH
Cc: Jason Cooper, Vivien Didelot, netdev, open list, Gregory Clement,
David S. Miller, moderated list:ARM SUB-ARCHITECTURES,
Sebastian Hesselbarth
In-Reply-To: <20170119165155.GH27312@n2100.armlinux.org.uk>
On 01/19/2017 08:51 AM, Russell King - ARM Linux wrote:
> (This is mainly for Greg's benefit to help him understand the issue.)
>
> I think the diagram you gave initially made this confusing, as it
> talks about a CPU(sic) producing the "RGMII" and "MII-MGMT".
>
> Let's instead show a better representation that hopefully helps Greg
> understand networking. :)
>
>
> CPU
> System <-B-> Ethernet controller <-P-> } PHY <---> network cable
> } - - - - - - - or - - - - - - -
> MDIO bus -------M---> } Switch <-P-> PHYs <--> network
> `----M----^ cables
>
> 'B' can be an on-SoC bus or something like PCI.
>
> 'P' are the high-speed connectivity between the ethernet controller and
> PHY which carries the packet data. It has no addressing, it's a point
> to point link. RGMII is just one wiring example, there are many
> different interfaces there (SGMII, AUI, XAUI, XGMII to name a few.)
>
> 'M' are the MDIO bus, which is the bus by which ethernet PHYs and
> switches can be identified and controlled.
So MDIO is one possible bus type to connect an Ethernet switch (and
PHYs) to a the System, but is not necessarily the only one. You have
existing devices out there with on-chip integrated switches (platform),
SPI/GPIO/I2C/PCI(e).
>
> The MDIO bus has a bus_type, has host drivers which are sometimes
> part of the ethernet controller, but can also be stand-alone devices
> shared between multiple ethernet controllers.
>
> PHYs are a kind of MDIO device which are members of the MDIO bus
> type. Each PHY (and switch) has a numerical address, and identifying
> numbers within its register set which identifies the manufacturer
> and device type. We have device_driver objects for these.
>
> Expanding the above diagram to make it (hopefully) even clearer,
> we can have this classic setup:
>
> CPU
> System <-B-> Ethernet controller <-P-> PHY <---> network cable
> MDIO bus -------M------^
>
> Or, in the case of two DSA switches attached to an Ethernet controller:
>
> |~~~~~~~~|
> System <-B-> Ethernet controller <-P-> Switch <-P-> PHY1 <--> network cable
> MDIO bus ----+--M---> 1 <-P-> PHY2 <--> network cable
> | | ... |
> | | <-P-> PHYn <--> network cable
> | |....^...| |
> | | `---M---'
> | P
> | |
> | |~~~~v~~~|
> `------> Switch <-P-> PHY1 <--> network cable
> | 2 ... |
> | <-P-> PHYn <--> network cable
> |........| |
> `---M---'
>
> The problem that the DSA guys are trying to deal with is how to
> represent the link between the DSA switches (which are devices
> sitting off their controlling bus - the MDIO bus) and the ethernet
> controller associated with that collection of devices, be it a
> switch or PHY.
>
> Merely changing the parent/child relationships to try and solve
> one issue just creates exactly the same problem elsewhere.
Exactly!
>
> So, I hope with these diagrams, you can see that trying to make
> the ethernet controller a child device of the DSA switches
> means that (eg) it's no longer a PCI device, which is rather
> absurd, especially when considering that what happens to the
> right of the ethernet controller in the diagrams above is
> normally external chips to the SoC or ethernet device.
>
Indeed.
Back to the actual code that triggered this discussion, the whole
purpose is just a safeguard. Given a device reference, we can assume
that it is indeed the backing device for a net_device, and we could do a
to_net_device() right away (and crash if someone did not write correct
platform_data structures), or, by walking the device tree (the device
driver model one) we can make sure it does belong in the proper class
and this is indeed what we think it is.
HTH
--
Florian
^ permalink raw reply
* Re: Setting link down or up in software
From: Måns Rullgård @ 2017-01-19 17:56 UTC (permalink / raw)
To: Mason; +Cc: Zefir Kurtisi, netdev, Florian Fainelli, Andrew Lunn,
Thibaud Cornic
In-Reply-To: <1ac88f50-30c5-fbaf-11ff-2d42490b5801@free.fr>
Mason <slash.tmp@free.fr> writes:
> One thing I find confusing... If the 8035 could work with the generic
> PHY driver, what's the point of the at803x.ko driver?
Almost all Ethernet PHYs support the basic operation defined the by the
standard. Many have additional non-standardised features that require a
specific driver. Interrupts, for example.
--
Måns Rullgård
^ permalink raw reply
* Re: [PATCH iproute2 net-next] tc: m_csum: add support for SCTP checksum
From: Jiri Benc @ 2017-01-19 18:24 UTC (permalink / raw)
To: Davide Caratti; +Cc: Stephen Hemminger, Gregoire Baron, netdev
In-Reply-To: <d979c4187228759f94c3b6c8504b16783e03bdc6.1484846369.git.dcaratti@redhat.com>
On Thu, 19 Jan 2017 18:26:42 +0100, Davide Caratti wrote:
> 'sctp' parameter can now be used as 'csum' target to enable CRC32c
> computation on SCTP packets.
>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
> tc/m_csum.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
Please also update the tc-csum.8 man page.
Thanks,
Jiri
^ permalink raw reply
* Re: [PATCH net-next] vxlan: preserve type of dst_port parm for encap_bypass_if_local()
From: Jiri Benc @ 2017-01-19 18:16 UTC (permalink / raw)
To: Lance Richardson; +Cc: netdev
In-Reply-To: <1484771097-5692-1-git-send-email-lrichard@redhat.com>
On Wed, 18 Jan 2017 15:24:57 -0500, Lance Richardson wrote:
> Eliminate sparse warning by maintaining type of dst_port
> as __be16.
Fixes: fee1fad7c73d ("vxlan: simplify RTF_LOCAL handling.")
> Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
^ 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