* [net-next 0/6][pull request] 10GbE Intel Wired LAN Driver Updates 2018-07-26
From: Jeff Kirsher @ 2018-07-26 17:40 UTC (permalink / raw)
To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene
This series contains updates to ixgbe and igb.
Tony fixes ixgbe to add checks to ensure jumbo frames or LRO get enabled
after an XDP program is loaded.
Shannon Nelson adds the missing security configuration registers to the
ixgbe register dump, which will help in debugging.
Christian Grönke fixes an issue in igb that occurs on SGMII based SPF
mdoules, by reverting changes from 2 previous patches. The issue was
that initialization would fail on the fore mentioned modules because the
driver would try to reset the PHY before obtaining the PHY address of
the SGMII attached PHY.
Venkatesh Srinivas replaces wmb() with dma_wmb() for doorbell writes,
which avoids SFENCEs before the doorbell writes.
Alex cleans up and refactors ixgbe Tx/Rx shutdown to reduce time needed
to stop the device. The code refactor allows us to take the completion
time into account when disabling queues, so that on some platforms with
higher completion times, would not result in receive queues disabled
messages.
The following are changes since commit dc66fe43b7ebdb53628dcbc1f8f15de3e000aacf:
rds: send: Fix dead code in rds_sendmsg
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 10GbE
Alexander Duyck (2):
ixgbe: Reorder Tx/Rx shutdown to reduce time needed to stop device
ixgbe: Refactor queue disable logic to take completion time into
account
Christian Grönke (1):
igb: Remove superfluous reset to PHY and page 0 selection
Shannon Nelson (1):
ixgbe: add ipsec security registers into ethtool register dump
Tony Nguyen (1):
ixgbe: Do not allow LRO or MTU change with XDP
Venkatesh Srinivas (1):
igb: Use dma_wmb() instead of wmb() before doorbell writes
drivers/net/ethernet/intel/igb/e1000_82575.c | 12 -
drivers/net/ethernet/intel/igb/igb_main.c | 4 +-
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 +-
.../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 42 +--
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 300 ++++++++++++++----
5 files changed, 250 insertions(+), 111 deletions(-)
--
2.17.1
^ permalink raw reply
* Re: [PATCH 0/7] Add clock config and pm support to bcm iProc mdio mux
From: Andrew Lunn @ 2018-07-26 18:52 UTC (permalink / raw)
To: Arun Parameswaran
Cc: David S. Miller, Florian Fainelli, Rob Herring, Mark Rutland,
Ray Jui, Scott Branden, Catalin Marinas, Will Deacon, netdev,
devicetree, linux-arm-kernel, linux-kernel,
bcm-kernel-feedback-list
In-Reply-To: <1532630184-29450-1-git-send-email-arun.parameswaran@broadcom.com>
On Thu, Jul 26, 2018 at 11:36:17AM -0700, Arun Parameswaran wrote:
> Hi,
> The patchset is based on David Miller's "net" repo.
Hi Arun
"net" is intended for bug fixes. This looks like new features, so
should be against net-next". Please read the netdev FAQ.
Andrew
^ permalink raw reply
* [PATCH v1 net-next] igb: Use an advanced ctx descriptor for launchtime
From: Jesus Sanchez-Palencia @ 2018-07-26 17:20 UTC (permalink / raw)
To: intel-wired-lan; +Cc: netdev, jeffrey.t.kirsher, Jesus Sanchez-Palencia
On i210, Launchtime (TxTime) requires the usage of an "Advanced
Transmit Context Descriptor" for retrieving the timestamp of a packet.
The igb driver correctly builds such descriptor on the segmentation
flow (i.e. igb_tso()) or on the checksum one (i.e. igb_tx_csum()), but the
feature is broken for AF_PACKET if the IGB_TX_FLAGS_VLAN is not set,
which happens due to an early return on igb_tx_csum().
This flag is only set by the kernel when a VLAN interface is used,
thus we can't just rely on it. Here we are fixing this issue by checking
if launchtime is enabled for the current tx_ring before performing the
early return.
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index e3a0c02721c9..fa1089defcd5 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5816,7 +5816,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first)
if (skb->ip_summed != CHECKSUM_PARTIAL) {
csum_failed:
- if (!(first->tx_flags & IGB_TX_FLAGS_VLAN))
+ if (!(first->tx_flags & IGB_TX_FLAGS_VLAN)
+ && !tx_ring->launchtime_enable)
return;
goto no_csum;
}
--
2.18.0
^ permalink raw reply related
* [PATCH 7/7] net: phy: Add pm support for scan ctrl register to bcm mdio mux
From: Arun Parameswaran @ 2018-07-26 18:36 UTC (permalink / raw)
To: David S. Miller, Florian Fainelli, Andrew Lunn, Rob Herring,
Mark Rutland, Ray Jui, Scott Branden, Catalin Marinas,
Will Deacon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
bcm-kernel-feedback-list, Arun Parameswaran
In-Reply-To: <1532630184-29450-1-git-send-email-arun.parameswaran@broadcom.com>
Add support for saving and restoring the 'scan control' register
in the Broadcom iProc mdio mux driver.
Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
---
drivers/net/phy/mdio-mux-bcm-iproc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
index 89c18d6..d1fce1e 100644
--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
+++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -26,6 +26,9 @@
#define MDIO_RATE_ADJ_INT_OFFSET 0x004
#define MDIO_RATE_ADJ_DIVIDENT_SHIFT 16
+#define MDIO_SCAN_CTRL_OFFSET 0x008
+#define MDIO_SCAN_CTRL_OVERRIDE_EXT_MSTR 28
+
#define MDIO_PARAM_OFFSET 0x23c
#define MDIO_PARAM_MIIM_CYCLE 29
#define MDIO_PARAM_INTERNAL_SEL 25
@@ -51,7 +54,7 @@
#define MDIO_OPERATING_FREQUENCY 11000000
#define MDIO_RATE_ADJ_DIVIDENT 1
-#define MDIO_NUM_OF_REGS_TO_RESTORE 2
+#define MDIO_NUM_OF_REGS_TO_RESTORE 3
struct iproc_mdiomux_desc {
void *mux_handle;
@@ -68,6 +71,7 @@ struct iproc_mdiomux_desc {
static const u16 restore_reg_offsets[MDIO_NUM_OF_REGS_TO_RESTORE] = {
MDIO_RATE_ADJ_EXT_OFFSET,
MDIO_RATE_ADJ_INT_OFFSET,
+ MDIO_SCAN_CTRL_OVERRIDE_EXT_MSTR,
};
#endif
--
1.9.1
^ permalink raw reply related
* [PATCH 6/7] net: phy: Add pm support to Broadcom iProc mdio mux driver
From: Arun Parameswaran @ 2018-07-26 18:36 UTC (permalink / raw)
To: David S. Miller, Florian Fainelli, Andrew Lunn, Rob Herring,
Mark Rutland, Ray Jui, Scott Branden, Catalin Marinas,
Will Deacon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
bcm-kernel-feedback-list, Arun Parameswaran
In-Reply-To: <1532630184-29450-1-git-send-email-arun.parameswaran@broadcom.com>
Add support for suspend and resume to the Broadcom iProc mdio
mux driver.
Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
---
drivers/net/phy/mdio-mux-bcm-iproc.c | 42 ++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
index 6b400dd..89c18d6 100644
--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
+++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -51,13 +51,25 @@
#define MDIO_OPERATING_FREQUENCY 11000000
#define MDIO_RATE_ADJ_DIVIDENT 1
+#define MDIO_NUM_OF_REGS_TO_RESTORE 2
+
struct iproc_mdiomux_desc {
void *mux_handle;
void __iomem *base;
struct device *dev;
struct mii_bus *mii_bus;
struct clk *core_clk;
+#ifdef CONFIG_PM_SLEEP
+ u32 restore_regs[MDIO_NUM_OF_REGS_TO_RESTORE];
+#endif
+};
+
+#ifdef CONFIG_PM_SLEEP
+static const u16 restore_reg_offsets[MDIO_NUM_OF_REGS_TO_RESTORE] = {
+ MDIO_RATE_ADJ_EXT_OFFSET,
+ MDIO_RATE_ADJ_INT_OFFSET,
};
+#endif
static void mdio_mux_iproc_config_clk(struct iproc_mdiomux_desc *md)
{
@@ -258,6 +270,35 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int mdio_mux_iproc_suspend(struct device *dev)
+{
+ int i;
+ struct iproc_mdiomux_desc *md = dev_get_drvdata(dev);
+
+ for (i = 0; i < MDIO_NUM_OF_REGS_TO_RESTORE; i++)
+ md->restore_regs[i] = readl(md->base +
+ restore_reg_offsets[i]);
+
+ return 0;
+}
+
+static int mdio_mux_iproc_resume(struct device *dev)
+{
+ int i;
+ struct iproc_mdiomux_desc *md = dev_get_drvdata(dev);
+
+ for (i = 0; i < MDIO_NUM_OF_REGS_TO_RESTORE; i++)
+ writel(md->restore_regs[i],
+ md->base + restore_reg_offsets[i]);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(mdio_mux_iproc_pm_ops,
+ mdio_mux_iproc_suspend, mdio_mux_iproc_resume);
+
static const struct of_device_id mdio_mux_iproc_match[] = {
{
.compatible = "brcm,mdio-mux-iproc",
@@ -270,6 +311,7 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev)
.driver = {
.name = "mdio-mux-iproc",
.of_match_table = mdio_mux_iproc_match,
+ .pm = &mdio_mux_iproc_pm_ops,
},
.probe = mdio_mux_iproc_probe,
.remove = mdio_mux_iproc_remove,
--
1.9.1
^ permalink raw reply related
* [PATCH 4/7] dt-bindings: net: Add clock handle to Broadcom iProc mdio mux
From: Arun Parameswaran @ 2018-07-26 18:36 UTC (permalink / raw)
To: David S. Miller, Florian Fainelli, Andrew Lunn, Rob Herring,
Mark Rutland, Ray Jui, Scott Branden, Catalin Marinas,
Will Deacon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
bcm-kernel-feedback-list, Arun Parameswaran
In-Reply-To: <1532630184-29450-1-git-send-email-arun.parameswaran@broadcom.com>
Add clock phandle, of the core clock driving the mdio block, as an
optional property to the Broadcom iProc mdio mux block.
The clock, when specified, will be used to setup the rate adjust registers
in the mdio to derrive the mdio's operating frequency.
Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
---
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt b/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
index dc8aa68..b58843f 100644
--- a/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
+++ b/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
@@ -13,6 +13,9 @@ MDIO multiplexer node:
Every non-ethernet PHY requires a compatible so that it could be probed based
on this compatible string.
+Optional properties:
+- clocks: phandle of the core clock which drives the mdio block.
+
Additional information regarding generic multiplexer properties can be found
at- Documentation/devicetree/bindings/net/mdio-mux.txt
--
1.9.1
^ permalink raw reply related
* [PATCH 2/7] net: phy: Fix the register offsets in Broadcom iProc mdio mux driver
From: Arun Parameswaran @ 2018-07-26 18:36 UTC (permalink / raw)
To: David S. Miller, Florian Fainelli, Andrew Lunn, Rob Herring,
Mark Rutland, Ray Jui, Scott Branden, Catalin Marinas,
Will Deacon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
bcm-kernel-feedback-list, Arun Parameswaran
In-Reply-To: <1532630184-29450-1-git-send-email-arun.parameswaran@broadcom.com>
Modify the register offsets in the Broadcom iProc mdio mux to start
from the top of the register address space.
Earlier the base address specified was from the middle of the block's
register space. The base address will now point to the start of the
mdio's address space. The offsets have been fixed to match this.
Fixes: 98bc865a1ec8 ("net: mdio-mux: Add MDIO mux driver for iProc SoCs")
Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
---
drivers/net/phy/mdio-mux-bcm-iproc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
index 0831b71..dc65e95 100644
--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
+++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -22,7 +22,7 @@
#include <linux/mdio-mux.h>
#include <linux/delay.h>
-#define MDIO_PARAM_OFFSET 0x00
+#define MDIO_PARAM_OFFSET 0x23c
#define MDIO_PARAM_MIIM_CYCLE 29
#define MDIO_PARAM_INTERNAL_SEL 25
#define MDIO_PARAM_BUS_ID 22
@@ -30,15 +30,15 @@
#define MDIO_PARAM_PHY_ID 16
#define MDIO_PARAM_PHY_DATA 0
-#define MDIO_READ_OFFSET 0x04
+#define MDIO_READ_OFFSET 0x240
#define MDIO_READ_DATA_MASK 0xffff
-#define MDIO_ADDR_OFFSET 0x08
+#define MDIO_ADDR_OFFSET 0x244
-#define MDIO_CTRL_OFFSET 0x0C
+#define MDIO_CTRL_OFFSET 0x248
#define MDIO_CTRL_WRITE_OP 0x1
#define MDIO_CTRL_READ_OP 0x2
-#define MDIO_STAT_OFFSET 0x10
+#define MDIO_STAT_OFFSET 0x24c
#define MDIO_STAT_DONE 1
#define BUS_MAX_ADDR 32
--
1.9.1
^ permalink raw reply related
* [PATCH 1/7] dt-bindings: net: Fix Broadcom iProc mdio mux driver base address
From: Arun Parameswaran @ 2018-07-26 18:36 UTC (permalink / raw)
To: David S. Miller, Florian Fainelli, Andrew Lunn, Rob Herring,
Mark Rutland, Ray Jui, Scott Branden, Catalin Marinas,
Will Deacon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel,
bcm-kernel-feedback-list, Arun Parameswaran
In-Reply-To: <1532630184-29450-1-git-send-email-arun.parameswaran@broadcom.com>
Modify the base address passed to the Broadcom iProc MDIO mux driver
to point to the start of the block's register address space.
Fixes: ce8d5dbfd64f ("Add DT binding doc for Broadcom MDIO bus multiplexer")
Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
---
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt b/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
index dfe287a..dc8aa68 100644
--- a/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
+++ b/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
@@ -18,9 +18,9 @@ at- Documentation/devicetree/bindings/net/mdio-mux.txt
for example:
- mdio_mux_iproc: mdio-mux@6602023c {
+ mdio_mux_iproc: mdio-mux@66020000 {
compatible = "brcm,mdio-mux-iproc";
- reg = <0x6602023c 0x14>;
+ reg = <0x66020000 0x250>;
#address-cells = <1>;
#size-cells = <0>;
--
1.9.1
^ permalink raw reply related
* [PATCH bpf] bpf: btf: Use exact btf value_size match in map_check_btf()
From: Martin KaFai Lau @ 2018-07-26 16:57 UTC (permalink / raw)
To: netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team
The current map_check_btf() in BPF_MAP_TYPE_ARRAY rejects
'> map->value_size' to ensure map_seq_show_elem() will not
access things beyond an array element.
Yonghong suggested that using '!=' is a more correct
check. The 8 bytes round_up on value_size is stored
in array->elem_size. Hence, using '!=' on map->value_size
is a proper check.
This patch also adds new tests to check the btf array
key type and value type. Two of these new tests verify
the btf's value_size (the change in this patch).
It also fixes two existing tests that wrongly encoded
a btf's type size (pprint_test) and the value_type_id (in one
of the raw_tests[]). However, that do not affect these two
BTF verification tests before or after this test changes.
These two tests mainly failed at array creation time after
this patch.
Fixes: a26ca7c982cb ("bpf: btf: Add pretty print support to the basic arraymap")
Suggested-by: Yonghong Song <yhs@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
kernel/bpf/arraymap.c | 2 +-
tools/testing/selftests/bpf/test_btf.c | 86 +++++++++++++++++++++++++-
2 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 544e58f5f642..2aa55d030c77 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -378,7 +378,7 @@ static int array_map_check_btf(const struct bpf_map *map, const struct btf *btf,
return -EINVAL;
value_type = btf_type_id_size(btf, &btf_value_id, &value_size);
- if (!value_type || value_size > map->value_size)
+ if (!value_type || value_size != map->value_size)
return -EINVAL;
return 0;
diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
index 402c0f7cc418..ffdd27737c9e 100644
--- a/tools/testing/selftests/bpf/test_btf.c
+++ b/tools/testing/selftests/bpf/test_btf.c
@@ -507,7 +507,7 @@ static struct btf_raw_test raw_tests[] = {
.key_size = sizeof(int),
.value_size = sizeof(void *) * 4,
.key_type_id = 1,
- .value_type_id = 4,
+ .value_type_id = 5,
.max_entries = 4,
},
@@ -1292,6 +1292,88 @@ static struct btf_raw_test raw_tests[] = {
.err_str = "type != 0",
},
+{
+ .descr = "arraymap invalid btf key (a bit field)",
+ .raw_types = {
+ /* int */ /* [1] */
+ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
+ /* 32 bit int with 32 bit offset */ /* [2] */
+ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 32, 32, 8),
+ BTF_END_RAW,
+ },
+ .str_sec = "",
+ .str_sec_size = sizeof(""),
+ .map_type = BPF_MAP_TYPE_ARRAY,
+ .map_name = "array_map_check_btf",
+ .key_size = sizeof(int),
+ .value_size = sizeof(int),
+ .key_type_id = 2,
+ .value_type_id = 1,
+ .max_entries = 4,
+ .map_create_err = true,
+},
+
+{
+ .descr = "arraymap invalid btf key (!= 32 bits)",
+ .raw_types = {
+ /* int */ /* [1] */
+ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
+ /* 16 bit int with 0 bit offset */ /* [2] */
+ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 16, 2),
+ BTF_END_RAW,
+ },
+ .str_sec = "",
+ .str_sec_size = sizeof(""),
+ .map_type = BPF_MAP_TYPE_ARRAY,
+ .map_name = "array_map_check_btf",
+ .key_size = sizeof(int),
+ .value_size = sizeof(int),
+ .key_type_id = 2,
+ .value_type_id = 1,
+ .max_entries = 4,
+ .map_create_err = true,
+},
+
+{
+ .descr = "arraymap invalid btf value (too small)",
+ .raw_types = {
+ /* int */ /* [1] */
+ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
+ BTF_END_RAW,
+ },
+ .str_sec = "",
+ .str_sec_size = sizeof(""),
+ .map_type = BPF_MAP_TYPE_ARRAY,
+ .map_name = "array_map_check_btf",
+ .key_size = sizeof(int),
+ /* btf_value_size < map->value_size */
+ .value_size = sizeof(__u64),
+ .key_type_id = 1,
+ .value_type_id = 1,
+ .max_entries = 4,
+ .map_create_err = true,
+},
+
+{
+ .descr = "arraymap invalid btf value (too big)",
+ .raw_types = {
+ /* int */ /* [1] */
+ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
+ BTF_END_RAW,
+ },
+ .str_sec = "",
+ .str_sec_size = sizeof(""),
+ .map_type = BPF_MAP_TYPE_ARRAY,
+ .map_name = "array_map_check_btf",
+ .key_size = sizeof(int),
+ /* btf_value_size > map->value_size */
+ .value_size = sizeof(__u16),
+ .key_type_id = 1,
+ .value_type_id = 1,
+ .max_entries = 4,
+ .map_create_err = true,
+},
+
}; /* struct btf_raw_test raw_tests[] */
static const char *get_next_str(const char *start, const char *end)
@@ -2051,7 +2133,7 @@ static struct btf_raw_test pprint_test = {
BTF_ENUM_ENC(NAME_TBD, 2),
BTF_ENUM_ENC(NAME_TBD, 3),
/* struct pprint_mapv */ /* [16] */
- BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 8), 28),
+ BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 8), 32),
BTF_MEMBER_ENC(NAME_TBD, 11, 0), /* uint32_t ui32 */
BTF_MEMBER_ENC(NAME_TBD, 10, 32), /* uint16_t ui16 */
BTF_MEMBER_ENC(NAME_TBD, 12, 64), /* int32_t si32 */
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst
From: Arthur Fabre @ 2018-07-26 16:52 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: Alexei Starovoitov, netdev
In-Reply-To: <bd65e777-8a8b-e382-c444-f1c44cd5e90b@iogearbox.net>
[-- Attachment #1: Type: text/plain, Size: 2301 bytes --]
Oops, gmail seems to have mangled everything. Will resend using git
send-email.
I've added the test cases for mov64, but I'm not sure of the expected mov32
behavior.
Currently coerce_reg_to_size() is called after mark_reg_unknown(),
which sets the bounds to 64bits. coerce_reg_to_size() resets the bounds
again,
as they're too "wide" to fit the new size. It sets SMIN = UMIN = 0,
which seems weird. Shouldn't SMIN be 1 << (size * 8 - 1)? Same applies for
SMAX.
Should mov32 always mark the dst as unbounded?
On Thu, Jul 26, 2018 at 1:42 AM, Daniel Borkmann <daniel@iogearbox.net>
wrote:
> On 07/26/2018 12:08 AM, Arthur Fabre wrote:
> > When check_alu_op() handles a BPF_MOV between two registers,
> > it calls check_reg_arg() on the dst register, marking it as unbounded.
> > If the src and dst register are the same, this marks the src as
> > unbounded, which can lead to unexpected errors for further checks that
> > rely on bounds info.
> >
> > check_alu_op() now only marks the dst register as unbounded if it
> > different from the src register.
> >
> > Signed-off-by: Arthur Fabre <afabre@cloudflare.com>
> > ---
> > kernel/bpf/verifier.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 63aaac52a265..ddfe3c544a80 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -3238,8 +3238,9 @@ static int check_alu_op(struct bpf_verifier_env
> > *env, struct bpf_insn *insn)
> > }
> > }
> >
> > - /* check dest operand */
> > - err = check_reg_arg(env, insn->dst_reg, DST_OP);
> > + /* check dest operand, only mark if dest != src */
> > + err = check_reg_arg(env, insn->dst_reg,
> > + insn->dst_reg == insn->src_reg ?
> > DST_OP_NO_MARK : DST_OP);
> > if (err)
> > return err;
> >
>
> Thanks a lot for the patch! Looks like it's corrupted wrt newline.
>
> Please also add test cases to tools/testing/selftests/bpf/test_verifier.c
> for the cases of mov64 and mov32 where in each src==dst and src!=dst; mov32
> should mark it as unbounded but not former, so would be good to keep
> tracking
> that in selftests.
>
[-- Attachment #2: Type: text/html, Size: 3141 bytes --]
^ permalink raw reply
* Re: [patch net-next] selftests: forwarding: add tests for TC chain get and dump operations
From: David Miller @ 2018-07-26 16:35 UTC (permalink / raw)
To: jiri
Cc: netdev, jhs, xiyou.wangcong, jakub.kicinski, simon.horman,
john.hurley, dsahern, mlxsw, sridhar.samudrala
In-Reply-To: <20180726093834.3560-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@resnulli.us>
Date: Thu, 26 Jul 2018 11:38:34 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Applied, thanks Jiri.
^ permalink raw reply
* [patch net-next RFC] net: sched: don't dump chains only held by actions
From: Jiri Pirko @ 2018-07-26 16:31 UTC (permalink / raw)
To: netdev; +Cc: davem, jhs, xiyou.wangcong, mlxsw
From: Jiri Pirko <jiri@mellanox.com>
In case a chain is empty and not explicitly created by a user,
such chain should not exist. The only exception is if there is
an action "goto chain" pointing to it. In that case, don't show the
chain in the dump. Track the chain references held by actions and
use them to find out if a chain should or should not be shown
in chain dump.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
include/net/pkt_cls.h | 3 +++
include/net/sch_generic.h | 1 +
net/sched/act_api.c | 4 +--
net/sched/cls_api.c | 68 +++++++++++++++++++++++++++++++++++++++--------
4 files changed, 63 insertions(+), 13 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index a3101582f642..6d02f31abba8 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -39,7 +39,10 @@ bool tcf_queue_work(struct rcu_work *rwork, work_func_t func);
#ifdef CONFIG_NET_CLS
struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
bool create);
+struct tcf_chain *tcf_chain_get_by_act(struct tcf_block *block,
+ u32 chain_index);
void tcf_chain_put(struct tcf_chain *chain);
+void tcf_chain_put_by_act(struct tcf_chain *chain);
void tcf_block_netif_keep_dst(struct tcf_block *block);
int tcf_block_get(struct tcf_block **p_block,
struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 085c509c8674..c5432362dc26 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -314,6 +314,7 @@ struct tcf_chain {
struct tcf_block *block;
u32 index; /* chain index */
unsigned int refcnt;
+ unsigned int action_refcnt;
bool explicitly_created;
const struct tcf_proto_ops *tmplt_ops;
void *tmplt_priv;
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 148a89ab789b..b43df1e25c6d 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -36,7 +36,7 @@ static int tcf_action_goto_chain_init(struct tc_action *a, struct tcf_proto *tp)
if (!tp)
return -EINVAL;
- a->goto_chain = tcf_chain_get(tp->chain->block, chain_index, true);
+ a->goto_chain = tcf_chain_get_by_act(tp->chain->block, chain_index);
if (!a->goto_chain)
return -ENOMEM;
return 0;
@@ -44,7 +44,7 @@ static int tcf_action_goto_chain_init(struct tc_action *a, struct tcf_proto *tp)
static void tcf_action_goto_chain_fini(struct tc_action *a)
{
- tcf_chain_put(a->goto_chain);
+ tcf_chain_put_by_act(a->goto_chain);
}
static void tcf_action_goto_chain_exec(const struct tc_action *a,
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 75cce2819de9..76035cd6e3bf 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -262,6 +262,25 @@ static void tcf_chain_hold(struct tcf_chain *chain)
++chain->refcnt;
}
+static void tcf_chain_hold_by_act(struct tcf_chain *chain)
+{
+ ++chain->action_refcnt;
+}
+
+static void tcf_chain_release_by_act(struct tcf_chain *chain)
+{
+ --chain->action_refcnt;
+}
+
+static bool tcf_chain_is_zombie(struct tcf_chain *chain)
+{
+ /* In case all the references are action references, this
+ * chain is a zombie and should not be listed in the chain
+ * dump list.
+ */
+ return chain->refcnt == chain->action_refcnt;
+}
+
static struct tcf_chain *tcf_chain_lookup(struct tcf_block *block,
u32 chain_index)
{
@@ -298,6 +317,15 @@ struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
}
EXPORT_SYMBOL(tcf_chain_get);
+struct tcf_chain *tcf_chain_get_by_act(struct tcf_block *block, u32 chain_index)
+{
+ struct tcf_chain *chain = tcf_chain_get(block, chain_index, true);
+
+ tcf_chain_hold_by_act(chain);
+ return chain;
+}
+EXPORT_SYMBOL(tcf_chain_get_by_act);
+
static void tc_chain_tmplt_del(struct tcf_chain *chain);
void tcf_chain_put(struct tcf_chain *chain)
@@ -310,6 +338,13 @@ void tcf_chain_put(struct tcf_chain *chain)
}
EXPORT_SYMBOL(tcf_chain_put);
+void tcf_chain_put_by_act(struct tcf_chain *chain)
+{
+ tcf_chain_release_by_act(chain);
+ tcf_chain_put(chain);
+}
+EXPORT_SYMBOL(tcf_chain_put_by_act);
+
static void tcf_chain_put_explicitly_created(struct tcf_chain *chain)
{
if (chain->explicitly_created)
@@ -1803,17 +1838,26 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n,
chain = tcf_chain_lookup(block, chain_index);
if (n->nlmsg_type == RTM_NEWCHAIN) {
if (chain) {
- NL_SET_ERR_MSG(extack, "Filter chain already exists");
- return -EEXIST;
- }
- if (!(n->nlmsg_flags & NLM_F_CREATE)) {
- NL_SET_ERR_MSG(extack, "Need both RTM_NEWCHAIN and NLM_F_CREATE to create a new chain");
- return -ENOENT;
- }
- chain = tcf_chain_create(block, chain_index);
- if (!chain) {
- NL_SET_ERR_MSG(extack, "Failed to create filter chain");
- return -ENOMEM;
+ if (tcf_chain_is_zombie(chain)) {
+ /* The chain exists only because there is
+ * some action referencing it, meaning it
+ * is a zombie.
+ */
+ tcf_chain_hold(chain);
+ } else {
+ NL_SET_ERR_MSG(extack, "Filter chain already exists");
+ return -EEXIST;
+ }
+ } else {
+ if (!(n->nlmsg_flags & NLM_F_CREATE)) {
+ NL_SET_ERR_MSG(extack, "Need both RTM_NEWCHAIN and NLM_F_CREATE to create a new chain");
+ return -ENOENT;
+ }
+ chain = tcf_chain_create(block, chain_index);
+ if (!chain) {
+ NL_SET_ERR_MSG(extack, "Failed to create filter chain");
+ return -ENOMEM;
+ }
}
} else {
if (!chain) {
@@ -1944,6 +1988,8 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
index++;
continue;
}
+ if (tcf_chain_is_zombie(chain))
+ continue;
err = tc_chain_fill_node(chain, net, skb, block,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
--
2.14.4
^ permalink raw reply related
* [patch net-next] net: sched: unmark chain as explicitly created on delete
From: Jiri Pirko @ 2018-07-26 16:27 UTC (permalink / raw)
To: netdev; +Cc: davem, jhs, xiyou.wangcong, mlxsw
From: Jiri Pirko <jiri@mellanox.com>
Once user manually deletes the chain using "chain del", the chain cannot
be marked as explicitly created anymore.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Fixes: 32a4f5ecd738 ("net: sched: introduce chain object to uapi")
---
net/sched/cls_api.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index f3d78c23338e..75cce2819de9 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1844,6 +1844,7 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n,
* to the chain previously taken during addition.
*/
tcf_chain_put_explicitly_created(chain);
+ chain->explicitly_created = false;
break;
case RTM_GETCHAIN:
err = tc_chain_notify(chain, skb, n->nlmsg_seq,
--
2.14.4
^ permalink raw reply related
* Re: [PATCH V3 bpf] xdp: add NULL pointer check in __xdp_return()
From: Björn Töpel @ 2018-07-26 16:02 UTC (permalink / raw)
To: Taehee Yoo
Cc: Daniel Borkmann, ast, Netdev, Björn Töpel,
Jesper Dangaard Brouer, kafai, Jakub Kicinski
In-Reply-To: <20180726141703.6236-1-ap420073@gmail.com>
Den tors 26 juli 2018 kl 16:18 skrev Taehee Yoo <ap420073@gmail.com>:
>
> rhashtable_lookup() can return NULL. so that NULL pointer
> check routine should be added.
>
Thanks Taehee!
Acked-by: Björn Töpel <bjorn.topel@intel.com>
> Fixes: 02b55e5657c3 ("xdp: add MEM_TYPE_ZERO_COPY")
> Acked-by: Martin KaFai Lau <kafai@fb.com>
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
> ---
> V3 : reduce code line
> V2 : add WARN_ON_ONCE when xa is NULL.
> net/core/xdp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index 9d1f220..6771f18 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -345,7 +345,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
> rcu_read_lock();
> /* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */
> xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
> - xa->zc_alloc->free(xa->zc_alloc, handle);
> + if (!WARN_ON_ONCE(!xa))
> + xa->zc_alloc->free(xa->zc_alloc, handle);
> rcu_read_unlock();
> default:
> /* Not possible, checked in xdp_rxq_info_reg_mem_model() */
> --
> 2.9.3
>
^ permalink raw reply
* Re: [Query]: DSA Understanding
From: Andrew Lunn @ 2018-07-26 15:39 UTC (permalink / raw)
To: Lad, Prabhakar; +Cc: netdev
In-Reply-To: <CA+V-a8uBoZ-vbJEkYdSBssgd+rG=ng6_JNpO5G4DtmLV409L0g@mail.gmail.com>
> I am bit confused on how dsa needs to be actually working,
> Q's
> 1] should I be running a dhcp server on eth1 (where switch is connected)
> so that devices connected on lan* devices get an ip ?
Nope. You need eth1 up, but otherwise you do not use it. Use the lanX
interfaces like normal Linux interfaces. Run your dhclient on lanX, etc.
>
> 2] From the device where switch is connected if the cpu port wants to send
> any data to any other user ports lan* how do i do it (just open
> socket on eth1 or lan*) ?
Just treat the lanX interfaces as normal Linux interfaces.
Andrew
^ permalink raw reply
* [PATCH v2] Add BPF_SYNCHRONIZE_MAPS bpf(2) command
From: Daniel Colascione @ 2018-07-26 16:51 UTC (permalink / raw)
To: joelaf
Cc: linux-kernel, timmurray, netdev, Alexei Starovoitov,
Lorenzo Colitti, Chenbo Feng, Mathieu Desnoyers,
Alexei Starovoitov, Daniel Borkmann, Daniel Colascione
In-Reply-To: <20180716202301.GB160902@joelaf.mtv.corp.google.com>
BPF_SYNCHRONIZE_MAPS waits for the release of any references to a BPF
map made by a BPF program that is running at the time the
BPF_SYNCHRONIZE_MAPS command is issued. The purpose of this command is
to provide a means for userspace to replace a BPF map with another,
newer version, then ensure that no component is still using the "old"
map before manipulating the "old" map in some way.
Signed-off-by: Daniel Colascione <dancol@google.com>
---
include/uapi/linux/bpf.h | 9 +++++++++
kernel/bpf/syscall.c | 13 +++++++++++++
2 files changed, 22 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index b7db3261c62d..5b27e9117d3e 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -75,6 +75,14 @@ struct bpf_lpm_trie_key {
__u8 data[0]; /* Arbitrary size */
};
+/* BPF_SYNCHRONIZE_MAPS waits for the release of any references to a
+ * BPF map made by a BPF program that is running at the time the
+ * BPF_SYNCHRONIZE_MAPS command is issued. The purpose of this command
+ * is to provide a means for userspace to replace a BPF map with
+ * another, newer version, then ensure that no component is still
+ * using the "old" map before manipulating the "old" map in some way.
+ */
+
/* BPF syscall commands, see bpf(2) man-page for details. */
enum bpf_cmd {
BPF_MAP_CREATE,
@@ -98,6 +106,7 @@ enum bpf_cmd {
BPF_BTF_LOAD,
BPF_BTF_GET_FD_BY_ID,
BPF_TASK_FD_QUERY,
+ BPF_SYNCHRONIZE_MAPS,
};
enum bpf_map_type {
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index a31a1ba0f8ea..8bbd1a5d01d1 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2274,6 +2274,19 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz
if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN))
return -EPERM;
+ if (cmd == BPF_SYNCHRONIZE_MAPS) {
+ if (uattr != NULL || size != 0)
+ return -EINVAL;
+ err = security_bpf(cmd, NULL, 0);
+ if (err < 0)
+ return err;
+ /* BPF programs always enter a critical section while
+ * they have a map reference outstanding.
+ */
+ synchronize_rcu();
+ return 0;
+ }
+
err = bpf_check_uarg_tail_zero(uattr, sizeof(attr), size);
if (err)
return err;
--
2.18.0.233.g985f88cf7e-goog
^ permalink raw reply related
* Re: [PATCH net-next] net: hns: Make many functions static
From: David Miller @ 2018-07-26 16:42 UTC (permalink / raw)
To: yuehaibing
Cc: yisen.zhuang, salil.mehta, linux-kernel, netdev, linyunsheng,
matthias.bgg, lipeng321
In-Reply-To: <20180726131958.15532-1-yuehaibing@huawei.com>
From: YueHaibing <yuehaibing@huawei.com>
Date: Thu, 26 Jul 2018 21:19:58 +0800
> Fixes the following sparse warning:
...
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied, thank you.
^ permalink raw reply
* Re: [Query]: DSA Understanding
From: Lad, Prabhakar @ 2018-07-26 15:20 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev
In-Reply-To: <20180726140818.GB8325@lunn.ch>
On Thu, Jul 26, 2018 at 3:08 PM, Andrew Lunn <andrew@lunn.ch> wrote:
>> Yes I am using fixed phy on slave1, following is my dts:
>
> Posting the original DTS file is better, not the decompiled version.
>
My bad will take care of it next time.
>>
>> ethernet@48484000 {
>> compatible = "ti,dra7-cpsw", "ti,cpsw";
>> ti,hwmods = "gmac";
>> clocks = <0x124 0x125>;
>> clock-names = "fck", "cpts";
>> cpdma_channels = <0x8>;
>> ale_entries = <0x400>;
>> bd_ram_size = <0x2000>;
>> mac_control = <0x20>;
>> slaves = <0x2>;
>> active_slave = <0x0>;
>> cpts_clock_mult = <0x784cfe14>;
>> cpts_clock_shift = <0x1d>;
>> reg = <0x48484000 0x1000 0x48485200 0x2e00>;
>> #address-cells = <0x1>;
>> #size-cells = <0x1>;
>> ti,no-idle;
>> interrupts = <0x0 0x14e 0x4 0x0 0x14f 0x4 0x0 0x150 0x4
>> 0x0 0x151 0x4>;
>> ranges;
>> syscon = <0x8>;
>> status = "okay";
>> pinctrl-names = "default", "sleep";
>> pinctrl-0 = <0x126 0x127>;
>> pinctrl-1 = <0x128 0x129>;
>> dual_emac;
>> linux,phandle = <0x500>;
>> phandle = <0x500>;
>
> So here is 0x500
>
>>
>> mdio@48485000 {
>> compatible = "ti,cpsw-mdio", "ti,davinci_mdio";
>> #address-cells = <0x1>;
>> #size-cells = <0x0>;
>> ti,hwmods = "davinci_mdio";
>> bus_freq = <0xf4240>;
>> reg = <0x48485000 0x100>;
>> status = "okay";
>> pinctrl-names = "default", "sleep";
>> pinctrl-0 = <0x12a>;
>> pinctrl-1 = <0x12b>;
>>
>> ethernet-phy@1 {
>> reg = <0x1>;
>> linux,phandle = <0x12c>;
>> phandle = <0x12c>;
>> };
>> };
>>
>> slave@48480200 {
>> mac-address = [00 00 00 00 00 00];
>> status = "okay";
>> phy-handle = <0x12c>;
>> phy-mode = "rgmii";
>> dual_emac_res_vlan = <0x1>;
>> };
>>
>> slave@48480300 {
>> mac-address = [00 00 00 00 00 00];
>> status = "okay";
>> phy-mode = "rgmii";
>> dual_emac_res_vlan = <0x2>;
>> linux,phandle = <0xf3>;
>> phandle = <0xf3>;
>
> This is the actual interface you are using and it has a phandle of
> 0xf3.
>
The dsa of_find_net_device_by_node() looks for ethernet device node,
but the above node is for the cpsw slave. I tried adding 0xf3 and got
probe defer,
that is the reason I added 0x500 (mdio) reference to cpu switch and
patched to pick
up eth1 instead of eth0.
>>
>> fixed-link {
>> speed = <0x3e8>;
>> full-duplex;
>> };
>> };
>>
>> cpsw-phy-sel@4a002554 {
>> compatible = "ti,dra7xx-cpsw-phy-sel";
>> reg = <0x4a002554 0x4>;
>> reg-names = "gmii-sel";
>> };
>> };
>>
>> spi@480ba000 {
>> compatible = "ti,omap4-mcspi";
>> reg = <0x480ba000 0x200>;
>> interrupts = <0x0 0x2b 0x4>;
>> #address-cells = <0x1>;
>> #size-cells = <0x0>;
>> ti,hwmods = "mcspi4";
>> ti,spi-num-cs = <0x1>;
>> dmas = <0xb2 0x46 0xb2 0x47>;
>> dma-names = "tx0", "rx0";
>> status = "okay";
>> ti,pindir-d0-out-d1-in;
>>
>> ksz9477@0 {
>> compatible = "microchip,ksz9477";
>> reg = <0x0>;
>> spi-max-frequency = <0x2dc6c00>;
>> spi-cpha;
>> spi-cpol;
>>
>> ports {
>> #address-cells = <0x1>;
>> #size-cells = <0x0>;
>>
>> port@0 {
>> reg = <0x0>;
>> label = "lan0";
>> };
>>
>> port@1 {
>> reg = <0x1>;
>> label = "lan1";
>> };
>>
>> port@2 {
>> reg = <0x2>;
>> label = "lan2";
>> };
>>
>> port@3 {
>> reg = <0x3>;
>> label = "lan3";
>> };
>>
>> port@4 {
>> reg = <0x4>;
>> label = "lan4";
>> };
>>
>> port@5 {
>> reg = <0x5>;
>> label = "cpu";
>> ethernet = <0x500>;
>
> So here you are pointing to the container node, not the actual
> interface. You talk of having to patch DSA. That i would say is
> wrong. You should be using the phandle of the actual interface.
>
As mentioned due to above reason. agreed the patch is wrong.
>> };
>>
>> port@6 {
>> reg = <0x6>;
>> label = "lan6";
>> };
>> };
>> };
>> };
>>
>> Where port 6 of ksz9897 chip is connected to slave 1 (eth1) of cpsw
>> via rgmii interface. Following is the dmesg log:
>>
>> [ 2.596958] Microchip KSZ9477 dsa-0.0:00: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:00, irq=POLL)
>> [ 2.714959] Microchip KSZ9477 dsa-0.0:01: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:01, irq=POLL)
>> [ 2.832958] Microchip KSZ9477 dsa-0.0:02: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:02, irq=POLL)
>> [ 2.950960] Microchip KSZ9477 dsa-0.0:03: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:03, irq=POLL)
>> [ 3.068958] Microchip KSZ9477 dsa-0.0:04: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:04, irq=POLL)
>> [ 3.080953] Generic PHY dsa-0.0:06: attached PHY driver [Generic
>> PHY] (mii_bus:phy_addr=dsa-0.0:06, irq=POLL)
>
> You might also need a fixed-link for the cpu port of the switch.
>
> What do the statistics counters show? Is it trying to send/receiver
> frames out eth1? Are bad frames received? Maybe you need to set rgmii
> delays?
>
Yes I can see the statistics, I was sending dhcp requests from the
devices connected on lan0 and lan4 ports.
~$ ifconfig
eth0 Link encap:Ethernet HWaddr C4:F3:12:08:FE:7E
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:102
eth1 Link encap:Ethernet HWaddr C4:F3:12:08:FE:7F
inet6 addr: fe80::c6f3:12ff:fe08:fe7f%lo/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:879 errors:0 dropped:0 overruns:0 frame:0
TX packets:171 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:389836 (380.6 KiB) TX bytes:23128 (22.5 KiB)
lan0 Link encap:Ethernet HWaddr C4:F3:12:08:FE:7F
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:660 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:336530 (328.6 KiB) TX bytes:0 (0.0 B)
lan3 Link encap:Ethernet HWaddr C4:F3:12:08:FE:7F
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lan4 Link encap:Ethernet HWaddr C4:F3:12:08:FE:7F
inet6 addr: fe80::c6f3:12ff:fe08:fe7f%lo/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:219 errors:0 dropped:0 overruns:0 frame:0
TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:36605 (35.7 KiB) TX bytes:11732 (11.4 KiB)
~$
I am bit confused on how dsa needs to be actually working,
Q's
1] should I be running a dhcp server on eth1 (where switch is connected)
so that devices connected on lan* devices get an ip ?
2] From the device where switch is connected if the cpu port wants to send
any data to any other user ports lan* how do i do it (just open
socket on eth1 or lan*) ?
I wrote a simple C code to dump some data onto port with lan0 but
couldn’t see
anything on the device where lan0 is connected (using tcpdump).
I also tried sending data from lan0 to lan4 but I couldnt see
anything on tcpdump
but I can ping lan0 and lan4. (I have set lan0 and lan4 as local link only)
3] What is the ideal setup for dsa to work
Cheers,
--Prabhakar
^ permalink raw reply
* Re: [PATCH] selftests/net: add tls to .gitignore
From: David Miller @ 2018-07-26 16:38 UTC (permalink / raw)
To: anders.roxell; +Cc: shuah, davejwatson, netdev, linux-kselftest, linux-kernel
In-Reply-To: <20180726095358.30534-1-anders.roxell@linaro.org>
From: Anders Roxell <anders.roxell@linaro.org>
Date: Thu, 26 Jul 2018 11:53:58 +0200
> Add the tls binary to .gitignore
>
> Fixes: 7f657d5bf507 ("selftests: tls: add selftests for TLS sockets")
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH] net: fix amd-xgbe flow-control issue
From: David Miller @ 2018-07-26 16:30 UTC (permalink / raw)
To: tli012345; +Cc: thomas.lendacky, netdev, linux-kernel, tangpengpeng
In-Reply-To: <20180726064516.56740-1-tli012345@163.com>
From: tli012345@163.com
Date: Thu, 26 Jul 2018 14:45:16 +0800
> From: tangpengpeng <tangpengpeng@higon.com>
>
> If we enable or disable xgbe flow-control by ethtool ,
> it does't work.Because the parameter is not properly
> assigned,so we need to adjust the assignment order
> of the parameters.
>
> Signed-off-by: tangpengpeng <tangpengpeng@higon.com>
Applied with -fixes tag added and queued up for -stable.
^ permalink raw reply
* [PATCH net-next v2 1/2] tls: Remove dead code in tls_sw_sendmsg
From: Doron Roberts-Kedes @ 2018-07-26 14:59 UTC (permalink / raw)
To: David S . Miller
Cc: Vakul Garg, Dave Watson, Matt Mullins, netdev,
Doron Roberts-Kedes
In-Reply-To: <20180726145936.3547913-1-doronrk@fb.com>
tls_push_record either returns 0 on success or a negative value on failure.
This patch removes code that would only be executed if tls_push_record
were to return a positive value.
Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com>
---
net/tls/tls_sw.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 03f1370f5db1..0279bc4a168b 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -423,12 +423,10 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
copied += try_to_copy;
ret = tls_push_record(sk, msg->msg_flags, record_type);
- if (!ret)
- continue;
- if (ret < 0)
+ if (ret)
goto send_end;
+ continue;
- copied -= try_to_copy;
fallback_to_reg_send:
iov_iter_revert(&msg->msg_iter,
ctx->sg_plaintext_size - orig_size);
--
2.17.1
^ permalink raw reply related
* [PATCH net-next v2 2/2] tls: Fix improper revert in zerocopy_from_iter
From: Doron Roberts-Kedes @ 2018-07-26 14:59 UTC (permalink / raw)
To: David S . Miller
Cc: Vakul Garg, Dave Watson, Matt Mullins, netdev,
Doron Roberts-Kedes
In-Reply-To: <20180726145936.3547913-1-doronrk@fb.com>
The current code is problematic because the iov_iter is reverted and
never advanced in the non-error case. This patch skips the revert in the
non-error case. This patch also fixes the amount by which the iov_iter
is reverted. Currently, iov_iter is reverted by size, which can be
greater than the amount by which the iter was actually advanced.
Instead, only revert by the amount that the iter was advanced.
Fixes: 4718799817c5 ("tls: Fix zerocopy_from_iter iov handling")
Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com>
---
net/tls/tls_sw.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 0279bc4a168b..190b0aa79c85 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -263,7 +263,7 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from,
int length, int *pages_used,
unsigned int *size_used,
struct scatterlist *to, int to_max_pages,
- bool charge, bool revert)
+ bool charge)
{
struct page *pages[MAX_SKB_FRAGS];
@@ -312,10 +312,10 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from,
}
out:
+ if (rc)
+ iov_iter_revert(from, size - *size_used);
*size_used = size;
*pages_used = num_elem;
- if (revert)
- iov_iter_revert(from, size);
return rc;
}
@@ -417,7 +417,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
&ctx->sg_plaintext_size,
ctx->sg_plaintext_data,
ARRAY_SIZE(ctx->sg_plaintext_data),
- true, false);
+ true);
if (ret)
goto fallback_to_reg_send;
@@ -428,8 +428,6 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
continue;
fallback_to_reg_send:
- iov_iter_revert(&msg->msg_iter,
- ctx->sg_plaintext_size - orig_size);
trim_sg(sk, ctx->sg_plaintext_data,
&ctx->sg_plaintext_num_elem,
&ctx->sg_plaintext_size,
@@ -833,7 +831,7 @@ int tls_sw_recvmsg(struct sock *sk,
err = zerocopy_from_iter(sk, &msg->msg_iter,
to_copy, &pages,
&chunk, &sgin[1],
- MAX_SKB_FRAGS, false, true);
+ MAX_SKB_FRAGS, false);
if (err < 0)
goto fallback_to_reg_recv;
--
2.17.1
^ permalink raw reply related
* [PATCH net-next v2 0/2] tls: Fix improper revert in zerocopy_from_iter
From: Doron Roberts-Kedes @ 2018-07-26 14:59 UTC (permalink / raw)
To: David S . Miller
Cc: Vakul Garg, Dave Watson, Matt Mullins, netdev,
Doron Roberts-Kedes
This series fixes the improper iov_iter_revert introcded in
"tls: Fix zerocopy_from_iter iov handling".
Changes from v1:
- call iov_iter_revert inside zerocopy_from_iter
Doron Roberts-Kedes (2):
tls: Remove dead code in tls_sw_sendmsg
tls: Fix improper revert in zerocopy_from_iter
net/tls/tls_sw.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
--
2.17.1
^ permalink raw reply
* Re: [PATCH rdma-next v2 0/8] Support mlx5 flow steering with RAW data
From: Jason Gunthorpe @ 2018-07-26 14:58 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, RDMA mailing list, Yishai Hadas, Saeed Mahameed,
linux-netdev
In-Reply-To: <20180726043549.GZ3189@mtr-leonro.mtl.com>
On Thu, Jul 26, 2018 at 07:35:49AM +0300, Leon Romanovsky wrote:
> On Wed, Jul 25, 2018 at 08:35:17AM -0600, Jason Gunthorpe wrote:
> > On Wed, Jul 25, 2018 at 08:37:03AM +0300, Leon Romanovsky wrote:
> >
> > > > Also, I would like to keep the specs consistently formatted according
> > > > to clang-format with 'BinPackParameters: true', so I reflowed them as
> > > > well.
> > >
> > > I'm using default VIM clang-format.py without anything in .clang-format.
> > > Do you have an extra definitions there, except BinPackParameters?
> >
> > These days Linux includes a top level .clang-format that does a
> > pretty good job.
> >
> > I have to manually switch BinPackParameters on when working with these
> > specs to get the right indenting.. A pain, but maybe there is a better
> > way someday..
>
> I don't think that it is feasible to ask from people to change some
> defaults only for patches that touch those specs. Any change in this
> area will change formatting back.
Eventually I think we might be able toadd a code comment to tell
clang-format, but that would be down the road a bit..
> Jason, bottom line, I won't use BinPackParameters for my patches.
Well, you can make sure the specs macro follows the required
formatting code style by hand if you prefer..
But, I want to see them in this layout, so they are easier to
maintain, not the haphazard layout we had before.
Jason
^ permalink raw reply
* Re: [PATCH net-next] bnxt_en: combine 'else if' and 'else' into single branche
From: Vasundhara Volam @ 2018-07-26 14:54 UTC (permalink / raw)
To: YueHaibing; +Cc: David Miller, michael.chan@broadcom.com, open list, Netdev
In-Reply-To: <20180725111459.10800-1-yuehaibing@huawei.com>
On Wed, Jul 25, 2018 at 4:44 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>
> The else-if branch and else branch set mac_ok to true similarly,
> so combine the two into single else branch.
>
> Aslo add comments to explain the two conditions, which
> from Michael Chan and Vasundhara Volam.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
> index a649108..f560845 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
> @@ -956,9 +956,13 @@ static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf)
> } else if (is_valid_ether_addr(vf->vf_mac_addr)) {
> if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr))
> mac_ok = true;
> - } else if (bp->hwrm_spec_code < 0x10202) {
> - mac_ok = true;
> } else {
> + /* There are two cases:
> + * 1.If firmware spec < 0x10202,VF MAC address is not forwarded
> + * to the PF and so it doesn't have to match
> + * 2.Allow VF to modify it's own MAC when PF has not assigned a
> + * valid MAC address and firmware spec >= 0x10202
> + */
No, this is not correct either. You are not covering both conditions.
else part with cover if (!is_valid_ether_addr(vf->vf_mac_addr))
before.
> mac_ok = true;
> }
> if (mac_ok)
> --
> 2.7.0
>
>
^ 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