Re: [PATCH v2 iproute2] tc: fix bpf compilation with old glibc
On Thu, Jul 23, 2015 at 09:17:41AM +0200, Nicolas Dichtel wrote: Error was: f_bpf.o: In function `bpf_parse_opt': f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv' m_bpf.o: In function `parse_bpf': m_bpf.c:(.text+0x587): undefined reference to `secure_getenv' collect2: error: ld returned 1 exit status There is no special reason to use the secure version of getenv, thus let's simply use getenv(). CC: Daniel Borkmann dan...@iogearbox.net Fixes: 88eea5395483 (tc: {f,m}_bpf: allow to retrieve uds path from env) Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com --- v2: rework the fix to use getenv() instead of secure_getenv() had the same workaround locally. Acked-by: Alexei Starovoitov a...@plumgrid.com -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] openvswitch: Retrieve tunnel metadata when receiving from vport-netdev
On Thu, Jul 23, 2015 at 4:04 AM, Thomas Graf tg...@suug.ch wrote: Retrieve the tunnel metadata for packets received by a net_device and provide it to ovs_vport_receive() for flow key extraction. [This hunk was in the GRE patch in the initial series and missed the cut for the initial submission for merging.] Fixes: 614732eaa12d (openvswitch: Use regular VXLAN net_device device) Signed-off-by: Thomas Graf tg...@suug.ch Acked-by: Pravin B Shelar pshe...@nicira.com -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 0/4] Introduce Mellanox Technologies Switch ASICs switchdev drivers
On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote: This patchset introduces Mellanox Technologies Switch driver infrastructure and support for SwitchX-2 ASIC. The driver is divided into 3 logical parts: 1) Bus - implements switch bus interface. Currently only PCI bus is implemented, but more buses will be added in the future. Namely I2C and SGMII. (patch #2) 2) Driver - implemements of ASIC-specific functions. Currently SwitchX-2 ASIC is supported, but a plan exists to introduce support for Spectrum ASIC in the near future. (patch #4) 3) Core - infrastructure that glues buses and drivers together. It implements register access logic (EMADs) and takes care of RX traps and events. (patch #1 and #3) Ido Schimmel (1): mlxsw: Add interface to access registers and process events Jiri Pirko (3): mlxsw: Introduce Mellanox switch driver core mlxsw: Add PCI bus implementation mlxsw: Introduce Mellanox SwitchX-2 ASIC support This is awesome! Reviewing... checkpatch.pl shows 1 ERROR, bunch of 80 chars WARNs, and bunch of CHECKs on space after cast. On the CHECKs on space after cast, should we modify checkpatch.pl to not flag those for drivers/net? -scott -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] ebpf: Allow dereferences of PTR_TO_STACK registers
mov %rsp, %r1 ; r1 = rsp add $-8, %r1; r1 = rsp - 8 store_q $123, -8(%rsp) ; *(u64*)r1 = 123 - valid store_q $123, (%r1) ; *(u64*)r1 = 123 - previously invalid mov $0, %r0 exit; Always need to exit And we'd get the following error: 0: (bf) r1 = r10 1: (07) r1 += -8 2: (7a) *(u64 *)(r10 -8) = 999 3: (7a) *(u64 *)(r1 +0) = 999 R1 invalid mem access 'fp' Unable to load program We already know that a register is a stack address and the appropriate offset, so we should be able to validate those references as well. Signed-off-by: Alex Gartrell agartr...@fb.com --- kernel/bpf/verifier.c | 6 - samples/bpf/test_verifier.c | 59 + 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 039d866..cd307df 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -648,6 +648,9 @@ static int check_mem_access(struct verifier_env *env, u32 regno, int off, struct verifier_state *state = env-cur_state; int size, err = 0; + if (state-regs[regno].type == PTR_TO_STACK) + off += state-regs[regno].imm; + size = bpf_size_to_bytes(bpf_size); if (size 0) return size; @@ -667,7 +670,8 @@ static int check_mem_access(struct verifier_env *env, u32 regno, int off, if (!err t == BPF_READ value_regno = 0) mark_reg_unknown_value(state-regs, value_regno); - } else if (state-regs[regno].type == FRAME_PTR) { + } else if (state-regs[regno].type == FRAME_PTR || + state-regs[regno].type == PTR_TO_STACK) { if (off = 0 || off -MAX_BPF_STACK) { verbose(invalid stack off=%d size=%d\n, off, size); return -EACCES; diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c index 6936059..ee0f110 100644 --- a/samples/bpf/test_verifier.c +++ b/samples/bpf/test_verifier.c @@ -822,6 +822,65 @@ static struct bpf_test tests[] = { .result = ACCEPT, .prog_type = BPF_PROG_TYPE_SCHED_CLS, }, + { + PTR_TO_STACK store/load, + .insns = { + BPF_MOV64_REG(BPF_REG_1, BPF_REG_10), + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -10), + BPF_ST_MEM(BPF_DW, BPF_REG_1, 2, 0xfaceb00c), + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, 2), + BPF_EXIT_INSN(), + }, + .result = ACCEPT, + }, + { + PTR_TO_STACK store/load - bad alignment on off, + .insns = { + BPF_MOV64_REG(BPF_REG_1, BPF_REG_10), + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -8), + BPF_ST_MEM(BPF_DW, BPF_REG_1, 2, 0xfaceb00c), + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, 2), + BPF_EXIT_INSN(), + }, + .result = REJECT, + .errstr = misaligned access off -6 size 8, + }, + { + PTR_TO_STACK store/load - bad alignment on reg, + .insns = { + BPF_MOV64_REG(BPF_REG_1, BPF_REG_10), + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -10), + BPF_ST_MEM(BPF_DW, BPF_REG_1, 8, 0xfaceb00c), + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, 8), + BPF_EXIT_INSN(), + }, + .result = REJECT, + .errstr = misaligned access off -2 size 8, + }, + { + PTR_TO_STACK store/load - out of bounds low, + .insns = { + BPF_MOV64_REG(BPF_REG_1, BPF_REG_10), + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -8), + BPF_ST_MEM(BPF_DW, BPF_REG_1, 8, 0xfaceb00c), + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, 8), + BPF_EXIT_INSN(), + }, + .result = REJECT, + .errstr = invalid stack off=-79992 size=8, + }, + { + PTR_TO_STACK store/load - out of bounds high, + .insns = { + BPF_MOV64_REG(BPF_REG_1, BPF_REG_10), + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -8), + BPF_ST_MEM(BPF_DW, BPF_REG_1, 8, 0xfaceb00c), + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, 8), + BPF_EXIT_INSN(), + }, + .result = REJECT, + .errstr = invalid stack off=0 size=8, + }, }; static int probe_filter_length(struct bpf_insn *fp) -- Alex Gartrell agartr...@fb.com -- To unsubscribe from this list:
[PATCH] e1000: make eeprom read/write scheduler friendly
From: Joern Engel jo...@logfs.org Code was responsible for ~150ms scheduler latencies. Signed-off-by: Joern Engel jo...@logfs.org Signed-off-by: Spencer Baugh sba...@catern.com --- drivers/net/ethernet/intel/e1000/e1000_hw.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c index 45c8c864..e74e9dd 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_hw.c +++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c @@ -106,7 +106,7 @@ u16 e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = { 120, 120 }; -static DEFINE_SPINLOCK(e1000_eeprom_lock); +static DEFINE_MUTEX(e1000_eeprom_lock); static DEFINE_SPINLOCK(e1000_phy_lock); /** @@ -3882,9 +3882,9 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw) s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) { s32 ret; - spin_lock(e1000_eeprom_lock); + mutex_lock(e1000_eeprom_lock); ret = e1000_do_read_eeprom(hw, offset, words, data); - spin_unlock(e1000_eeprom_lock); + mutex_unlock(e1000_eeprom_lock); return ret; } @@ -3972,6 +3972,7 @@ static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, */ data[i] = e1000_shift_in_ee_bits(hw, 16); e1000_standby_eeprom(hw); + cond_resched(); } } @@ -4056,9 +4057,9 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw) s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) { s32 ret; - spin_lock(e1000_eeprom_lock); + mutex_lock(e1000_eeprom_lock); ret = e1000_do_write_eeprom(hw, offset, words, data); - spin_unlock(e1000_eeprom_lock); + mutex_unlock(e1000_eeprom_lock); return ret; } @@ -4124,6 +4125,7 @@ static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, u16 words, return -E1000_ERR_EEPROM; e1000_standby_eeprom(hw); + cond_resched(); /* Send the WRITE ENABLE command (8 bit opcode ) */ e1000_shift_out_ee_bits(hw, EEPROM_WREN_OPCODE_SPI, @@ -4232,6 +4234,7 @@ static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset, /* Recover from write */ e1000_standby_eeprom(hw); + cond_resched(); words_written++; } -- 2.5.0.rc3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 6/6] net/mlx5e: Input IPSEC.SPI into the RX RSS hash function
From: Achiad Shochat ach...@mellanox.com In addition to the source/destination IP which are already hashed. Only for unicast traffic for now. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Amir Vadai am...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 4 + .../ethernet/mellanox/mlx5/core/en_flow_table.c| 92 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 32 3 files changed, 127 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 39294f2..b710e9b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -334,6 +334,10 @@ enum mlx5e_traffic_types { MLX5E_TT_IPV6_TCP, MLX5E_TT_IPV4_UDP, MLX5E_TT_IPV6_UDP, + MLX5E_TT_IPV4_IPSEC_AH, + MLX5E_TT_IPV6_IPSEC_AH, + MLX5E_TT_IPV4_IPSEC_ESP, + MLX5E_TT_IPV6_IPSEC_ESP, MLX5E_TT_IPV4, MLX5E_TT_IPV6, MLX5E_TT_ANY, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c index cca34f6..70ec31b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c @@ -105,6 +105,22 @@ static void mlx5e_del_eth_addr_from_flow_table(struct mlx5e_priv *priv, { void *ft = priv-ft.main; + if (ai-tt_vec BIT(MLX5E_TT_IPV6_IPSEC_ESP)) + mlx5_del_flow_table_entry(ft, + ai-ft_ix[MLX5E_TT_IPV6_IPSEC_ESP]); + + if (ai-tt_vec BIT(MLX5E_TT_IPV4_IPSEC_ESP)) + mlx5_del_flow_table_entry(ft, + ai-ft_ix[MLX5E_TT_IPV4_IPSEC_ESP]); + + if (ai-tt_vec BIT(MLX5E_TT_IPV6_IPSEC_AH)) + mlx5_del_flow_table_entry(ft, + ai-ft_ix[MLX5E_TT_IPV6_IPSEC_AH]); + + if (ai-tt_vec BIT(MLX5E_TT_IPV4_IPSEC_AH)) + mlx5_del_flow_table_entry(ft, + ai-ft_ix[MLX5E_TT_IPV4_IPSEC_AH]); + if (ai-tt_vec BIT(MLX5E_TT_IPV6_TCP)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV6_TCP]); @@ -160,6 +176,10 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type) BIT(MLX5E_TT_IPV6_TCP) | BIT(MLX5E_TT_IPV4_UDP) | BIT(MLX5E_TT_IPV6_UDP) | + BIT(MLX5E_TT_IPV4_IPSEC_AH) | + BIT(MLX5E_TT_IPV6_IPSEC_AH) | + BIT(MLX5E_TT_IPV4_IPSEC_ESP) | + BIT(MLX5E_TT_IPV6_IPSEC_ESP) | BIT(MLX5E_TT_IPV4) | BIT(MLX5E_TT_IPV6) | BIT(MLX5E_TT_ANY)| @@ -205,6 +225,10 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type) BIT(MLX5E_TT_IPV6_TCP) | BIT(MLX5E_TT_IPV4_UDP) | BIT(MLX5E_TT_IPV6_UDP) | + BIT(MLX5E_TT_IPV4_IPSEC_AH) | + BIT(MLX5E_TT_IPV6_IPSEC_AH) | + BIT(MLX5E_TT_IPV4_IPSEC_ESP) | + BIT(MLX5E_TT_IPV6_IPSEC_ESP) | BIT(MLX5E_TT_IPV4) | BIT(MLX5E_TT_IPV6) | BIT(MLX5E_TT_ANY)| @@ -377,6 +401,72 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv, ai-tt_vec |= BIT(MLX5E_TT_IPV6_TCP); } + MLX5_SET(fte_match_param, match_value, outer_headers.ip_protocol, +IPPROTO_AH); + + ft_ix = ai-ft_ix[MLX5E_TT_IPV4_IPSEC_AH]; + if (tt_vec BIT(MLX5E_TT_IPV4_IPSEC_AH)) { + MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, +ETH_P_IP); + MLX5_SET(dest_format_struct, dest, destination_id, +tirn[MLX5E_TT_IPV4_IPSEC_AH]); + err = mlx5_add_flow_table_entry(ft, match_criteria_enable, + match_criteria, flow_context, + ft_ix); + if (err) + goto err_del_ai; + + ai-tt_vec |= BIT(MLX5E_TT_IPV4_IPSEC_AH); + } + + ft_ix = ai-ft_ix[MLX5E_TT_IPV6_IPSEC_AH]; + if (tt_vec BIT(MLX5E_TT_IPV6_IPSEC_AH)) { + MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, +ETH_P_IPV6); + MLX5_SET(dest_format_struct, dest, destination_id, +tirn[MLX5E_TT_IPV6_IPSEC_AH]); + err =
[PATCH net-next 0/6] ConnectX-4 driver update 2015-07-23
Hi Dave, This patchset introduce some performance enhancements to the ConnectX-4 driver. 1. Improving RSS distribution, and make RSS function controlable using ethtool. 2. Make memory that is written by NIC and read by host CPU allocate in the local NUMA to the processing CPU 3. Support tx copybreak 4. Using hardware feature called blueflame to save DMA reads when possible Another patch by Achiad fix some cosmetic issues in the driver. Patchset was applied and tested on top of commit 045a0fa (ip_tunnel: Call ip_tunnel_core_init() from inet_init()) Thanks, Amir Achiad Shochat (4): net/mlx5e: Support TX packet copy into WQE net/mlx5e: TX latency optimization to save DMA reads net/mlx5e: Cosmetics: use BIT() instead of 1 , and others net/mlx5e: Input IPSEC.SPI into the RX RSS hash function Saeed Mahameed (2): net/mlx5e: Support ETH_RSS_HASH_XOR net/mlx5e: Allocate DMA coherent memory on reader NUMA node drivers/net/ethernet/mellanox/mlx5/core/alloc.c| 48 +++- drivers/net/ethernet/mellanox/mlx5/core/en.h | 47 ++-- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 92 .../ethernet/mellanox/mlx5/core/en_flow_table.c| 258 ++--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 134 --- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c| 34 ++- drivers/net/ethernet/mellanox/mlx5/core/main.c | 32 ++- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 6 + drivers/net/ethernet/mellanox/mlx5/core/wq.c | 12 +- drivers/net/ethernet/mellanox/mlx5/core/wq.h | 3 +- include/linux/mlx5/driver.h| 12 +- include/linux/mlx5/mlx5_ifc.h | 6 +- 12 files changed, 535 insertions(+), 149 deletions(-) -- 2.4.3.413.ga5fe668 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 2/6] net/mlx5e: Allocate DMA coherent memory on reader NUMA node
From: Saeed Mahameed sae...@mellanox.com By affinity hints and XPS, each mlx5e channel is assigned a CPU core. Channel DMA coherent memory that is written by the NIC and read by SW (e.g CQ buffer) is allocated on the NUMA node of the CPU core assigned for the channel. Channel DMA coherent memory that is written by SW and read by the NIC (e.g SQ/RQ buffer) is allocated on the NUMA node of the NIC. Doorbell record (written by SW and read by the NIC) is an exception since it is accessed by SW more frequently. Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Amir Vadai am...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 48 +++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 -- drivers/net/ethernet/mellanox/mlx5/core/main.c| 6 ++- drivers/net/ethernet/mellanox/mlx5/core/wq.c | 12 +++--- drivers/net/ethernet/mellanox/mlx5/core/wq.h | 3 +- include/linux/mlx5/driver.h | 8 6 files changed, 70 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c index 0715b49..6cb3830 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c @@ -45,15 +45,34 @@ * register it in a memory region at HCA virtual address 0. */ -int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf) +static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev, + size_t size, dma_addr_t *dma_handle, + int node) +{ + struct mlx5_priv *priv = dev-priv; + int original_node; + void *cpu_handle; + + mutex_lock(priv-alloc_mutex); + original_node = dev_to_node(dev-pdev-dev); + set_dev_node(dev-pdev-dev, node); + cpu_handle = dma_zalloc_coherent(dev-pdev-dev, size, +dma_handle, GFP_KERNEL); + set_dev_node(dev-pdev-dev, original_node); + mutex_unlock(priv-alloc_mutex); + return cpu_handle; +} + +int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, + struct mlx5_buf *buf, int node) { dma_addr_t t; buf-size = size; buf-npages = 1; buf-page_shift = (u8)get_order(size) + PAGE_SHIFT; - buf-direct.buf = dma_zalloc_coherent(dev-pdev-dev, - size, t, GFP_KERNEL); + buf-direct.buf = mlx5_dma_zalloc_coherent_node(dev, size, + t, node); if (!buf-direct.buf) return -ENOMEM; @@ -66,6 +85,11 @@ int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf) return 0; } + +int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf) +{ + return mlx5_buf_alloc_node(dev, size, buf, dev-priv.numa_node); +} EXPORT_SYMBOL_GPL(mlx5_buf_alloc); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) @@ -75,7 +99,8 @@ void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) } EXPORT_SYMBOL_GPL(mlx5_buf_free); -static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct device *dma_device) +static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev, +int node) { struct mlx5_db_pgdir *pgdir; @@ -84,8 +109,9 @@ static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct device *dma_device) return NULL; bitmap_fill(pgdir-bitmap, MLX5_DB_PER_PAGE); - pgdir-db_page = dma_alloc_coherent(dma_device, PAGE_SIZE, - pgdir-db_dma, GFP_KERNEL); + + pgdir-db_page = mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, + pgdir-db_dma, node); if (!pgdir-db_page) { kfree(pgdir); return NULL; @@ -118,7 +144,7 @@ static int mlx5_alloc_db_from_pgdir(struct mlx5_db_pgdir *pgdir, return 0; } -int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) +int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) { struct mlx5_db_pgdir *pgdir; int ret = 0; @@ -129,7 +155,7 @@ int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) if (!mlx5_alloc_db_from_pgdir(pgdir, db)) goto out; - pgdir = mlx5_alloc_db_pgdir((dev-pdev-dev)); + pgdir = mlx5_alloc_db_pgdir(dev, node); if (!pgdir) { ret = -ENOMEM; goto out; @@ -145,6 +171,12 @@ out: return ret; } +EXPORT_SYMBOL_GPL(mlx5_db_alloc_node); + +int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) +{ + return mlx5_db_alloc_node(dev, db, dev-priv.numa_node); +}
Re: [PATCH net-next] ebpf: Allow dereferences of PTR_TO_STACK registers
On Thu, Jul 23, 2015 at 02:24:40PM -0700, Alex Gartrell wrote: mov %rsp, %r1 ; r1 = rsp add $-8, %r1; r1 = rsp - 8 store_q $123, -8(%rsp) ; *(u64*)r1 = 123 - valid store_q $123, (%r1) ; *(u64*)r1 = 123 - previously invalid mov $0, %r0 exit; Always need to exit And we'd get the following error: 0: (bf) r1 = r10 1: (07) r1 += -8 2: (7a) *(u64 *)(r10 -8) = 999 3: (7a) *(u64 *)(r1 +0) = 999 R1 invalid mem access 'fp' Unable to load program We already know that a register is a stack address and the appropriate offset, so we should be able to validate those references as well. Signed-off-by: Alex Gartrell agartr...@fb.com --- kernel/bpf/verifier.c | 6 - samples/bpf/test_verifier.c | 59 + 2 files changed, 64 insertions(+), 1 deletion(-) Looks good. Acked-by: Alexei Starovoitov a...@plumgrid.com + BPF_ST_MEM(BPF_DW, BPF_REG_1, 2, 0xfaceb00c), nice constants :) -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Several races in usbnet module (kernel 4.1.x)
23.07.2015 12:43, Oliver Neukum пишет: On Mon, 2015-07-20 at 21:13 +0300, Eugene Shatokhin wrote: [Race #5] Race on dev-rx_urb_size. I reproduced it a similar way as the races #2 and #3 (changing MTU while downloading files). dev-rx_urb_size is written to here: #0 usbnet_change_mtu (usbnet.c:392) dev-rx_urb_size = dev-hard_mtu; Here is the conflicting read from dev-rx_urb_size: * rx_submit (usbnet.c:467) size_t size = dev-rx_urb_size; Yes, but what is the actual bad race? I mean, if you change the MTU in operation, there will be a race. That is just unavoidable. Do we generate errors? No, I have observed no problems due to this race so far. Regards, Eugene -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [NET-NEXT PATCH] net: macb: Change capability mask for jumbo support
Le 23/07/2015 12:14, Harini Katakam a écrit : JUMBO and NO_GIGABIT_HALF have the same capability masks. Change one of them. Signed-off-by: Harini Katakam hari...@xilinx.com Yes, indeed: Acked-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index d746559..8fb80b2 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -399,7 +399,7 @@ #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x2000 #define MACB_CAPS_SG_DISABLED0x4000 #define MACB_CAPS_MACB_IS_GEM0x8000 -#define MACB_CAPS_JUMBO 0x0008 +#define MACB_CAPS_JUMBO 0x0010 /* Bit manipulation macros */ #define MACB_BIT(name) \ -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next PATCH v0 0/6] net: netcp: Bug fixes of CPSW statistics collection
This patch set contains bug fixes and enhencements of hw ethernet statistics processing on TI's Keystone2 CPSW ethernet switches. WingMan Kwok (6): net: netcp: Fixes the use of spin_lock_bh in timer function net: netcp: Fixes hw statistics module base setting error net: netcp: Fixes error in oversized memory allocation for statistics storage net: netcp: Consolidates statistics collection code net: netcp: Fixes to CPSW statistics collection net: netcp: Adds missing statistics for K2L and K2E drivers/net/ethernet/ti/netcp_ethss.c | 399 ++--- 1 file changed, 324 insertions(+), 75 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] MIPS: Remove most of the custom gpio.h
On Wed, Jul 22, 2015 at 7:33 PM, Alban Bedel al...@free.fr wrote: Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS machines, and each machine type provides its own gpio.h. However only the Alchemy machine really use the feature, all other machines only use the default wrappers. For most machine types we can just remove the custom gpio.h, as well as the custom wrappers if some exists. A few more fixes are need in a few drivers as they rely on linux/gpio.h to provides some machine specific definitions, or used asm/gpio.h instead of linux/gpio.h for the gpio API. Signed-off-by: Alban Bedel al...@free.fr This is exactly what the kernel needs. Enjoy my: Reviewed-by: Linus Walleij linus.wall...@linaro.org And feel free to merge this through the MIPS tree. Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next PATCH v0 5/6] net: netcp: Fixes to CPSW statistics collection
In certain applications it's beneficial to allow the CPSW h/w stats counters to continue to increment even while the kernel polls them. This patch implements this behavior for both 1G and 10G ethernet subsystem modules. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 86 - 1 file changed, 75 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index aadca02..e2ef7ba 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -646,6 +646,7 @@ struct gbe_priv { boolenable_ale; u8 max_num_slaves; u8 max_num_ports; /* max_num_slaves + 1 */ + u8 num_stats_mods; struct netcp_tx_pipetx_pipe; int host_port; @@ -675,6 +676,7 @@ struct gbe_priv { struct net_device *dummy_ndev; u64 *hw_stats; + u32 *hw_stats_prev; const struct netcp_ethtool_stat *et_stats; int num_et_stats; /* Lock for updating the hwstats */ @@ -1554,25 +1556,37 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset) } } +static void gbe_reset_mod_stats(struct gbe_priv *gbe_dev, int stats_mod) +{ + void __iomem *base = gbe_dev-hw_stats_regs[stats_mod]; + u32 __iomem *p_stats_entry; + int i; + + for (i = 0; i gbe_dev-num_et_stats; i++) { + if (gbe_dev-et_stats[i].type == stats_mod) { + p_stats_entry = base + gbe_dev-et_stats[i].offset; + gbe_dev-hw_stats[i] = 0; + gbe_dev-hw_stats_prev[i] = readl(p_stats_entry); + } + } +} + static inline void gbe_update_hw_stats_entry(struct gbe_priv *gbe_dev, int et_stats_entry) { void __iomem *base = NULL; - u32 __iomem *p; - u32 tmp = 0; + u32 __iomem *p_stats_entry; + u32 curr, delta; /* The hw_stats_regs pointers are already * properly set to point to the right base: */ base = gbe_dev-hw_stats_regs[gbe_dev-et_stats[et_stats_entry].type]; - p = base + gbe_dev-et_stats[et_stats_entry].offset; - tmp = readl(p); - gbe_dev-hw_stats[et_stats_entry] += tmp; - - /* write-to-decrement: -* new register value = old register value - write value -*/ - writel(tmp, p); + p_stats_entry = base + gbe_dev-et_stats[et_stats_entry].offset; + curr = readl(p_stats_entry); + delta = curr - gbe_dev-hw_stats_prev[et_stats_entry]; + gbe_dev-hw_stats_prev[et_stats_entry] = curr; + gbe_dev-hw_stats[et_stats_entry] += delta; } static void gbe_update_stats(struct gbe_priv *gbe_dev, uint64_t *data) @@ -1611,6 +1625,12 @@ static inline void gbe_stats_mod_visible_ver14(struct gbe_priv *gbe_dev, writel(val, GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); } +static void gbe_reset_mod_stats_ver14(struct gbe_priv *gbe_dev, int stats_mod) +{ + gbe_stats_mod_visible_ver14(gbe_dev, stats_mod); + gbe_reset_mod_stats(gbe_dev, stats_mod); +} + static void gbe_update_stats_ver14(struct gbe_priv *gbe_dev, uint64_t *data) { u32 half_num_et_stats = (gbe_dev-num_et_stats / 2); @@ -2564,6 +2584,7 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, } gbe_dev-xgbe_serdes_regs = regs; + gbe_dev-num_stats_mods = gbe_dev-max_num_ports; gbe_dev-et_stats = xgbe10_et_stats; gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); @@ -2575,6 +2596,16 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, return -ENOMEM; } + gbe_dev-hw_stats_prev = + devm_kzalloc(gbe_dev-dev, +gbe_dev-num_et_stats * sizeof(u32), +GFP_KERNEL); + if (!gbe_dev-hw_stats_prev) { + dev_err(gbe_dev-dev, + hw_stats_prev memory allocation failed\n); + return -ENOMEM; + } + gbe_dev-ss_version = XGBE_SS_VERSION_10; gbe_dev-sgmii_port_regs = gbe_dev-ss_regs + XGBE10_SGMII_MODULE_OFFSET; @@ -2672,6 +2703,7 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, } gbe_dev-switch_regs = regs; + gbe_dev-num_stats_mods = gbe_dev-max_num_slaves; gbe_dev-et_stats = gbe13_et_stats; gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); @@ -2683,6 +2715,16 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, return -ENOMEM; } +
Re: [PATCH net-next] af_mpls: fix undefined reference to ip6_route_output
On 7/23/15, 12:09 AM, David Miller wrote: From: roopa ro...@cumulusnetworks.com Date: Wed, 22 Jul 2015 13:38:31 -0700 I cant think of a way to fix the current problem with my patch... I guess it's not obvious that adding CONFIG_MPLS_IPV6 would solve the problem perfectly. I thought that was not an option because CONFIG_MPLS_ROUTING is already out and supports IPV6 when RTA_OIF is specified. I did submit another version yesterday using IS_BUILTIN (sorry missed the v2 in the patch prefix). https://patchwork.ozlabs.org/patch/498903/ I can certainly introduce CONFIG_MPLS_IPV6, if that is a more acceptable. thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] lwtunnel: export linux/lwtunnel.h to userspace
Note also that include/linux/lwtunnel.h is not needed. CC: Thomas Graf tg...@suug.ch CC: Roopa Prabhu ro...@cumulusnetworks.com Fixes: 499a24256862 (lwtunnel: infrastructure for handling light weight tunnels like mpls) Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com --- include/linux/lwtunnel.h | 6 -- include/uapi/linux/Kbuild | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 include/linux/lwtunnel.h diff --git a/include/linux/lwtunnel.h b/include/linux/lwtunnel.h deleted file mode 100644 index 97f32f8b4ae1.. --- a/include/linux/lwtunnel.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _LINUX_LWTUNNEL_H_ -#define _LINUX_LWTUNNEL_H_ - -#include uapi/linux/lwtunnel.h - -#endif /* _LINUX_LWTUNNEL_H_ */ diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 1ff9942718fe..aafb9937b162 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -243,6 +243,7 @@ header-y += limits.h header-y += llc.h header-y += loop.h header-y += lp.h +header-y += lwtunnel.h header-y += magic.h header-y += major.h header-y += map_to_7segment.h -- 2.4.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2.1 21/22] fjes: handle receive cancellation request interrupt
Hello. On 7/23/2015 3:10 AM, Taku Izumi wrote: This patch adds implementation of handling IRQ of other receiver's receive cancellation request. Signed-off-by: Taku Izumi izumi.t...@jp.fujitsu.com --- drivers/net/fjes/fjes_main.c | 79 1 file changed, 79 insertions(+) diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index faaf2ed..b21ad68 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -822,6 +822,75 @@ static int fjes_vlan_rx_kill_vid(struct net_device *netdev, return 0; } +static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter, + int src_epid) +{ + struct fjes_hw *hw = adapter-hw; + enum ep_partner_status status; + + status = fjes_hw_get_partner_ep_status(hw, src_epid); + switch (status) { + case EP_PARTNER_UNSHARE: + default: + break; + case EP_PARTNER_COMPLETE: + break; Why this *case* isn't merged with the above ones? + case EP_PARTNER_WAITING: + if (src_epid hw-my_epid) { + hw-ep_shm_info[src_epid].tx.info-v1i.rx_status |= + FJES_RX_STOP_REQ_DONE; + + clear_bit(src_epid, hw-txrx_stop_req_bit); + set_bit(src_epid, adapter-unshare_watch_bitmask); + + if (!work_pending(adapter-unshare_watch_task)) + queue_work(adapter-control_wq, + adapter-unshare_watch_task); + } + break; + case EP_PARTNER_SHARED: + if (hw-ep_shm_info[src_epid].rx.info-v1i.rx_status +FJES_RX_STOP_REQ_REQUEST) { Please leave the operator on the first line and start the second line right under 'hw' on the first. [...] MBR, Sergei -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [v3, 5/9] fsl/fman: Add Frame Manager support
Regards, Igal Liberman. +static struct platform_driver fm_driver = { + .driver = { +.name = fsl-fman, +.of_match_table = fm_match, +}, + .probe = fm_probe, +}; + +builtin_platform_driver(fm_driver); + +static int __init __cold fm_load(void) +{ + if (platform_driver_register(fm_driver)) { + pr_crit(platform_driver_register() failed\n); + return -ENODEV; + } + + pr_info(Freescale FMan module\n); + return 0; +} + +device_initcall(fm_load); Please notice, when using builtin_platform_driver, device_initcall(fm_load); becomes redundant. Same issue in 2 other places. I have patches which fix that which were left out of this submission, I'll add them to v4. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next PATCH v0 4/6] net: netcp: Consolidates statistics collection code
Different Keystone2 platforms have different number and layouts of hw statistics modules. This patch consolidates the statistics processing of different Keystone2 platforms for easy maintenance. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 99 ++--- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index a1f16e1..aadca02 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -1554,70 +1554,79 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset) } } -static void gbe_update_stats(struct gbe_priv *gbe_dev, uint64_t *data) +static inline void gbe_update_hw_stats_entry(struct gbe_priv *gbe_dev, +int et_stats_entry) { void __iomem *base = NULL; u32 __iomem *p; u32 tmp = 0; + + /* The hw_stats_regs pointers are already +* properly set to point to the right base: +*/ + base = gbe_dev-hw_stats_regs[gbe_dev-et_stats[et_stats_entry].type]; + p = base + gbe_dev-et_stats[et_stats_entry].offset; + tmp = readl(p); + gbe_dev-hw_stats[et_stats_entry] += tmp; + + /* write-to-decrement: +* new register value = old register value - write value +*/ + writel(tmp, p); +} + +static void gbe_update_stats(struct gbe_priv *gbe_dev, uint64_t *data) +{ int i; for (i = 0; i gbe_dev-num_et_stats; i++) { - base = gbe_dev-hw_stats_regs[gbe_dev-et_stats[i].type]; - p = base + gbe_dev-et_stats[i].offset; - tmp = readl(p); - gbe_dev-hw_stats[i] = gbe_dev-hw_stats[i] + tmp; + gbe_update_hw_stats_entry(gbe_dev, i); + if (data) data[i] = gbe_dev-hw_stats[i]; - /* write-to-decrement: -* new register value = old register value - write value -*/ - writel(tmp, p); } } -static void gbe_update_stats_ver14(struct gbe_priv *gbe_dev, uint64_t *data) +static inline void gbe_stats_mod_visible_ver14(struct gbe_priv *gbe_dev, + int stats_mod) { - void __iomem *gbe_statsa = gbe_dev-hw_stats_regs[0]; - void __iomem *gbe_statsb = gbe_dev-hw_stats_regs[1]; - u64 *hw_stats = gbe_dev-hw_stats[0]; - void __iomem *base = NULL; - u32 __iomem *p; - u32 tmp = 0, val, pair_size = (gbe_dev-num_et_stats / 2); - int i, j, pair; + u32 val; - for (pair = 0; pair 2; pair++) { - val = readl(GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); + val = readl(GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); - if (pair == 0) - val = ~GBE_STATS_CD_SEL; - else - val |= GBE_STATS_CD_SEL; + switch (stats_mod) { + case GBE_STATSA_MODULE: + case GBE_STATSB_MODULE: + val = ~GBE_STATS_CD_SEL; + break; + case GBE_STATSC_MODULE: + case GBE_STATSD_MODULE: + val |= GBE_STATS_CD_SEL; + break; + default: + return; + } + + /* make the stat module visible */ + writel(val, GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); +} - /* make the stat modules visible */ - writel(val, GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); +static void gbe_update_stats_ver14(struct gbe_priv *gbe_dev, uint64_t *data) +{ + u32 half_num_et_stats = (gbe_dev-num_et_stats / 2); + int et_entry, j, pair; - for (i = 0; i pair_size; i++) { - j = pair * pair_size + i; - switch (gbe_dev-et_stats[j].type) { - case GBE_STATSA_MODULE: - case GBE_STATSC_MODULE: - base = gbe_statsa; - break; - case GBE_STATSB_MODULE: - case GBE_STATSD_MODULE: - base = gbe_statsb; - break; - } + for (pair = 0; pair 2; pair++) { + gbe_stats_mod_visible_ver14(gbe_dev, (pair ? + GBE_STATSC_MODULE : + GBE_STATSA_MODULE)); + + for (j = 0; j half_num_et_stats; j++) { + et_entry = pair * half_num_et_stats + j; + gbe_update_hw_stats_entry(gbe_dev, et_entry); - p = base + gbe_dev-et_stats[j].offset; - tmp = readl(p); - hw_stats[j] += tmp; if (data) -
[net-next PATCH v0 3/6] net: netcp: Fixes error in oversized memory allocation for statistics storage
The CPSW driver keeps internally some, but not all, of the statistics available in the hw statistics modules. Furthermore, some of the locations in the hw statistics modules are reserved and contain no useful information. Prior to this patch, the driver allocates memory of the size of the the whole hw statistics modules, instead of the size of statistics-entries-interested-in (i.e. et_stats), for internal storage. This patch fixes that. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 42 - 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index b954856..a1f16e1 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -2555,10 +2555,12 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, } gbe_dev-xgbe_serdes_regs = regs; + gbe_dev-et_stats = xgbe10_et_stats; + gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - XGBE10_NUM_STAT_ENTRIES * - (gbe_dev-max_num_ports) * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2577,8 +2579,6 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = XGBE10_HOST_PORT_NUM; gbe_dev-ale_entries = XGBE10_NUM_ALE_ENTRIES; - gbe_dev-et_stats = xgbe10_et_stats; - gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); gbe_dev-stats_en_mask = (1 (gbe_dev-max_num_ports)) - 1; /* Subsystem registers */ @@ -2663,10 +2663,12 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, } gbe_dev-switch_regs = regs; + gbe_dev-et_stats = gbe13_et_stats; + gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - GBE13_NUM_HW_STAT_ENTRIES * - gbe_dev-max_num_slaves * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2689,8 +2691,6 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = GBE13_HOST_PORT_NUM; gbe_dev-ale_entries = GBE13_NUM_ALE_ENTRIES; - gbe_dev-et_stats = gbe13_et_stats; - gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); gbe_dev-stats_en_mask = GBE13_REG_VAL_STAT_ENABLE_ALL; /* Subsystem registers */ @@ -2717,10 +2717,18 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, void __iomem *regs; int i, ret; + gbe_dev-et_stats = gbenu_et_stats; + + if (IS_SS_ID_NU(gbe_dev)) + gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + + (gbe_dev-max_num_slaves * GBENU_ET_STATS_PORT_SIZE); + else + gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + + GBENU_ET_STATS_PORT_SIZE; + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - GBENU_NUM_HW_STAT_ENTRIES * - (gbe_dev-max_num_ports) * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2753,16 +2761,8 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = GBENU_HOST_PORT_NUM; gbe_dev-ale_entries = GBE13_NUM_ALE_ENTRIES; - gbe_dev-et_stats = gbenu_et_stats; gbe_dev-stats_en_mask = (1 (gbe_dev-max_num_ports)) - 1; - if (IS_SS_ID_NU(gbe_dev)) - gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + - (gbe_dev-max_num_slaves * GBENU_ET_STATS_PORT_SIZE); - else - gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + - GBENU_ET_STATS_PORT_SIZE; - /* Subsystem registers */ GBENU_SET_REG_OFS(gbe_dev, ss_regs, id_ver); -- 1.7.9.5
[net-next PATCH v0 6/6] net: netcp: Adds missing statistics for K2L and K2E
This patch adds the missing statistics for the host and slave ports of the CPSW on K2L and K2E platforms. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 177 - 1 file changed, 174 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index e2ef7ba..7782120 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -876,7 +876,7 @@ static const struct netcp_ethtool_stat gbe13_et_stats[] = { }; /* This is the size of entries in GBENU_STATS_HOST */ -#define GBENU_ET_STATS_HOST_SIZE 33 +#define GBENU_ET_STATS_HOST_SIZE 52 #define GBENU_STATS_HOST(field)\ { \ @@ -885,8 +885,8 @@ static const struct netcp_ethtool_stat gbe13_et_stats[] = { offsetof(struct gbenu_hw_stats, field) \ } -/* This is the size of entries in GBENU_STATS_HOST */ -#define GBENU_ET_STATS_PORT_SIZE 46 +/* This is the size of entries in GBENU_STATS_PORT */ +#define GBENU_ET_STATS_PORT_SIZE 65 #define GBENU_STATS_P1(field) \ { \ @@ -978,7 +978,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_HOST(ale_unknown_mcast_bytes), GBENU_STATS_HOST(ale_unknown_bcast), GBENU_STATS_HOST(ale_unknown_bcast_bytes), + GBENU_STATS_HOST(ale_pol_match), + GBENU_STATS_HOST(ale_pol_match_red), + GBENU_STATS_HOST(ale_pol_match_yellow), GBENU_STATS_HOST(tx_mem_protect_err), + GBENU_STATS_HOST(tx_pri0_drop), + GBENU_STATS_HOST(tx_pri1_drop), + GBENU_STATS_HOST(tx_pri2_drop), + GBENU_STATS_HOST(tx_pri3_drop), + GBENU_STATS_HOST(tx_pri4_drop), + GBENU_STATS_HOST(tx_pri5_drop), + GBENU_STATS_HOST(tx_pri6_drop), + GBENU_STATS_HOST(tx_pri7_drop), + GBENU_STATS_HOST(tx_pri0_drop_bcnt), + GBENU_STATS_HOST(tx_pri1_drop_bcnt), + GBENU_STATS_HOST(tx_pri2_drop_bcnt), + GBENU_STATS_HOST(tx_pri3_drop_bcnt), + GBENU_STATS_HOST(tx_pri4_drop_bcnt), + GBENU_STATS_HOST(tx_pri5_drop_bcnt), + GBENU_STATS_HOST(tx_pri6_drop_bcnt), + GBENU_STATS_HOST(tx_pri7_drop_bcnt), /* GBENU Module 1 */ GBENU_STATS_P1(rx_good_frames), GBENU_STATS_P1(rx_broadcast_frames), @@ -1025,7 +1044,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_P1(ale_unknown_mcast_bytes), GBENU_STATS_P1(ale_unknown_bcast), GBENU_STATS_P1(ale_unknown_bcast_bytes), + GBENU_STATS_P1(ale_pol_match), + GBENU_STATS_P1(ale_pol_match_red), + GBENU_STATS_P1(ale_pol_match_yellow), GBENU_STATS_P1(tx_mem_protect_err), + GBENU_STATS_P1(tx_pri0_drop), + GBENU_STATS_P1(tx_pri1_drop), + GBENU_STATS_P1(tx_pri2_drop), + GBENU_STATS_P1(tx_pri3_drop), + GBENU_STATS_P1(tx_pri4_drop), + GBENU_STATS_P1(tx_pri5_drop), + GBENU_STATS_P1(tx_pri6_drop), + GBENU_STATS_P1(tx_pri7_drop), + GBENU_STATS_P1(tx_pri0_drop_bcnt), + GBENU_STATS_P1(tx_pri1_drop_bcnt), + GBENU_STATS_P1(tx_pri2_drop_bcnt), + GBENU_STATS_P1(tx_pri3_drop_bcnt), + GBENU_STATS_P1(tx_pri4_drop_bcnt), + GBENU_STATS_P1(tx_pri5_drop_bcnt), + GBENU_STATS_P1(tx_pri6_drop_bcnt), + GBENU_STATS_P1(tx_pri7_drop_bcnt), /* GBENU Module 2 */ GBENU_STATS_P2(rx_good_frames), GBENU_STATS_P2(rx_broadcast_frames), @@ -1072,7 +1110,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_P2(ale_unknown_mcast_bytes), GBENU_STATS_P2(ale_unknown_bcast), GBENU_STATS_P2(ale_unknown_bcast_bytes), + GBENU_STATS_P2(ale_pol_match), + GBENU_STATS_P2(ale_pol_match_red), + GBENU_STATS_P2(ale_pol_match_yellow), GBENU_STATS_P2(tx_mem_protect_err), + GBENU_STATS_P2(tx_pri0_drop), + GBENU_STATS_P2(tx_pri1_drop), + GBENU_STATS_P2(tx_pri2_drop), + GBENU_STATS_P2(tx_pri3_drop), + GBENU_STATS_P2(tx_pri4_drop), + GBENU_STATS_P2(tx_pri5_drop), + GBENU_STATS_P2(tx_pri6_drop), + GBENU_STATS_P2(tx_pri7_drop), + GBENU_STATS_P2(tx_pri0_drop_bcnt), + GBENU_STATS_P2(tx_pri1_drop_bcnt), + GBENU_STATS_P2(tx_pri2_drop_bcnt), + GBENU_STATS_P2(tx_pri3_drop_bcnt), + GBENU_STATS_P2(tx_pri4_drop_bcnt), + GBENU_STATS_P2(tx_pri5_drop_bcnt), + GBENU_STATS_P2(tx_pri6_drop_bcnt), + GBENU_STATS_P2(tx_pri7_drop_bcnt), /* GBENU Module 3 */ GBENU_STATS_P3(rx_good_frames), GBENU_STATS_P3(rx_broadcast_frames), @@ -1119,7 +1176,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_P3(ale_unknown_mcast_bytes),
[net-next PATCH v0 1/6] net: netcp: Fixes the use of spin_lock_bh in timer function
This patch fixes a bug in which the timer routine synchronized against the ethtool-triggered statistics updates with spin_lock_bh(). A timer function is itself a bottom-half, so this should be spin_lock(). Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 9b7e0a3..cabf977 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -2189,14 +2189,15 @@ static void netcp_ethss_timer(unsigned long arg) netcp_ethss_update_link_state(gbe_dev, slave, NULL); } - spin_lock_bh(gbe_dev-hw_stats_lock); + /* A timer runs as a BH, no need to block them */ + spin_lock(gbe_dev-hw_stats_lock); if (gbe_dev-ss_version == GBE_SS_VERSION_14) gbe_update_stats_ver14(gbe_dev, NULL); else gbe_update_stats(gbe_dev, NULL); - spin_unlock_bh(gbe_dev-hw_stats_lock); + spin_unlock(gbe_dev-hw_stats_lock); gbe_dev-timer.expires = jiffies + GBE_TIMER_INTERVAL; add_timer(gbe_dev-timer); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next PATCH v0 2/6] net: netcp: Fixes hw statistics module base setting error
This patch fixes error in the setting of the hw statistics module base for K2HK platform. In K2HK although there are 4 hw statistics modules, but only 2 are visible at a time. Thus when setting up the pointers to the base of the corresponding hw statistics modules, modules 0 and 2 should point to one base, while modules 1 and 3 should point to the other. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index cabf977..b954856 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -2675,10 +2675,14 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev-sgmii_port_regs = gbe_dev-ss_regs + GBE13_SGMII_MODULE_OFFSET; gbe_dev-host_port_regs = gbe_dev-switch_regs + GBE13_HOST_PORT_OFFSET; + /* K2HK has only 2 hw stats modules visible at a time, so +* module 0 2 points to one base and +* module 1 3 points to the other base +*/ for (i = 0; i gbe_dev-max_num_slaves; i++) { gbe_dev-hw_stats_regs[i] = gbe_dev-switch_regs + GBE13_HW_STATS_OFFSET + - (GBE_HW_STATS_REG_MAP_SZ * i); + (GBE_HW_STATS_REG_MAP_SZ * (i 0x1)); } gbe_dev-ale_reg = gbe_dev-switch_regs + GBE13_ALE_OFFSET; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] cxgb4vf: Read correct FL congestion threshold for T5 and T6
VF driver was reading incorrect freelist congestion notification threshold for FLM queues when packing is enabled for T5 and T6 adapter. Fixing it now. Signed-off-by: Hariprasad Shenai haripra...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 5 + drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 18 -- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index 375a825..ed8a8f3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h @@ -338,6 +338,11 @@ #define EGRTHRESHOLDPACKING_G(x) \ (((x) EGRTHRESHOLDPACKING_S) EGRTHRESHOLDPACKING_M) +#define T6_EGRTHRESHOLDPACKING_S16 +#define T6_EGRTHRESHOLDPACKING_M0xffU +#define T6_EGRTHRESHOLDPACKING_G(x) \ + (((x) T6_EGRTHRESHOLDPACKING_S) T6_EGRTHRESHOLDPACKING_M) + #define SGE_TIMESTAMP_LO_A 0x1098 #define SGE_TIMESTAMP_HI_A 0x109c diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 1d5e77a..fa3786a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c @@ -2668,8 +2668,22 @@ int t4vf_sge_init(struct adapter *adapter) * give it more Free List entries. (Note that the SGE's Egress * Congestion Threshold is in units of 2 Free List pointers.) */ - s-fl_starve_thres - = EGRTHRESHOLD_G(sge_params-sge_congestion_control)*2 + 1; + switch (CHELSIO_CHIP_VERSION(adapter-params.chip)) { + case CHELSIO_T4: + s-fl_starve_thres = + EGRTHRESHOLD_G(sge_params-sge_congestion_control); + break; + case CHELSIO_T5: + s-fl_starve_thres = + EGRTHRESHOLDPACKING_G(sge_params-sge_congestion_control); + break; + case CHELSIO_T6: + default: + s-fl_starve_thres = + T6_EGRTHRESHOLDPACKING_G(sge_params-sge_congestion_control); + break; + } + s-fl_starve_thres = s-fl_starve_thres * 2 + 1; /* * Set up tasklet timers. -- 2.3.4 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [NET-NEXT PATCH] net: macb: Change capability mask for jumbo support
On 23/07/2015 at 15:44:25 +0530, Harini Katakam wrote : JUMBO and NO_GIGABIT_HALF have the same capability masks. Change one of them. Signed-off-by: Harini Katakam hari...@xilinx.com Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 0/4] Introduce Mellanox Technologies Switch ASICs switchdev drivers
Fri, Jul 24, 2015 at 02:03:20AM CEST, sfel...@gmail.com wrote: On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote: This patchset introduces Mellanox Technologies Switch driver infrastructure and support for SwitchX-2 ASIC. The driver is divided into 3 logical parts: 1) Bus - implements switch bus interface. Currently only PCI bus is implemented, but more buses will be added in the future. Namely I2C and SGMII. (patch #2) 2) Driver - implemements of ASIC-specific functions. Currently SwitchX-2 ASIC is supported, but a plan exists to introduce support for Spectrum ASIC in the near future. (patch #4) 3) Core - infrastructure that glues buses and drivers together. It implements register access logic (EMADs) and takes care of RX traps and events. (patch #1 and #3) Ido Schimmel (1): mlxsw: Add interface to access registers and process events Jiri Pirko (3): mlxsw: Introduce Mellanox switch driver core mlxsw: Add PCI bus implementation mlxsw: Introduce Mellanox SwitchX-2 ASIC support This is awesome! Reviewing... Thanks! checkpatch.pl shows 1 ERROR, bunch of 80 chars WARNs, and bunch of CHECKs on space after cast. Those 80char WARNs are mostly macro \ on col 81. That is afaik ok. Maybe that should be changed in checkpatch as well. The error is false possitive. It is again in macro, checkpatch thinks it is a function and yells about { on the same line. However it is a struct initialization so in that case it is ok. On the CHECKs on space after cast, should we modify checkpatch.pl to not flag those for drivers/net? I agree. -scott -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events
Thu, Jul 23, 2015 at 11:12:20PM CEST, go...@cumulusnetworks.com wrote: On Thu, Jul 23, 2015 at 05:43:35PM +0200, Jiri Pirko wrote: From: Ido Schimmel ido...@mellanox.com Add the ability to construct mailbox-style register access messages called EMADs with provisions to construct and parse the registers payload. Implement EMAD transaction layer which is responsible for the reliable transmission of EMADs. Also, add an infrastructure used by the switch driver to register for particular events generated by the device. Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- drivers/net/ethernet/mellanox/mlxsw/core.c | 736 drivers/net/ethernet/mellanox/mlxsw/core.h | 21 + drivers/net/ethernet/mellanox/mlxsw/emad.h | 127 +++ drivers/net/ethernet/mellanox/mlxsw/port.h | 19 + drivers/net/ethernet/mellanox/mlxsw/reg.h | 1289 5 files changed, 2192 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/emad.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/reg.h diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 211ec9b..bd0f692 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c [...] +struct list_head event_listener_list; +struct { +struct sk_buff *resp_skb; +u64 tid; +wait_queue_head_t wait; +bool trans_active; +struct mutex lock; /* One EMAD transaction at a time. */ +bool use_emad; +} emad; struct mlxsw_core_pcpu_stats __percpu *pcpu_stats; struct dentry *dbg_dir; struct { [...] } INIT_LIST_HEAD(mlxsw_core-rx_listener_list); +INIT_LIST_HEAD(mlxsw_core-event_listener_list); mlxsw_core-driver = mlxsw_driver; mlxsw_core-bus = mlxsw_bus; mlxsw_core-bus_priv = bus_priv; [...] +/* No reason to save item if we did not manage to register an RX + * listener for it. + */ +list_add_rcu(el_item-list, mlxsw_core-event_listener_list); + I see where 'event_listener_list' is defined and where entries are added/removed, but where is the code that would receive these events and presumably search this list so all handlers registered (currently just PUDE) can handle events? That is handled by calling mlxsw_core_rx_listener_register. that will add each event handler as a item to mlxsw_core-rx_listener_list These rx_listeners are called from mlxsw_core_skb_receive. So event is here a special case of rx_listener. The event list is used just to contain struct mlxsw_event_listener_item instances. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 2/4] mlxsw: Add PCI bus implementation
Fri, Jul 24, 2015 at 06:52:16AM CEST, sfel...@gmail.com wrote: On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote: From: Jiri Pirko j...@mellanox.com Add PCI bus implementation for Mellanox Technologies Switch ASICs. This includes firmware initialization, async queues manipulation and command interface implementation. Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com [cut] +static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, + const struct mlxsw_tx_info *tx_info) +{ + struct mlxsw_pci *mlxsw_pci = bus_priv; + struct mlxsw_pci_queue *q; + struct mlxsw_pci_queue_elem_info *elem_info; + char *wqe; + int i; + int err; + + if (skb_shinfo(skb)-nr_frags MLXSW_PCI_WQE_SG_ENTRIES - 1) + return -EINVAL; Can you skb_linearize() here to try to continue? Sure, I think we can do it. This would be good to have in rocker too. + q = mlxsw_pci_sdq_pick(mlxsw_pci, tx_info); + spin_lock_bh(q-lock); + elem_info = mlxsw_pci_queue_elem_info_producer_get(q); + if (!elem_info) { + /* queue is full */ + err = -EAGAIN; + goto unlock; + } + elem_info-u.sdq.skb = skb; + + wqe = elem_info-elem; + mlxsw_pci_wqe_c_set(wqe, 1); /* always report completion */ + mlxsw_pci_wqe_lp_set(wqe, !!tx_info-is_emad); + mlxsw_pci_wqe_type_set(wqe, MLXSW_PCI_WQE_TYPE_ETHERNET); + + err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb-data, +skb_headlen(skb), DMA_TO_DEVICE); + if (err) + goto unlock; + + for (i = 0; i skb_shinfo(skb)-nr_frags; i++) { + const skb_frag_t *frag = skb_shinfo(skb)-frags[i]; + + err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, i + 1, +skb_frag_address(frag), +skb_frag_size(frag), +DMA_TO_DEVICE); + if (err) + goto unmap_frags; + } + + /* Set unused sq entries byte count to zero. */ + for (i++; i MLXSW_PCI_WQE_SG_ENTRIES; i++) + mlxsw_pci_wqe_byte_count_set(wqe, i, 0); Is hw OK with not clearing the unused sq entries dma_address? Setting byte_count to zero must be sufficient? Yes, byte_count == 0 is sufficient. No need to set address. + + /* Everything is set up, ring producer doorbell to get HW going */ + q-producer_counter++; + mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q); + + goto unlock; + +unmap_frags: + for (; i = 0; i--) + mlxsw_pci_wqe_frag_unmap(mlxsw_pci, wqe, i, DMA_TO_DEVICE); +unlock: + spin_unlock_bh(q-lock); + return err; +} + +static int mlxsw_pci_cmd_exec(void *bus_priv, u16 opcode, u8 opcode_mod, + u32 in_mod, bool out_mbox_direct, + char *in_mbox, size_t in_mbox_size, + char *out_mbox, size_t out_mbox_size, + u8 *p_status) +{ + struct mlxsw_pci *mlxsw_pci = bus_priv; + dma_addr_t in_mapaddr = 0; + dma_addr_t out_mapaddr = 0; + bool evreq = mlxsw_pci-cmd.nopoll; + unsigned long timeout = msecs_to_jiffies(MLXSW_PCI_CIR_TIMEOUT_MSECS); + bool *p_wait_done = mlxsw_pci-cmd.wait_done; Why is this initialized and then later set to false? *p_wait_done so we actually set not p_wait_done but mlxsw_pci-cmd.wait_done there. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] inet: Always increment refcount in inet_twsk_schedule
Actually we do increment refcnt, for every socket found in ehash. Carefully read again __inet_lookup_established() This code is generic for ESTABLISH and TIME-WAIT sockets If you found a code that performed the lookup without taking the refcnt, please point me at it, this would be a serious bug. From my previous observations, it appears as if 1. this check is bypassed 2. the refcount is incremented here but is decremented before it reaches the packet processing in tcp_timewait_state_process() I will try to debug this and update. Is it some Android kernel ? Android had private modules that needed an update in 3.18 Yes, the kernel is based on Android 3.18. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] phylib: add driver for aquantia phy
Le 07/23/15 20:46, shh@gmail.com a écrit : From: Shaohui Xie shaohui@freescale.com This patch added driver to support Aquantia PHYs AQ1202, AQ2104, AQR105, AQR405, which accessed through clause 45. Could you prefix your patches with net: phy: in the future to be consistent with what is typically used? See comments below Signed-off-by: Shaohui Xie shaohui@freescale.com --- [snip] +static int aquantia_read_status(struct phy_device *phydev) +{ + int reg; + + phydev-speed = SPEED_1; + phydev-duplex = DUPLEX_FULL; + + reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); + reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); + if (reg MDIO_STAT1_LSTATUS) + phydev-link = 1; + else + phydev-link = 0; + + reg = phy_read_mmd(phydev, MDIO_MMD_AN, 0xc800); + mdelay(10); + reg = phy_read_mmd(phydev, MDIO_MMD_AN, 0xc800); + if (reg == 0x9) + phydev-speed = SPEED_2500; + else if (reg == 0x5) + phydev-speed = SPEED_1000; + else if (reg == 0x3) + phydev-speed = SPEED_100; Could we use a switch/case here? How about 10Mbits/sec and duplex are we guaranteed to be full-duplex at e.g: 100 or 10Mbits/sec? + + return 0; +} + +static struct phy_driver aquantia_driver[] = { +{ + .phy_id = PHY_ID_AQ1202, + .phy_id_mask= 0xfff0, + .name = Aquantia AQ1202, + .features = PHY_GBIT_FEATURES, If these are 10GbE PHYs, should not we start defining a new features bitmask here to reflect that accordingly? That way MAC + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner = THIS_MODULE,}, +}, +{ + .phy_id = PHY_ID_AQ2104, + .phy_id_mask= 0xfff0, + .name = Aquantia AQ2104, + .features = PHY_GBIT_FEATURES, + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner = THIS_MODULE,}, +}, +{ + .phy_id = PHY_ID_AQR105, + .phy_id_mask= 0xfff0, + .name = Aquantia AQR105, + .features = PHY_GBIT_FEATURES, + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner = THIS_MODULE,}, +}, +{ + .phy_id = PHY_ID_AQR405, + .phy_id_mask= 0xfff0, + .name = Aquantia AQR405, + .features = PHY_GBIT_FEATURES, + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner = THIS_MODULE,}, +}, +}; + +static int __init aquantia_init(void) +{ + return phy_drivers_register(aquantia_driver, + ARRAY_SIZE(aquantia_driver)); +} + +static void __exit aquantia_exit(void) +{ + return phy_drivers_unregister(aquantia_driver, + ARRAY_SIZE(aquantia_driver)); +} + +module_init(aquantia_init); +module_exit(aquantia_exit); + +static struct mdio_device_id __maybe_unused aquantia_tbl[] = { + { PHY_ID_AQ1202, 0xfff0 }, + { PHY_ID_AQ2104, 0xfff0 }, + { PHY_ID_AQR105, 0xfff0 }, + { PHY_ID_AQR405, 0xfff0 }, + { } +}; + +MODULE_DEVICE_TABLE(mdio, aquantia_tbl); + +MODULE_DESCRIPTION(Aquantia PHY driver); +MODULE_AUTHOR(Shaohui Xie shaohui@freescale.com); +MODULE_LICENSE(GPL v2); -- Florian -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH v3 net-next 2/3] tcp: add in_flight to tcp_skb_cb
Hi, Lawrence Brakmo wrote: Based on comments by Neal Cardwell to tcp_nv patch: AFAICT this patch would not require an increase in the size of sk_buff cb[] if it were to take advantage of the fact that the tcp_skb_cb header.h4 and header.h6 fields are only used in the packet reception code path, and this in_flight field is only used on the transmit side. So the in_flight field could be placed in a struct that is itself placed in a union with the header union. Please make another patch only for this. That way the sender code can remember the in_flight value without requiring any extra space. And in the future other sender-side info could be stored in the tx struct, if needed. Signed-off-by: Lawrence Brakmo bra...@fb.com --- include/net/tcp.h | 13 ++--- net/ipv4/tcp_input.c | 5 - net/ipv4/tcp_output.c | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 1e6c5b04..b98d79a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -755,11 +755,17 @@ struct tcp_skb_cb { /* 1 byte hole */ __u32 ack_seq;/* Sequence number ACK'd*/ union { - struct inet_skb_parmh4; + struct { + /* bytes in flight when this packet was sent */ + __u32 in_flight; + } tx; /* only used for outgoing skbs */ + union { + struct inet_skb_parmh4; #if IS_ENABLED(CONFIG_IPV6) - struct inet6_skb_parm h6; + struct inet6_skb_parm h6; #endif - } header; /* For incoming frames */ + } header; /* For incoming skbs */ + }; }; #define TCP_SKB_CB(__skb)((struct tcp_skb_cb *)((__skb)-cb[0])) @@ -837,6 +843,7 @@ union tcp_cc_info; struct ack_sample { u32 pkts_acked; s32 rtt_us; + u32 in_flight; }; struct tcp_congestion_ops { diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 423d3af..3ab4178 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3068,6 +3068,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, long ca_rtt_us = -1L; struct sk_buff *skb; u32 pkts_acked = 0; + u32 last_in_flight = 0; bool rtt_update; int flag = 0; @@ -3107,6 +3108,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, if (!first_ackt.v64) first_ackt = last_ackt; + last_in_flight = TCP_SKB_CB(skb)-tx.in_flight; reord = min(pkts_acked, reord); if (!after(scb-end_seq, tp-high_seq)) flag |= FLAG_ORIG_SACK_ACKED; @@ -3196,7 +3198,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, } if (icsk-icsk_ca_ops-pkts_acked) { - struct ack_sample sample = {pkts_acked, ca_rtt_us}; + struct ack_sample sample = {pkts_acked, ca_rtt_us, + last_in_flight}; icsk-icsk_ca_ops-pkts_acked(sk, sample); } diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 7105784..e9deab5 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -920,9 +920,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, int err; BUG_ON(!skb || !tcp_skb_pcount(skb)); + tp = tcp_sk(sk); if (clone_it) { skb_mstamp_get(skb-skb_mstamp); + TCP_SKB_CB(skb)-tx.in_flight = TCP_SKB_CB(skb)-end_seq + - tp-snd_una; if (unlikely(skb_cloned(skb))) skb = pskb_copy(skb, gfp_mask); @@ -933,7 +936,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, } inet = inet_sk(sk); - tp = tcp_sk(sk); tcb = TCP_SKB_CB(skb); memset(opts, 0, sizeof(opts)); -- 吉藤英明 hideaki.yoshif...@miraclelinux.com ミラクル・リナックス株式会社 技術本部 サポート部 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events
Fri, Jul 24, 2015 at 07:13:42AM CEST, sfel...@gmail.com wrote: On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote: From: Ido Schimmel ido...@mellanox.com Add the ability to construct mailbox-style register access messages called EMADs with provisions to construct and parse the registers payload. Implement EMAD transaction layer which is responsible for the reliable transmission of EMADs. Also, add an infrastructure used by the switch driver to register for particular events generated by the device. What is this EMADs used for? Is this for intra-switch or inter-switch communications? It is used for passing configuration messages to/from switch device. It is also used for events. EMADS are passed inside skb like ordinary packets. They do not leave the switch. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v2 2/3] r8152: fix wakeup settings
Avoid the driver to enable WOL if the device doesn't support it. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/r8152.c | 28 ++-- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e3a0110..d537c30 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2378,6 +2378,13 @@ static void r8153_power_cut_en(struct r8152 *tp, bool enable) ocp_write_word(tp, MCU_TYPE_USB, USB_MISC_0, ocp_data); } +static bool rtl_can_wakeup(struct r8152 *tp) +{ + struct usb_device *udev = tp-udev; + + return (udev-actconfig-desc.bmAttributes USB_CONFIG_ATT_WAKEUP); +} + static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) { if (enable) { @@ -3417,12 +3424,15 @@ static void rtl8152_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) if (usb_autopm_get_interface(tp-intf) 0) return; - mutex_lock(tp-control); - - wol-supported = WAKE_ANY; - wol-wolopts = __rtl_get_wol(tp); - - mutex_unlock(tp-control); + if (!rtl_can_wakeup(tp)) { + wol-supported = 0; + wol-wolopts = 0; + } else { + mutex_lock(tp-control); + wol-supported = WAKE_ANY; + wol-wolopts = __rtl_get_wol(tp); + mutex_unlock(tp-control); + } usb_autopm_put_interface(tp-intf); } @@ -3432,6 +3442,9 @@ static int rtl8152_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) struct r8152 *tp = netdev_priv(dev); int ret; + if (!rtl_can_wakeup(tp)) + return -EOPNOTSUPP; + ret = usb_autopm_get_interface(tp-intf); if (ret 0) goto out_set_wol; @@ -4073,6 +4086,9 @@ static int rtl8152_probe(struct usb_interface *intf, goto out1; } + if (!rtl_can_wakeup(tp)) + __rtl_set_wol(tp, 0); + tp-saved_wolopts = __rtl_get_wol(tp); if (tp-saved_wolopts) device_set_wakeup_enable(udev-dev, true); -- 2.4.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v2 0/3] r8152: issues fix
v2: Replace patch #2 with r8152: fix wakeup settings. v1: These patches are used to fix issues. Hayes Wang (3): r8152: fix the issue about U1/U2 - r8152: fix remote wakeup + r8152: fix wakeup settings r8152: don't enable napi before rx ready drivers/net/usb/r8152.c | 103 1 file changed, 60 insertions(+), 43 deletions(-) -- 2.4.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v2 3/3] r8152: don't enable napi before rx ready
Adjust napi_disable() and napi_enable() to avoid r8152_poll() start working before rx ready. Otherwise, it may have race condition for rx_agg. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/r8152.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index d537c30..144dc64 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2075,7 +2075,6 @@ static int rtl_start_rx(struct r8152 *tp) { int i, ret = 0; - napi_disable(tp-napi); INIT_LIST_HEAD(tp-rx_done); for (i = 0; i RTL8152_MAX_RX; i++) { INIT_LIST_HEAD(tp-rx_info[i].list); @@ -2083,7 +2082,6 @@ static int rtl_start_rx(struct r8152 *tp) if (ret) break; } - napi_enable(tp-napi); if (ret ++i RTL8152_MAX_RX) { struct list_head rx_queue; @@ -2951,8 +2949,10 @@ static void set_carrier(struct r8152 *tp) if (!netif_carrier_ok(netdev)) { tp-rtl_ops.enable(tp); set_bit(RTL8152_SET_RX_MODE, tp-flags); + napi_disable(tp-napi); netif_carrier_on(netdev); rtl_start_rx(tp); + napi_enable(tp-napi); } } else { if (netif_carrier_ok(netdev)) { @@ -3395,9 +3395,11 @@ static int rtl8152_resume(struct usb_interface *intf) if (test_bit(SELECTIVE_SUSPEND, tp-flags)) { rtl_runtime_suspend_enable(tp, false); clear_bit(SELECTIVE_SUSPEND, tp-flags); + napi_disable(tp-napi); set_bit(WORK_ENABLE, tp-flags); if (netif_carrier_ok(tp-netdev)) rtl_start_rx(tp); + napi_enable(tp-napi); } else { tp-rtl_ops.up(tp); rtl8152_set_speed(tp, AUTONEG_ENABLE, -- 2.4.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events
On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote: From: Ido Schimmel ido...@mellanox.com Add the ability to construct mailbox-style register access messages called EMADs with provisions to construct and parse the registers payload. Implement EMAD transaction layer which is responsible for the reliable transmission of EMADs. Also, add an infrastructure used by the switch driver to register for particular events generated by the device. What is this EMADs used for? Is this for intra-switch or inter-switch communications? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v2 1/3] r8152: fix the issue about U1/U2
- Disable U1/U2 during initialization. - Disable lpm when linking is on, and enable it when linking is off. - Disable U1/U2 when enabling runtime suspend. It is possible to let hw stop working, if the U1/U2 request occurs during some situations. The patch is used to avoid it. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/r8152.c | 94 - 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 7f6419e..e3a0110 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2166,6 +2166,7 @@ static int rtl8153_enable(struct r8152 *tp) if (test_bit(RTL8152_UNPLUG, tp-flags)) return -ENODEV; + usb_disable_lpm(tp-udev); set_tx_qlen(tp); rtl_set_eee_plus(tp); r8153_set_rx_early_timeout(tp); @@ -2337,11 +2338,54 @@ static void __rtl_set_wol(struct r8152 *tp, u32 wolopts) device_set_wakeup_enable(tp-udev-dev, false); } +static void r8153_u1u2en(struct r8152 *tp, bool enable) +{ + u8 u1u2[8]; + + if (enable) + memset(u1u2, 0xff, sizeof(u1u2)); + else + memset(u1u2, 0x00, sizeof(u1u2)); + + usb_ocp_write(tp, USB_TOLERANCE, BYTE_EN_SIX_BYTES, sizeof(u1u2), u1u2); +} + +static void r8153_u2p3en(struct r8152 *tp, bool enable) +{ + u32 ocp_data; + + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_U2P3_CTRL); + if (enable tp-version != RTL_VER_03 tp-version != RTL_VER_04) + ocp_data |= U2P3_ENABLE; + else + ocp_data = ~U2P3_ENABLE; + ocp_write_word(tp, MCU_TYPE_USB, USB_U2P3_CTRL, ocp_data); +} + +static void r8153_power_cut_en(struct r8152 *tp, bool enable) +{ + u32 ocp_data; + + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_POWER_CUT); + if (enable) + ocp_data |= PWR_EN | PHASE2_EN; + else + ocp_data = ~(PWR_EN | PHASE2_EN); + ocp_write_word(tp, MCU_TYPE_USB, USB_POWER_CUT, ocp_data); + + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0); + ocp_data = ~PCUT_STATUS; + ocp_write_word(tp, MCU_TYPE_USB, USB_MISC_0, ocp_data); +} + static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) { if (enable) { u32 ocp_data; + r8153_u1u2en(tp, false); + r8153_u2p3en(tp, false); + __rtl_set_wol(tp, WAKE_ANY); ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); @@ -2353,6 +2397,8 @@ static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); } else { __rtl_set_wol(tp, tp-saved_wolopts); + r8153_u2p3en(tp, true); + r8153_u1u2en(tp, true); } } @@ -2599,46 +2645,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) set_bit(PHY_RESET, tp-flags); } -static void r8153_u1u2en(struct r8152 *tp, bool enable) -{ - u8 u1u2[8]; - - if (enable) - memset(u1u2, 0xff, sizeof(u1u2)); - else - memset(u1u2, 0x00, sizeof(u1u2)); - - usb_ocp_write(tp, USB_TOLERANCE, BYTE_EN_SIX_BYTES, sizeof(u1u2), u1u2); -} - -static void r8153_u2p3en(struct r8152 *tp, bool enable) -{ - u32 ocp_data; - - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_U2P3_CTRL); - if (enable) - ocp_data |= U2P3_ENABLE; - else - ocp_data = ~U2P3_ENABLE; - ocp_write_word(tp, MCU_TYPE_USB, USB_U2P3_CTRL, ocp_data); -} - -static void r8153_power_cut_en(struct r8152 *tp, bool enable) -{ - u32 ocp_data; - - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_POWER_CUT); - if (enable) - ocp_data |= PWR_EN | PHASE2_EN; - else - ocp_data = ~(PWR_EN | PHASE2_EN); - ocp_write_word(tp, MCU_TYPE_USB, USB_POWER_CUT, ocp_data); - - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0); - ocp_data = ~PCUT_STATUS; - ocp_write_word(tp, MCU_TYPE_USB, USB_MISC_0, ocp_data); -} - static void r8153_first_init(struct r8152 *tp) { u32 ocp_data; @@ -2781,6 +2787,7 @@ static void rtl8153_disable(struct r8152 *tp) r8153_disable_aldps(tp); rtl_disable(tp); r8153_enable_aldps(tp); + usb_enable_lpm(tp-udev); } static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) @@ -2901,9 +2908,13 @@ static void rtl8153_up(struct r8152 *tp) if (test_bit(RTL8152_UNPLUG, tp-flags)) return; + r8153_u1u2en(tp, false); r8153_disable_aldps(tp); r8153_first_init(tp); r8153_enable_aldps(tp); + r8153_u2p3en(tp, true); + r8153_u1u2en(tp, true); + usb_enable_lpm(tp-udev); } static void rtl8153_down(struct r8152 *tp) @@ -2914,6 +2925,7 @@ static
[RFC PATCH v3 net-next 1/3] tcp: replace cnt rtt with struct in pkts_acked()
Replace 2 arguments (cnt and rtt) in the congestion control modules' pkts_acked() function with a struct. This will allow adding more information without having to modify existing congestion control modules (tcp_nv in particular needs bytes in flight when packet was sent). As proposed by Neal Cardwell in his comments to the tcp_nv patch. Signed-off-by: Lawrence Brakmo bra...@fb.com --- include/net/tcp.h | 7 ++- net/ipv4/tcp_bic.c | 6 +++--- net/ipv4/tcp_cdg.c | 14 +++--- net/ipv4/tcp_cubic.c| 6 +++--- net/ipv4/tcp_htcp.c | 10 +- net/ipv4/tcp_illinois.c | 20 ++-- net/ipv4/tcp_input.c| 7 +-- net/ipv4/tcp_lp.c | 6 +++--- net/ipv4/tcp_vegas.c| 6 +++--- net/ipv4/tcp_vegas.h| 2 +- net/ipv4/tcp_veno.c | 6 +++--- net/ipv4/tcp_westwood.c | 6 +++--- net/ipv4/tcp_yeah.c | 6 +++--- 13 files changed, 55 insertions(+), 47 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 364426a..1e6c5b04 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -834,6 +834,11 @@ enum tcp_ca_ack_event_flags { union tcp_cc_info; +struct ack_sample { + u32 pkts_acked; + s32 rtt_us; +}; + struct tcp_congestion_ops { struct list_headlist; u32 key; @@ -857,7 +862,7 @@ struct tcp_congestion_ops { /* new value of cwnd after loss (optional) */ u32 (*undo_cwnd)(struct sock *sk); /* hook for packet ack accounting (optional) */ - void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us); + void (*pkts_acked)(struct sock *sk, struct ack_sample *sample); /* get info for inet_diag (optional) */ size_t (*get_info)(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info); diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c index fd1405d..f237691 100644 --- a/net/ipv4/tcp_bic.c +++ b/net/ipv4/tcp_bic.c @@ -197,15 +197,15 @@ static void bictcp_state(struct sock *sk, u8 new_state) /* Track delayed acknowledgment ratio using sliding window * ratio = (15*ratio + sample) / 16 */ -static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt) +static void bictcp_acked(struct sock *sk, struct ack_sample *sample) { const struct inet_connection_sock *icsk = inet_csk(sk); if (icsk-icsk_ca_state == TCP_CA_Open) { struct bictcp *ca = inet_csk_ca(sk); - cnt -= ca-delayed_ack ACK_RATIO_SHIFT; - ca-delayed_ack += cnt; + ca-delayed_ack += sample-pkts_acked - + (ca-delayed_ack ACK_RATIO_SHIFT); } } diff --git a/net/ipv4/tcp_cdg.c b/net/ipv4/tcp_cdg.c index 167b6a3..9fbdfa5 100644 --- a/net/ipv4/tcp_cdg.c +++ b/net/ipv4/tcp_cdg.c @@ -294,12 +294,12 @@ static void tcp_cdg_cong_avoid(struct sock *sk, u32 ack, u32 acked) ca-shadow_wnd = max(ca-shadow_wnd, ca-shadow_wnd + incr); } -static void tcp_cdg_acked(struct sock *sk, u32 num_acked, s32 rtt_us) +static void tcp_cdg_acked(struct sock *sk, struct ack_sample *sample) { struct cdg *ca = inet_csk_ca(sk); struct tcp_sock *tp = tcp_sk(sk); - if (rtt_us = 0) + if (sample-rtt_us = 0) return; /* A heuristic for filtering delayed ACKs, adapted from: @@ -307,20 +307,20 @@ static void tcp_cdg_acked(struct sock *sk, u32 num_acked, s32 rtt_us) * delay and rate based TCP mechanisms. TR 100219A. CAIA, 2010. */ if (tp-sacked_out == 0) { - if (num_acked == 1 ca-delack) { + if (sample-pkts_acked == 1 ca-delack) { /* A delayed ACK is only used for the minimum if it is * provenly lower than an existing non-zero minimum. */ - ca-rtt.min = min(ca-rtt.min, rtt_us); + ca-rtt.min = min(ca-rtt.min, sample-rtt_us); ca-delack--; return; - } else if (num_acked 1 ca-delack 5) { + } else if (sample-pkts_acked 1 ca-delack 5) { ca-delack++; } } - ca-rtt.min = min_not_zero(ca-rtt.min, rtt_us); - ca-rtt.max = max(ca-rtt.max, rtt_us); + ca-rtt.min = min_not_zero(ca-rtt.min, sample-rtt_us); + ca-rtt.max = max(ca-rtt.max, sample-rtt_us); } static u32 tcp_cdg_ssthresh(struct sock *sk) diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 28011fb..9817a8f 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -416,21 +416,21 @@ static void hystart_update(struct sock *sk, u32 delay) /* Track delayed acknowledgment ratio using sliding window * ratio = (15*ratio + sample) / 16 */ -static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) +static void bictcp_acked(struct sock *sk, struct ack_sample *sample) { const struct tcp_sock *tp = tcp_sk(sk);
[RFC PATCH v3 net-next 2/3] tcp: add in_flight to tcp_skb_cb
Based on comments by Neal Cardwell to tcp_nv patch: AFAICT this patch would not require an increase in the size of sk_buff cb[] if it were to take advantage of the fact that the tcp_skb_cb header.h4 and header.h6 fields are only used in the packet reception code path, and this in_flight field is only used on the transmit side. So the in_flight field could be placed in a struct that is itself placed in a union with the header union. That way the sender code can remember the in_flight value without requiring any extra space. And in the future other sender-side info could be stored in the tx struct, if needed. Signed-off-by: Lawrence Brakmo bra...@fb.com --- include/net/tcp.h | 13 ++--- net/ipv4/tcp_input.c | 5 - net/ipv4/tcp_output.c | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 1e6c5b04..b98d79a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -755,11 +755,17 @@ struct tcp_skb_cb { /* 1 byte hole */ __u32 ack_seq;/* Sequence number ACK'd*/ union { - struct inet_skb_parmh4; + struct { + /* bytes in flight when this packet was sent */ + __u32 in_flight; + } tx; /* only used for outgoing skbs */ + union { + struct inet_skb_parmh4; #if IS_ENABLED(CONFIG_IPV6) - struct inet6_skb_parm h6; + struct inet6_skb_parm h6; #endif - } header; /* For incoming frames */ + } header; /* For incoming skbs */ + }; }; #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)((__skb)-cb[0])) @@ -837,6 +843,7 @@ union tcp_cc_info; struct ack_sample { u32 pkts_acked; s32 rtt_us; + u32 in_flight; }; struct tcp_congestion_ops { diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 423d3af..3ab4178 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3068,6 +3068,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, long ca_rtt_us = -1L; struct sk_buff *skb; u32 pkts_acked = 0; + u32 last_in_flight = 0; bool rtt_update; int flag = 0; @@ -3107,6 +3108,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, if (!first_ackt.v64) first_ackt = last_ackt; + last_in_flight = TCP_SKB_CB(skb)-tx.in_flight; reord = min(pkts_acked, reord); if (!after(scb-end_seq, tp-high_seq)) flag |= FLAG_ORIG_SACK_ACKED; @@ -3196,7 +3198,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, } if (icsk-icsk_ca_ops-pkts_acked) { - struct ack_sample sample = {pkts_acked, ca_rtt_us}; + struct ack_sample sample = {pkts_acked, ca_rtt_us, + last_in_flight}; icsk-icsk_ca_ops-pkts_acked(sk, sample); } diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 7105784..e9deab5 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -920,9 +920,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, int err; BUG_ON(!skb || !tcp_skb_pcount(skb)); + tp = tcp_sk(sk); if (clone_it) { skb_mstamp_get(skb-skb_mstamp); + TCP_SKB_CB(skb)-tx.in_flight = TCP_SKB_CB(skb)-end_seq + - tp-snd_una; if (unlikely(skb_cloned(skb))) skb = pskb_copy(skb, gfp_mask); @@ -933,7 +936,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, } inet = inet_sk(sk); - tp = tcp_sk(sk); tcb = TCP_SKB_CB(skb); memset(opts, 0, sizeof(opts)); -- 1.8.1 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH v3 net-next 3/3] tcp: add NV congestion control
This is a request for comments. TCP-NV (New Vegas) is a major update to TCP-Vegas. An earlier version of NV was presented at 2010's LPC (slides). It is a delayed based congestion avoidance for the data center. This version has been tested within a 10G rack where the HW RTTs are 20-50us. A description of TCP-NV, including implementation and experimental results, can be found at: http://www.brakmo.org/networking/tcp-nv/TCPNV.html The current version includes many module parameters to support experimentation with the parameters. Signed-off-by: Lawrence Brakmo bra...@fb.com --- net/ipv4/Kconfig | 16 ++ net/ipv4/Makefile | 1 + net/ipv4/tcp_nv.c | 479 ++ 3 files changed, 496 insertions(+) create mode 100644 net/ipv4/tcp_nv.c diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 6fb3c90..f11f2f8 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig @@ -539,6 +539,22 @@ config TCP_CONG_VEGAS window. TCP Vegas should provide less packet loss, but it is not as aggressive as TCP Reno. +config TCP_CONG_NV + tristate TCP NV + default n + ---help--- + TCP NV is a follow up to TCP Vegas. It has been modified to deal with + 10G networks, measurement noise introduced by LRO, GRO and interrupt + coalescence. In addition, it will decrease its cwnd multiplicatively + instead of linearly. + + Note that in general congestion avoidance (cwnd decreased when # packets + queued grows) cannot coexist with congestion control (cwnd decreased only + when there is packet loss) due to fairness issues. One scenario when they + can coexist safely is when the CA flows have RTTs CC flows RTTs. + + For further details see http://www.brakmo.org/networking/tcp-nv/ + config TCP_CONG_SCALABLE tristate Scalable TCP default n diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index efc43f3..06f335f 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_TCP_CONG_HSTCP) += tcp_highspeed.o obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybla.o obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o +obj-$(CONFIG_TCP_CONG_NV) += tcp_nv.o obj-$(CONFIG_TCP_CONG_VENO) += tcp_veno.o obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o diff --git a/net/ipv4/tcp_nv.c b/net/ipv4/tcp_nv.c new file mode 100644 index 000..c4379b8 --- /dev/null +++ b/net/ipv4/tcp_nv.c @@ -0,0 +1,479 @@ +/* + * TCP NV: TCP with Congestion Avoidance + * + * TCP-NV is a successor of TCP-Vegas that has been developed to + * deal with the issues that occur in modern networks. + * Like TCP-Vegas, TCP-NV supports true congestion avoidance, + * the ability to detect congestion before packet losses occur. + * When congestion (queue buildup) starts to occur, TCP-NV + * predicts what the cwnd size should be for the current + * throughput and it reduces the cwnd proportionally to + * the difference between the current cwnd and the predicted cwnd. + * TCP-NV behaves like Reno when no congestion is detected, or when + * recovering from packet losses. + * + * TODO: + * 1) Add option to not decrease cwnd on losses below certain level + * 2) Add mechanism to deal with reverse congestion. + */ + +#include linux/mm.h +#include linux/module.h +#include linux/math64.h +#include net/tcp.h +#include linux/inet_diag.h + +/* TCP NV parameters */ +static int nv_enable __read_mostly = 1; +static int nv_pad __read_mostly = 10; +static int nv_pad_buffer __read_mostly = 2; +static int nv_reset_period __read_mostly = 5; +static int nv_min_cwnd = 10; +static int nv_dec_eval_min_calls = 100; +static int nv_ssthresh_eval_min_calls = 30; +static int nv_rtt_min_cnt = 2; +static int nv_cong_decrease_mult = 30*128/100; +static int nv_ssthresh_factor = 8; +static int nv_rtt_factor = 128; +static int nv_rtt_cnt_dec_delta = 20; /* dec cwnd by this many RTTs */ +static int nv_dec_factor = 5; /* actual value is factor/8 */ +static int nv_loss_dec_factor = 820; /* on loss reduce cwnd by 20% */ +static int nv_cwnd_growth_factor = 2; /* larger = cwnd grows slower */ + +module_param(nv_pad, int, 0644); +MODULE_PARM_DESC(nv_pad, extra packets above congestion level); +module_param(nv_pad_buffer, int, 0644); +MODULE_PARM_DESC(nv_pad_buffer, no growth buffer zone); +module_param(nv_reset_period, int, 0644); +MODULE_PARM_DESC(nv_reset_period, nv_min_rtt reset period (secs)); +module_param(nv_min_cwnd, int, 0644); +MODULE_PARM_DESC(nv_min_cwnd, NV will not decrease cwnd below this value + without losses); +module_param(nv_dec_eval_min_calls, int, 0644); +MODULE_PARM_DESC(nv_dec_eval_min_calls, Wait for this many data points +before declaring congestion ( 256)); +module_param(nv_ssthresh_eval_min_calls, int, 0644); +MODULE_PARM_DESC(nv_ssthresh_eval_min_calls, Wait for this many data points +before declaring
[RFC PATCH v3 net-next 0/3] tcp: add NV congestion control
This patchset adds support for NV congestion control. The first patch replaces two arguments in the pkts_acked() function of the congestion control modules with a struct, making it easier to add more parameters later without modifying the existing congestion control modules. The second patch adds the number of bytes in_flight when a packet is sent to the tcp_skb_cb without increasing its size. The third patch adds NV congestion control support. [RFC PATCH v3 net-next 1/3] tcp: replace cnt rtt with struct in pkts_acked() [RFC PATCH v3 net-next 2/3] tcp: add in_flight to tcp_skb_cb [RFC PATCH v3 net-next 3/3] tcp: add NV congestion control Signed-off-by: Lawrence Brakmo bra...@fb.com include/net/tcp.h | 20 ++- net/ipv4/Kconfig| 16 ++ net/ipv4/Makefile | 1 + net/ipv4/tcp_bic.c | 6 +- net/ipv4/tcp_cdg.c | 14 +- net/ipv4/tcp_cubic.c| 6 +- net/ipv4/tcp_htcp.c | 10 +- net/ipv4/tcp_illinois.c | 20 +-- net/ipv4/tcp_input.c| 10 +- net/ipv4/tcp_lp.c | 6 +- net/ipv4/tcp_nv.c | 479 net/ipv4/tcp_output.c | 4 +- net/ipv4/tcp_vegas.c| 6 +- net/ipv4/tcp_vegas.h| 2 +- net/ipv4/tcp_veno.c | 6 +- net/ipv4/tcp_westwood.c | 6 +- net/ipv4/tcp_yeah.c | 6 +- 17 files changed, 567 insertions(+), 51 deletions(-) -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 4.2-rc3: APM xgene2: ethernet doesn't work
Hi Ming, On Thu, Jul 23, 2015 at 2:37 PM, Ming Lei ming@canonical.com wrote: Hi Guys, When booting from UEFI/ACPI, sometimes there is a crash[1] from rx path, sometimes there isn't any rx packets comming. Firmware version: 2.02.10 Thanks, [1], crash log Call trace: skbuff: skb_over_panic: text:ffc00048094c len:85 put:60 head: data: (null) tail:0x3c end:0x0 dev:NULL Kernel panic - not syncing: BUG! CPU: 0 PID: 0 Comm: swapper/0 Tainted: GW 4.2.0-rc3+ #76 Hardware name: AppliedMicro Mustang/Mustang, BIOS 2.0.0 Jun 9 2015 Call trace: [ffc89b94] dump_backtrace+0x0/0x12c [ffc89cd0] show_stack+0x10/0x1c [ffc0005fbe48] dump_stack+0x8c/0xdc [ffc0005f8448] panic+0xe4/0x220 [ffc0005fcfa4] skb_panic+0x74/0x78 [ffc000526e88] skb_put+0x88/0x8c [ffc000480948] xgene_enet_process_ring+0xcc/0x394 [ffc000480edc] xgene_enet_napi+0x1c/0x54 [ffc000537fbc] net_rx_action+0x124/0x2c0 [ffcb0070] __do_softirq+0x110/0x238 [ffcb0400] irq_exit+0x88/0xf0 [ffce98b8] __handle_domain_irq+0x68/0xb4 [ffc824a0] gic_handle_irq+0x30/0x7c Exception stack(0xffc000877dc0 to 0xffc000877ee0) 7dc0: 00874000 ffc0 0087a648 ffc0 00877f00 ffc0 000869e0 ffc0 7de0: 00877f10 ffc0 fffbcb38 ffc7 fffbcb44 ffc7 7e00: 0100 da24b9c8 ffc7 fffbe0d9 ffc7 fffbe0d8 ffc7 7e20: 008813a0 ffc0 9429 0750 008c93a9 ffc0 7e40: 007a1b38 ffc0 007a1b20 ffc0 df5d7500 ffbe 7e60: 98ab6000 007f 98a9d440 007f 00874000 ffc0 7e80: 0087a648 ffc0 00867b00 ffc0 0001 00877f20 ffc0 7ea0: 00614500 ffc0 00785000 ffc0 008c9000 ffc0 0087a6cc ffc0 7ec0: ffa01348 0047 00877f00 ffc0 000869dc ffc0 00877f00 ffc0 [ffc855a4] el1_irq+0x64/0xd8 [ffce03fc] default_idle_call+0x18/0x2c [ffce050c] cpu_startup_entry+0xfc/0x180 [ffc0005f5f64] rest_init+0x80/0x8c [ffc0008269b8] start_kernel+0x3c0/0x3d8 Rebooting in 1 seconds..[DRAM: PHY calibrating ...ignored] ECC init *ignored] It will be fixed in next release as it is a fix in firmware. -- Thanks, with regards, Suman Tripathi -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] dev: Spelling fix in comments
Fix the following typo - unchainged - unchanged Signed-off-by: Subash Abhinov Kasiviswanathan subas...@codeaurora.org --- net/core/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 488ba6c..44d1384 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4986,7 +4986,7 @@ EXPORT_SYMBOL(netdev_all_upper_get_next_dev_rcu); * Gets the next netdev_adjacent-private from the dev's lower neighbour * list, starting from iter position. The caller must hold either hold the * RTNL lock or its own locking that guarantees that the neighbour lower - * list will remain unchainged. + * list will remain unchanged. */ void *netdev_lower_get_next_private(struct net_device *dev, struct list_head **iter) @@ -5041,7 +5041,7 @@ EXPORT_SYMBOL(netdev_lower_get_next_private_rcu); * Gets the next netdev_adjacent from the dev's lower neighbour * list, starting from iter position. The caller must hold RTNL lock or * its own locking that guarantees that the neighbour lower - * list will remain unchainged. + * list will remain unchanged. */ void *netdev_lower_get_next(struct net_device *dev, struct list_head **iter) { -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] phylib: add driver for aquantia phy
From: Shaohui Xie shaohui@freescale.com This patch added driver to support Aquantia PHYs AQ1202, AQ2104, AQR105, AQR405, which accessed through clause 45. Signed-off-by: Shaohui Xie shaohui@freescale.com --- drivers/net/phy/Kconfig| 5 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/aquantia.c | 157 + 3 files changed, 163 insertions(+) create mode 100644 drivers/net/phy/aquantia.c diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index d6aff87..839b84c 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -14,6 +14,11 @@ if PHYLIB comment MII PHY device drivers +config AQUANTIA_PHY +tristate Drivers for the Aquantia PHYs +---help--- + Currently supports the Aquantia AQ1202, AQ2104, AQR105, AQR405 + config AT803X_PHY tristate Drivers for Atheros AT803X PHYs ---help--- diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 16aac1c..9bb1033 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -3,6 +3,7 @@ libphy-objs:= phy.o phy_device.o mdio_bus.o obj-$(CONFIG_PHYLIB) += libphy.o +obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o obj-$(CONFIG_MARVELL_PHY) += marvell.o obj-$(CONFIG_DAVICOM_PHY) += davicom.o obj-$(CONFIG_CICADA_PHY) += cicada.o diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c new file mode 100644 index 000..cb848f95 --- /dev/null +++ b/drivers/net/phy/aquantia.c @@ -0,0 +1,157 @@ +/* + * Driver for Aquantia PHY + * + * Author: Shaohui Xie shaohui@freescale.com + * + * Copyright 2015 Freescale Semiconductor, Inc. + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed as is without any warranty of any + * kind, whether express or implied. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/delay.h +#include linux/mii.h +#include linux/ethtool.h +#include linux/phy.h +#include linux/mdio.h + +#define PHY_ID_AQ1202 0x03a1b445 +#define PHY_ID_AQ2104 0x03a1b460 +#define PHY_ID_AQR105 0x03a1b4a2 +#define PHY_ID_AQR405 0x03a1b4b0 + +static int aquantia_soft_reset(struct phy_device *phydev) +{ + return 0; +} + +static int aquantia_config_init(struct phy_device *phydev) +{ + return 0; +} + +static int aquantia_config_aneg(struct phy_device *phydev) +{ + phydev-supported = SUPPORTED_1baseT_Full | PHY_GBIT_FEATURES; + phydev-advertising = phydev-supported; + + return 0; +} + +static int aquantia_aneg_done(struct phy_device *phydev) +{ + int reg; + + reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); + return (reg 0) ? reg : (reg BMSR_ANEGCOMPLETE); +} + +static int aquantia_read_status(struct phy_device *phydev) +{ + int reg; + + phydev-speed = SPEED_1; + phydev-duplex = DUPLEX_FULL; + + reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); + reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); + if (reg MDIO_STAT1_LSTATUS) + phydev-link = 1; + else + phydev-link = 0; + + reg = phy_read_mmd(phydev, MDIO_MMD_AN, 0xc800); + mdelay(10); + reg = phy_read_mmd(phydev, MDIO_MMD_AN, 0xc800); + if (reg == 0x9) + phydev-speed = SPEED_2500; + else if (reg == 0x5) + phydev-speed = SPEED_1000; + else if (reg == 0x3) + phydev-speed = SPEED_100; + + return 0; +} + +static struct phy_driver aquantia_driver[] = { +{ + .phy_id = PHY_ID_AQ1202, + .phy_id_mask= 0xfff0, + .name = Aquantia AQ1202, + .features = PHY_GBIT_FEATURES, + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner = THIS_MODULE,}, +}, +{ + .phy_id = PHY_ID_AQ2104, + .phy_id_mask= 0xfff0, + .name = Aquantia AQ2104, + .features = PHY_GBIT_FEATURES, + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner = THIS_MODULE,}, +}, +{ + .phy_id = PHY_ID_AQR105, + .phy_id_mask= 0xfff0, + .name = Aquantia AQR105, + .features = PHY_GBIT_FEATURES, + .soft_reset = aquantia_soft_reset, + .aneg_done = aquantia_aneg_done, + .config_init= aquantia_config_init, + .config_aneg= aquantia_config_aneg, + .read_status= aquantia_read_status, + .driver = { .owner =
Re: [RFC PATCH v2 net-next 3/3] tcp: add NV congestion control
Thank you all for your comments, I¹m currently testing the changes. Other comments inline. On 7/21/15, 11:50 PM, Yuchung Cheng ych...@google.com wrote: On Tue, Jul 21, 2015 at 9:21 PM, Lawrence Brakmo bra...@fb.com wrote: This is a request for comments. TCP-NV (New Vegas) is a major update to TCP-Vegas. An earlier version of NV was presented at 2010's LPC (slides). It is a delayed based congestion avoidance for the data center. This version has been tested within a 10G rack where the HW RTTs are 20-50us. A description of TCP-NV, including implementation and experimental results, can be found at: https://urldefense.proofpoint.com/v1/url?u=http://www.brakmo.org/networki ng/tcp-nv/TCPNV.htmlk=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0Ar=m30SgjN07T%2FK%2 FdV1ZIt1iA%3D%3D%0Am=XeELWxnafKynbNgkHg6RW%2F85hv1bPWlufUn2Dh4cOH4%3D%0A s=0029c47e62d84d6ffd22bd33e1895a3f61eaa21d88cbfb553aa1df780bbbdcf9 The current version includes many module parameters to support experimentation with the parameters. Signed-off-by: Lawrence Brakmo bra...@fb.com --- include/net/tcp.h | 1 + net/ipv4/Kconfig | 16 ++ net/ipv4/Makefile | 1 + net/ipv4/sysctl_net_ipv4.c | 9 + net/ipv4/tcp_input.c | 2 + net/ipv4/tcp_nv.c | 479 + 6 files changed, 508 insertions(+) create mode 100644 net/ipv4/tcp_nv.c diff --git a/include/net/tcp.h b/include/net/tcp.h index 2e62efe..c0690ae 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -281,6 +281,7 @@ extern unsigned int sysctl_tcp_notsent_lowat; extern int sysctl_tcp_min_tso_segs; extern int sysctl_tcp_autocorking; extern int sysctl_tcp_invalid_ratelimit; +extern int sysctl_tcp_nv_enable; extern atomic_long_t tcp_memory_allocated; extern struct percpu_counter tcp_sockets_allocated; diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 6fb3c90..c37b374 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig @@ -539,6 +539,22 @@ config TCP_CONG_VEGAS window. TCP Vegas should provide less packet loss, but it is not as aggressive as TCP Reno. +config TCP_CONG_NV + tristate TCP NV + default m + ---help--- + TCP NV is a follow up to TCP Vegas. It has been modified to deal with + 10G networks, measurement noise introduced by LRO, GRO and interrupt + coalescence. In addition, it will decrease its cwnd multiplicative multiplicatively + instead of linearly. + + Note that in general congestion avoidance (cwnd decreased when # packets + queued grows) cannot coexist with congestion control (cwnd decreased only + when there is packet loss) due to fairness issues. One scenario when the s/the/they + can coexist safely is when the CA flows have RTTs CC flows RTTs. + + For further details see https://urldefense.proofpoint.com/v1/url?u=http://www.brakmo.org/networki ng/tcp-nv/k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0Ar=m30SgjN07T%2FK%2FdV1ZIt1iA %3D%3D%0Am=XeELWxnafKynbNgkHg6RW%2F85hv1bPWlufUn2Dh4cOH4%3D%0As=3441162 a0eefcad01003dbf0ba478e00a2080f76cd460eaf12213eb74f2eedbd + config TCP_CONG_SCALABLE tristate Scalable TCP default n diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index efc43f3..06f335f 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_TCP_CONG_HSTCP) += tcp_highspeed.o obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybla.o obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o +obj-$(CONFIG_TCP_CONG_NV) += tcp_nv.o obj-$(CONFIG_TCP_CONG_VENO) += tcp_veno.o obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 433231c..31846d5 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -730,6 +730,15 @@ static struct ctl_table ipv4_table[] = { .proc_handler = proc_dointvec_ms_jiffies, }, { + .procname = tcp_nv_enable, + .data = sysctl_tcp_nv_enable, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = zero, + .extra2 = one, + }, + { .procname = icmp_msgs_per_sec, .data = sysctl_icmp_msgs_per_sec, .maxlen = sizeof(int), diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index aca4ae5..87560d9 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -101,6 +101,8 @@ int sysctl_tcp_thin_dupack __read_mostly; int sysctl_tcp_moderate_rcvbuf __read_mostly = 1; int sysctl_tcp_early_retrans __read_mostly = 3; int sysctl_tcp_invalid_ratelimit __read_mostly = HZ/2; +int sysctl_tcp_nv_enable __read_mostly = 1;
Re: [patch net-next 0/4] Introduce Mellanox Technologies Switch ASICs switchdev drivers
On Jul 23, 2015, at 5:03 PM, Scott Feldman sfel...@gmail.com wrote: On the CHECKs on space after cast, should we modify checkpatch.pl to not flag those for drivers/net? Please don't. My internal parser really wants to see the cast right up against whatever it is casting. Has this practice been changing and I haven't noticed? -- Mark Rustad, Networking Division, Intel Corporation signature.asc Description: Message signed with OpenPGP using GPGMail
[PATCH] net/ipv6: add sysctl option accept_ra_hop_limit
Commit 6fd99094de2b (ipv6: Don't reduce hop limit for an interface) disabled accept hop limit from RA if it is higher than the current hop limit for security stuff. But this behavior kind of break the RFC definition. RFC 4861, 6.3.4. Processing Received Router Advertisements If the received Cur Hop Limit value is non-zero, the host SHOULD set its CurHopLimit variable to the received value. So add sysctl option accept_ra_hop_limit to let user choose whether accept hop limit info in RA. Signed-off-by: Hangbin Liu liuhang...@gmail.com Acked-by: Hannes Frederic Sowa han...@stressinduktion.org --- Documentation/networking/ip-sysctl.txt | 11 +++ include/linux/ipv6.h | 1 + include/uapi/linux/ipv6.h | 1 + net/ipv6/addrconf.c| 10 ++ net/ipv6/ndisc.c | 17 +++-- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 5fae770..778c479 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -1346,6 +1346,17 @@ accept_ra_pinfo - BOOLEAN Functional default: enabled if accept_ra is enabled. disabled if accept_ra is disabled. +accept_ra_hop_limit - INTEGER + Learn hop limit in Router Advertisement. + + Possible values are: + 0 Do not accept hop limit in Router Advertisements. + 1 Accept hop limit in Router Advertisements if it is higher + than the current hop limit. + 2 Accept hop limit in Router Advertisements anyway. + + Default: 1 + accept_ra_rt_info_max_plen - INTEGER Maximum prefix length of Route Information in RA. diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 82806c6..a21a9c6 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -30,6 +30,7 @@ struct ipv6_devconf { __s32 max_addresses; __s32 accept_ra_defrtr; __s32 accept_ra_pinfo; + __s32 accept_ra_hop_limit; #ifdef CONFIG_IPV6_ROUTER_PREF __s32 accept_ra_rtr_pref; __s32 rtr_probe_interval; diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h index 5efa54a..9f40ac9 100644 --- a/include/uapi/linux/ipv6.h +++ b/include/uapi/linux/ipv6.h @@ -153,6 +153,7 @@ enum { DEVCONF_FORCE_MLD_VERSION, DEVCONF_ACCEPT_RA_DEFRTR, DEVCONF_ACCEPT_RA_PINFO, + DEVCONF_ACCEPT_RA_HOP_LIMIT, DEVCONF_ACCEPT_RA_RTR_PREF, DEVCONF_RTR_PROBE_INTERVAL, DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 21c2c81..486a7a5 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -196,6 +196,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = { .accept_ra_defrtr = 1, .accept_ra_from_local = 0, .accept_ra_pinfo= 1, + .accept_ra_hop_limit= 1, #ifdef CONFIG_IPV6_ROUTER_PREF .accept_ra_rtr_pref = 1, .rtr_probe_interval = 60 * HZ, @@ -237,6 +238,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = { .accept_ra_defrtr = 1, .accept_ra_from_local = 0, .accept_ra_pinfo= 1, + .accept_ra_hop_limit= 1, #ifdef CONFIG_IPV6_ROUTER_PREF .accept_ra_rtr_pref = 1, .rtr_probe_interval = 60 * HZ, @@ -4561,6 +4563,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, array[DEVCONF_MAX_ADDRESSES] = cnf-max_addresses; array[DEVCONF_ACCEPT_RA_DEFRTR] = cnf-accept_ra_defrtr; array[DEVCONF_ACCEPT_RA_PINFO] = cnf-accept_ra_pinfo; + array[DEVCONF_ACCEPT_RA_HOP_LIMIT] = cnf-accept_ra_hop_limit; #ifdef CONFIG_IPV6_ROUTER_PREF array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf-accept_ra_rtr_pref; array[DEVCONF_RTR_PROBE_INTERVAL] = @@ -5462,6 +5465,13 @@ static struct addrconf_sysctl_table .mode = 0644, .proc_handler = proc_dointvec, }, + { + .procname = accept_ra_hop_limit, + .data = ipv6_devconf.accept_ra_hop_limit, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, #ifdef CONFIG_IPV6_ROUTER_PREF { .procname = accept_ra_rtr_pref, diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 0a05b35..aca67da 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1226,13 +1226,18 @@ static void ndisc_router_discovery(struct sk_buff *skb) if (rt) rt6_set_expires(rt, jiffies + (HZ * lifetime)); if (ra_msg-icmph.icmp6_hop_limit) { -
Re: [PATCH] net/ipv6: add sysctl option accept_ra_hop_limit
Hi, Hangbin Liu wrote: Commit 6fd99094de2b (ipv6: Don't reduce hop limit for an interface) disabled accept hop limit from RA if it is higher than the current hop limit for security stuff. But this behavior kind of break the RFC definition. RFC 4861, 6.3.4. Processing Received Router Advertisements If the received Cur Hop Limit value is non-zero, the host SHOULD set its CurHopLimit variable to the received value. So add sysctl option accept_ra_hop_limit to let user choose whether accept hop limit info in RA. Signed-off-by: Hangbin Liu liuhang...@gmail.com Acked-by: Hannes Frederic Sowa han...@stressinduktion.org --- Documentation/networking/ip-sysctl.txt | 11 +++ include/linux/ipv6.h | 1 + include/uapi/linux/ipv6.h | 1 + net/ipv6/addrconf.c| 10 ++ net/ipv6/ndisc.c | 17 +++-- 5 files changed, 34 insertions(+), 6 deletions(-) : diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h index 5efa54a..9f40ac9 100644 --- a/include/uapi/linux/ipv6.h +++ b/include/uapi/linux/ipv6.h @@ -153,6 +153,7 @@ enum { DEVCONF_FORCE_MLD_VERSION, DEVCONF_ACCEPT_RA_DEFRTR, DEVCONF_ACCEPT_RA_PINFO, + DEVCONF_ACCEPT_RA_HOP_LIMIT, DEVCONF_ACCEPT_RA_RTR_PREF, DEVCONF_RTR_PROBE_INTERVAL, DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, No, you cannot add new one in the middle of these since values are exported to userspace. --yoshfuji -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 4/4] mlxsw: Introduce Mellanox SwitchX-2 ASIC support
Thu, Jul 23, 2015 at 07:19:46PM CEST, alexander.du...@gmail.com wrote: On 07/23/2015 08:43 AM, Jiri Pirko wrote: From: Jiri Pirko j...@mellanox.com Benefit from the previously introduced Mellanox Switch infrastructure and add driver for SwitchX-2 ASIC. Note that this driver is very simple now. It implements bare minimum for getting device to work on slow-path. Fast-path offload functionality is going to be added soon. Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- drivers/net/ethernet/mellanox/mlxsw/Kconfig| 11 + drivers/net/ethernet/mellanox/mlxsw/Makefile |2 + drivers/net/ethernet/mellanox/mlxsw/core.h |2 + drivers/net/ethernet/mellanox/mlxsw/pci.c |3 + drivers/net/ethernet/mellanox/mlxsw/pci.h |1 + drivers/net/ethernet/mellanox/mlxsw/port.h |4 + drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 1541 drivers/net/ethernet/mellanox/mlxsw/txheader.h | 80 ++ 8 files changed, 1644 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/switchx2.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/txheader.h snip diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c new file mode 100644 index 000..15dc53b --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c @@ -0,0 +1,1541 @@ +/* + * drivers/net/ethernet/mellanox/mlxsw/switchx2.c + * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015 Jiri Pirko j...@mellanox.com + * Copyright (c) 2015 Ido Schimmel ido...@mellanox.com + * Copyright (c) 2015 Elad Raz el...@mellanox.com + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + *contributors may be used to endorse or promote products derived from + *this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License (GPL) version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/types.h +#include linux/netdevice.h +#include linux/etherdevice.h +#include linux/slab.h +#include linux/device.h +#include linux/skbuff.h +#include linux/if_vlan.h +#include net/switchdev.h +#include generated/utsrelease.h + +#include core.h +#include reg.h +#include port.h +#include trap.h +#include txheader.h + +static const char mlxsw_sx_driver_name[] = mlxsw_switchx2; +static const char mlxsw_sx_driver_version[] = 1.0; + +struct mlxsw_sx_port; + +#define MLXSW_SW_HW_ID_LEN 6 + +struct mlxsw_sx { + struct mlxsw_sx_port **ports; + struct mlxsw_core *core; + const struct mlxsw_bus_info *bus_info; + u8 hw_id[MLXSW_SW_HW_ID_LEN]; +}; + +struct mlxsw_sx_port_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; + u32 tx_dropped; +}; + It seems like this is the second time I have seen someone have to invent a new pcpu stats to add tx_dropped. Maybe you should look at adding tx_dropped to pcpu_sw_netstats and just use that. I don't mind doing that. Multiple drivers use custom stat structures. We can easily change that into some common structure if needed. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at
[net-next PATCH v1 5/6] net: netcp: Fixes to CPSW statistics collection
In certain applications it's beneficial to allow the CPSW h/w stats counters to continue to increment even while the kernel polls them. This patch implements this behavior for both 1G and 10G ethernet subsystem modules. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 86 - 1 file changed, 75 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index b06f210..aa33066 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -642,6 +642,7 @@ struct gbe_priv { boolenable_ale; u8 max_num_slaves; u8 max_num_ports; /* max_num_slaves + 1 */ + u8 num_stats_mods; struct netcp_tx_pipetx_pipe; int host_port; @@ -671,6 +672,7 @@ struct gbe_priv { struct net_device *dummy_ndev; u64 *hw_stats; + u32 *hw_stats_prev; const struct netcp_ethtool_stat *et_stats; int num_et_stats; /* Lock for updating the hwstats */ @@ -1550,25 +1552,37 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset) } } +static void gbe_reset_mod_stats(struct gbe_priv *gbe_dev, int stats_mod) +{ + void __iomem *base = gbe_dev-hw_stats_regs[stats_mod]; + u32 __iomem *p_stats_entry; + int i; + + for (i = 0; i gbe_dev-num_et_stats; i++) { + if (gbe_dev-et_stats[i].type == stats_mod) { + p_stats_entry = base + gbe_dev-et_stats[i].offset; + gbe_dev-hw_stats[i] = 0; + gbe_dev-hw_stats_prev[i] = readl(p_stats_entry); + } + } +} + static inline void gbe_update_hw_stats_entry(struct gbe_priv *gbe_dev, int et_stats_entry) { void __iomem *base = NULL; - u32 __iomem *p; - u32 tmp = 0; + u32 __iomem *p_stats_entry; + u32 curr, delta; /* The hw_stats_regs pointers are already * properly set to point to the right base: */ base = gbe_dev-hw_stats_regs[gbe_dev-et_stats[et_stats_entry].type]; - p = base + gbe_dev-et_stats[et_stats_entry].offset; - tmp = readl(p); - gbe_dev-hw_stats[et_stats_entry] += tmp; - - /* write-to-decrement: -* new register value = old register value - write value -*/ - writel(tmp, p); + p_stats_entry = base + gbe_dev-et_stats[et_stats_entry].offset; + curr = readl(p_stats_entry); + delta = curr - gbe_dev-hw_stats_prev[et_stats_entry]; + gbe_dev-hw_stats_prev[et_stats_entry] = curr; + gbe_dev-hw_stats[et_stats_entry] += delta; } static void gbe_update_stats(struct gbe_priv *gbe_dev, uint64_t *data) @@ -1607,6 +1621,12 @@ static inline void gbe_stats_mod_visible_ver14(struct gbe_priv *gbe_dev, writel(val, GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); } +static void gbe_reset_mod_stats_ver14(struct gbe_priv *gbe_dev, int stats_mod) +{ + gbe_stats_mod_visible_ver14(gbe_dev, stats_mod); + gbe_reset_mod_stats(gbe_dev, stats_mod); +} + static void gbe_update_stats_ver14(struct gbe_priv *gbe_dev, uint64_t *data) { u32 half_num_et_stats = (gbe_dev-num_et_stats / 2); @@ -2560,6 +2580,7 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, } gbe_dev-xgbe_serdes_regs = regs; + gbe_dev-num_stats_mods = gbe_dev-max_num_ports; gbe_dev-et_stats = xgbe10_et_stats; gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); @@ -2571,6 +2592,16 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, return -ENOMEM; } + gbe_dev-hw_stats_prev = + devm_kzalloc(gbe_dev-dev, +gbe_dev-num_et_stats * sizeof(u32), +GFP_KERNEL); + if (!gbe_dev-hw_stats_prev) { + dev_err(gbe_dev-dev, + hw_stats_prev memory allocation failed\n); + return -ENOMEM; + } + gbe_dev-ss_version = XGBE_SS_VERSION_10; gbe_dev-sgmii_port_regs = gbe_dev-ss_regs + XGBE10_SGMII_MODULE_OFFSET; @@ -2668,6 +2699,7 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, } gbe_dev-switch_regs = regs; + gbe_dev-num_stats_mods = gbe_dev-max_num_slaves; gbe_dev-et_stats = gbe13_et_stats; gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); @@ -2679,6 +2711,16 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, return -ENOMEM; } +
[net-next PATCH v1 4/6] net: netcp: Consolidates statistics collection code
Different Keystone2 platforms have different number and layouts of hw statistics modules. This patch consolidates the statistics processing of different Keystone2 platforms for easy maintenance. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 99 ++--- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 3976516..b06f210 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -1550,70 +1550,79 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset) } } -static void gbe_update_stats(struct gbe_priv *gbe_dev, uint64_t *data) +static inline void gbe_update_hw_stats_entry(struct gbe_priv *gbe_dev, +int et_stats_entry) { void __iomem *base = NULL; u32 __iomem *p; u32 tmp = 0; + + /* The hw_stats_regs pointers are already +* properly set to point to the right base: +*/ + base = gbe_dev-hw_stats_regs[gbe_dev-et_stats[et_stats_entry].type]; + p = base + gbe_dev-et_stats[et_stats_entry].offset; + tmp = readl(p); + gbe_dev-hw_stats[et_stats_entry] += tmp; + + /* write-to-decrement: +* new register value = old register value - write value +*/ + writel(tmp, p); +} + +static void gbe_update_stats(struct gbe_priv *gbe_dev, uint64_t *data) +{ int i; for (i = 0; i gbe_dev-num_et_stats; i++) { - base = gbe_dev-hw_stats_regs[gbe_dev-et_stats[i].type]; - p = base + gbe_dev-et_stats[i].offset; - tmp = readl(p); - gbe_dev-hw_stats[i] = gbe_dev-hw_stats[i] + tmp; + gbe_update_hw_stats_entry(gbe_dev, i); + if (data) data[i] = gbe_dev-hw_stats[i]; - /* write-to-decrement: -* new register value = old register value - write value -*/ - writel(tmp, p); } } -static void gbe_update_stats_ver14(struct gbe_priv *gbe_dev, uint64_t *data) +static inline void gbe_stats_mod_visible_ver14(struct gbe_priv *gbe_dev, + int stats_mod) { - void __iomem *gbe_statsa = gbe_dev-hw_stats_regs[0]; - void __iomem *gbe_statsb = gbe_dev-hw_stats_regs[1]; - u64 *hw_stats = gbe_dev-hw_stats[0]; - void __iomem *base = NULL; - u32 __iomem *p; - u32 tmp = 0, val, pair_size = (gbe_dev-num_et_stats / 2); - int i, j, pair; + u32 val; - for (pair = 0; pair 2; pair++) { - val = readl(GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); + val = readl(GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); - if (pair == 0) - val = ~GBE_STATS_CD_SEL; - else - val |= GBE_STATS_CD_SEL; + switch (stats_mod) { + case GBE_STATSA_MODULE: + case GBE_STATSB_MODULE: + val = ~GBE_STATS_CD_SEL; + break; + case GBE_STATSC_MODULE: + case GBE_STATSD_MODULE: + val |= GBE_STATS_CD_SEL; + break; + default: + return; + } + + /* make the stat module visible */ + writel(val, GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); +} - /* make the stat modules visible */ - writel(val, GBE_REG_ADDR(gbe_dev, switch_regs, stat_port_en)); +static void gbe_update_stats_ver14(struct gbe_priv *gbe_dev, uint64_t *data) +{ + u32 half_num_et_stats = (gbe_dev-num_et_stats / 2); + int et_entry, j, pair; - for (i = 0; i pair_size; i++) { - j = pair * pair_size + i; - switch (gbe_dev-et_stats[j].type) { - case GBE_STATSA_MODULE: - case GBE_STATSC_MODULE: - base = gbe_statsa; - break; - case GBE_STATSB_MODULE: - case GBE_STATSD_MODULE: - base = gbe_statsb; - break; - } + for (pair = 0; pair 2; pair++) { + gbe_stats_mod_visible_ver14(gbe_dev, (pair ? + GBE_STATSC_MODULE : + GBE_STATSA_MODULE)); + + for (j = 0; j half_num_et_stats; j++) { + et_entry = pair * half_num_et_stats + j; + gbe_update_hw_stats_entry(gbe_dev, et_entry); - p = base + gbe_dev-et_stats[j].offset; - tmp = readl(p); - hw_stats[j] += tmp; if (data) -
[net-next PATCH v1 3/6] net: netcp: Fixes error in oversized memory allocation for statistics storage
The CPSW driver keeps internally some, but not all, of the statistics available in the hw statistics modules. Furthermore, some of the locations in the hw statistics modules are reserved and contain no useful information. Prior to this patch, the driver allocates memory of the size of the the whole hw statistics modules, instead of the size of statistics-entries-interested-in (i.e. et_stats), for internal storage. This patch fixes that. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 46 +++-- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index b954856..3976516 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -295,8 +295,6 @@ struct xgbe_hw_stats { u32 rx_dma_overruns; }; -#define XGBE10_NUM_STAT_ENTRIES (sizeof(struct xgbe_hw_stats)/sizeof(u32)) - struct gbenu_ss_regs { u32 id_ver; u32 synce_count;/* NU */ @@ -480,7 +478,6 @@ struct gbenu_hw_stats { u32 tx_pri7_drop_bcnt; }; -#define GBENU_NUM_HW_STAT_ENTRIES (sizeof(struct gbenu_hw_stats) / sizeof(u32)) #define GBENU_HW_STATS_REG_MAP_SZ 0x200 struct gbe_ss_regs { @@ -615,7 +612,6 @@ struct gbe_hw_stats { u32 rx_dma_overruns; }; -#define GBE13_NUM_HW_STAT_ENTRIES (sizeof(struct gbe_hw_stats)/sizeof(u32)) #define GBE_MAX_HW_STAT_MODS 9 #define GBE_HW_STATS_REG_MAP_SZ0x100 @@ -2555,10 +2551,12 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, } gbe_dev-xgbe_serdes_regs = regs; + gbe_dev-et_stats = xgbe10_et_stats; + gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - XGBE10_NUM_STAT_ENTRIES * - (gbe_dev-max_num_ports) * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2577,8 +2575,6 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = XGBE10_HOST_PORT_NUM; gbe_dev-ale_entries = XGBE10_NUM_ALE_ENTRIES; - gbe_dev-et_stats = xgbe10_et_stats; - gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); gbe_dev-stats_en_mask = (1 (gbe_dev-max_num_ports)) - 1; /* Subsystem registers */ @@ -2663,10 +2659,12 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, } gbe_dev-switch_regs = regs; + gbe_dev-et_stats = gbe13_et_stats; + gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - GBE13_NUM_HW_STAT_ENTRIES * - gbe_dev-max_num_slaves * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2689,8 +2687,6 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = GBE13_HOST_PORT_NUM; gbe_dev-ale_entries = GBE13_NUM_ALE_ENTRIES; - gbe_dev-et_stats = gbe13_et_stats; - gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); gbe_dev-stats_en_mask = GBE13_REG_VAL_STAT_ENABLE_ALL; /* Subsystem registers */ @@ -2717,10 +2713,18 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, void __iomem *regs; int i, ret; + gbe_dev-et_stats = gbenu_et_stats; + + if (IS_SS_ID_NU(gbe_dev)) + gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + + (gbe_dev-max_num_slaves * GBENU_ET_STATS_PORT_SIZE); + else + gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + + GBENU_ET_STATS_PORT_SIZE; + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - GBENU_NUM_HW_STAT_ENTRIES * - (gbe_dev-max_num_ports) * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@
[net-next PATCH v1 1/6] net: netcp: Fixes the use of spin_lock_bh in timer function
This patch fixes a bug in which the timer routine synchronized against the ethtool-triggered statistics updates with spin_lock_bh(). A timer function is itself a bottom-half, so this should be spin_lock(). Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 9b7e0a3..cabf977 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -2189,14 +2189,15 @@ static void netcp_ethss_timer(unsigned long arg) netcp_ethss_update_link_state(gbe_dev, slave, NULL); } - spin_lock_bh(gbe_dev-hw_stats_lock); + /* A timer runs as a BH, no need to block them */ + spin_lock(gbe_dev-hw_stats_lock); if (gbe_dev-ss_version == GBE_SS_VERSION_14) gbe_update_stats_ver14(gbe_dev, NULL); else gbe_update_stats(gbe_dev, NULL); - spin_unlock_bh(gbe_dev-hw_stats_lock); + spin_unlock(gbe_dev-hw_stats_lock); gbe_dev-timer.expires = jiffies + GBE_TIMER_INTERVAL; add_timer(gbe_dev-timer); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next PATCH v1 2/6] net: netcp: Fixes hw statistics module base setting error
This patch fixes error in the setting of the hw statistics module base for K2HK platform. In K2HK although there are 4 hw statistics modules, but only 2 are visible at a time. Thus when setting up the pointers to the base of the corresponding hw statistics modules, modules 0 and 2 should point to one base, while modules 1 and 3 should point to the other. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index cabf977..b954856 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -2675,10 +2675,14 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev-sgmii_port_regs = gbe_dev-ss_regs + GBE13_SGMII_MODULE_OFFSET; gbe_dev-host_port_regs = gbe_dev-switch_regs + GBE13_HOST_PORT_OFFSET; + /* K2HK has only 2 hw stats modules visible at a time, so +* module 0 2 points to one base and +* module 1 3 points to the other base +*/ for (i = 0; i gbe_dev-max_num_slaves; i++) { gbe_dev-hw_stats_regs[i] = gbe_dev-switch_regs + GBE13_HW_STATS_OFFSET + - (GBE_HW_STATS_REG_MAP_SZ * i); + (GBE_HW_STATS_REG_MAP_SZ * (i 0x1)); } gbe_dev-ale_reg = gbe_dev-switch_regs + GBE13_ALE_OFFSET; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next PATCH v1 6/6] net: netcp: Adds missing statistics for K2L and K2E
This patch adds the missing statistics for the host and slave ports of the CPSW on K2L and K2E platforms. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 177 - 1 file changed, 174 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index aa33066..01a955c 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -872,7 +872,7 @@ static const struct netcp_ethtool_stat gbe13_et_stats[] = { }; /* This is the size of entries in GBENU_STATS_HOST */ -#define GBENU_ET_STATS_HOST_SIZE 33 +#define GBENU_ET_STATS_HOST_SIZE 52 #define GBENU_STATS_HOST(field)\ { \ @@ -881,8 +881,8 @@ static const struct netcp_ethtool_stat gbe13_et_stats[] = { offsetof(struct gbenu_hw_stats, field) \ } -/* This is the size of entries in GBENU_STATS_HOST */ -#define GBENU_ET_STATS_PORT_SIZE 46 +/* This is the size of entries in GBENU_STATS_PORT */ +#define GBENU_ET_STATS_PORT_SIZE 65 #define GBENU_STATS_P1(field) \ { \ @@ -974,7 +974,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_HOST(ale_unknown_mcast_bytes), GBENU_STATS_HOST(ale_unknown_bcast), GBENU_STATS_HOST(ale_unknown_bcast_bytes), + GBENU_STATS_HOST(ale_pol_match), + GBENU_STATS_HOST(ale_pol_match_red), + GBENU_STATS_HOST(ale_pol_match_yellow), GBENU_STATS_HOST(tx_mem_protect_err), + GBENU_STATS_HOST(tx_pri0_drop), + GBENU_STATS_HOST(tx_pri1_drop), + GBENU_STATS_HOST(tx_pri2_drop), + GBENU_STATS_HOST(tx_pri3_drop), + GBENU_STATS_HOST(tx_pri4_drop), + GBENU_STATS_HOST(tx_pri5_drop), + GBENU_STATS_HOST(tx_pri6_drop), + GBENU_STATS_HOST(tx_pri7_drop), + GBENU_STATS_HOST(tx_pri0_drop_bcnt), + GBENU_STATS_HOST(tx_pri1_drop_bcnt), + GBENU_STATS_HOST(tx_pri2_drop_bcnt), + GBENU_STATS_HOST(tx_pri3_drop_bcnt), + GBENU_STATS_HOST(tx_pri4_drop_bcnt), + GBENU_STATS_HOST(tx_pri5_drop_bcnt), + GBENU_STATS_HOST(tx_pri6_drop_bcnt), + GBENU_STATS_HOST(tx_pri7_drop_bcnt), /* GBENU Module 1 */ GBENU_STATS_P1(rx_good_frames), GBENU_STATS_P1(rx_broadcast_frames), @@ -1021,7 +1040,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_P1(ale_unknown_mcast_bytes), GBENU_STATS_P1(ale_unknown_bcast), GBENU_STATS_P1(ale_unknown_bcast_bytes), + GBENU_STATS_P1(ale_pol_match), + GBENU_STATS_P1(ale_pol_match_red), + GBENU_STATS_P1(ale_pol_match_yellow), GBENU_STATS_P1(tx_mem_protect_err), + GBENU_STATS_P1(tx_pri0_drop), + GBENU_STATS_P1(tx_pri1_drop), + GBENU_STATS_P1(tx_pri2_drop), + GBENU_STATS_P1(tx_pri3_drop), + GBENU_STATS_P1(tx_pri4_drop), + GBENU_STATS_P1(tx_pri5_drop), + GBENU_STATS_P1(tx_pri6_drop), + GBENU_STATS_P1(tx_pri7_drop), + GBENU_STATS_P1(tx_pri0_drop_bcnt), + GBENU_STATS_P1(tx_pri1_drop_bcnt), + GBENU_STATS_P1(tx_pri2_drop_bcnt), + GBENU_STATS_P1(tx_pri3_drop_bcnt), + GBENU_STATS_P1(tx_pri4_drop_bcnt), + GBENU_STATS_P1(tx_pri5_drop_bcnt), + GBENU_STATS_P1(tx_pri6_drop_bcnt), + GBENU_STATS_P1(tx_pri7_drop_bcnt), /* GBENU Module 2 */ GBENU_STATS_P2(rx_good_frames), GBENU_STATS_P2(rx_broadcast_frames), @@ -1068,7 +1106,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_P2(ale_unknown_mcast_bytes), GBENU_STATS_P2(ale_unknown_bcast), GBENU_STATS_P2(ale_unknown_bcast_bytes), + GBENU_STATS_P2(ale_pol_match), + GBENU_STATS_P2(ale_pol_match_red), + GBENU_STATS_P2(ale_pol_match_yellow), GBENU_STATS_P2(tx_mem_protect_err), + GBENU_STATS_P2(tx_pri0_drop), + GBENU_STATS_P2(tx_pri1_drop), + GBENU_STATS_P2(tx_pri2_drop), + GBENU_STATS_P2(tx_pri3_drop), + GBENU_STATS_P2(tx_pri4_drop), + GBENU_STATS_P2(tx_pri5_drop), + GBENU_STATS_P2(tx_pri6_drop), + GBENU_STATS_P2(tx_pri7_drop), + GBENU_STATS_P2(tx_pri0_drop_bcnt), + GBENU_STATS_P2(tx_pri1_drop_bcnt), + GBENU_STATS_P2(tx_pri2_drop_bcnt), + GBENU_STATS_P2(tx_pri3_drop_bcnt), + GBENU_STATS_P2(tx_pri4_drop_bcnt), + GBENU_STATS_P2(tx_pri5_drop_bcnt), + GBENU_STATS_P2(tx_pri6_drop_bcnt), + GBENU_STATS_P2(tx_pri7_drop_bcnt), /* GBENU Module 3 */ GBENU_STATS_P3(rx_good_frames), GBENU_STATS_P3(rx_broadcast_frames), @@ -1115,7 +1172,26 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = { GBENU_STATS_P3(ale_unknown_mcast_bytes),
[net-next PATCH v1 0/6] net: netcp: Bug fixes of CPSW statistics collection
This patch set contains bug fixes and enhencements of hw ethernet statistics processing on TI's Keystone2 CPSW ethernet switches. v1: Removes unused defines in PATCH 3/6 based on reviewer's comment WingMan Kwok (6): net: netcp: Fixes the use of spin_lock_bh in timer function net: netcp: Fixes hw statistics module base setting error net: netcp: Fixes error in oversized memory allocation for statistics storage net: netcp: Consolidates statistics collection code net: netcp: Fixes to CPSW statistics collection net: netcp: Adds missing statistics for K2L and K2E drivers/net/ethernet/ti/netcp_ethss.c | 403 ++--- 1 file changed, 324 insertions(+), 79 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next 4/6] net/mlx5e: TX latency optimization to save DMA reads
From: Achiad Shochat ach...@mellanox.com A regular TX WQE execution involves two or more DMA reads - one to fetch the WQE, and another one per WQE gather entry. These DMA reads obviously increase the TX latency. There are two mlx5 mechanisms to bypass these DMA reads: 1) Inline WQE 2) Blue Flame (BF) An inline WQE contains a whole packet, thus saves the DMA read/s of the regular WQE gather entry/s. Inline WQE support was already added in the previous commit. A BF WQE is written directly to the device I/O mapped memory, thus enables saving the DMA read that fetches the WQE. The BF WQE I/O write must be in cache line granularity, thus uses the CPU write combining mechanism. A BF WQE I/O write acts also as a TX doorbell for notifying the device of new TX WQEs. A BF WQE is written to the same I/O mapped address as the regular TX doorbell, thus this address is being mapped twice - once by ioremap() and once by io_mapping_map_wc(). While both mechanisms reduce the TX latency, they both consume more CPU cycles than a regular WQE: - A BF WQE must still be written to host memory, in addition to being written directly to the device I/O mapped memory. - An inline WQE involves copying the SKB data into it. To handle this tradeoff, we introduce here a heuristic algorithm that strives to avoid using these two mechanisms in case the TX queue is being back-pressured by the device, and limit their usage rate otherwise. An inline WQE will always be Blue Flamed (written directly to the device I/O mapped memory) while a BF WQE may not be inlined (may contain gather entries). Preliminary testing using netperf UDP_RR shows that the latency goes down from 17.5us to 16.9us, while the message rate (tested with pktgen) stays the same. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Amir Vadai am...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 24 +++-- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 ++- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 26 ++- drivers/net/ethernet/mellanox/mlx5/core/main.c| 26 +-- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 6 ++ include/linux/mlx5/driver.h | 4 +++- 6 files changed, 79 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index d9dc506..b66edd2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -60,6 +60,7 @@ #define MLX5E_TX_CQ_POLL_BUDGET128 #define MLX5E_UPDATE_STATS_INTERVAL200 /* msecs */ +#define MLX5E_SQ_BF_BUDGET 16 static const char vport_strings[][ETH_GSTRING_LEN] = { /* vport statistics */ @@ -268,7 +269,9 @@ struct mlx5e_sq { /* dirtied @xmit */ u16pc cacheline_aligned_in_smp; u32dma_fifo_pc; - u32bf_offset; + u16bf_offset; + u16prev_cc; + u8 bf_budget; struct mlx5e_sq_stats stats; struct mlx5e_cqcq; @@ -281,9 +284,10 @@ struct mlx5e_sq { struct mlx5_wq_cyc wq; u32dma_fifo_mask; void __iomem *uar_map; + void __iomem *uar_bf_map; struct netdev_queue *txq; u32sqn; - u32bf_buf_size; + u16bf_buf_size; u16max_inline; u16edge; struct device *pdev; @@ -493,8 +497,10 @@ int mlx5e_update_priv_params(struct mlx5e_priv *priv, struct mlx5e_params *new_params); static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, - struct mlx5e_tx_wqe *wqe) + struct mlx5e_tx_wqe *wqe, int bf_sz) { + u16 ofst = MLX5_BF_OFFSET + sq-bf_offset; + /* ensure wqe is visible to device before updating doorbell record */ dma_wmb(); @@ -505,9 +511,15 @@ static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, */ wmb(); - mlx5_write64((__be32 *)wqe-ctrl, -sq-uar_map + MLX5_BF_OFFSET + sq-bf_offset, -NULL); + if (bf_sz) { + __iowrite64_copy(sq-uar_bf_map + ofst, wqe-ctrl, bf_sz); + + /* flush the write-combining mapped buffer */ + wmb(); + + } else { + mlx5_write64((__be32 *)wqe-ctrl, sq-uar_map + ofst, NULL); + } sq-bf_offset ^= sq-bf_buf_size; } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index c55fad4..4a87e9d
[PATCH net-next 3/6] net/mlx5e: Support TX packet copy into WQE
From: Achiad Shochat ach...@mellanox.com AKA inline WQE. A TX latency optimization to save data gather DMA reads. Controlled by ETHTOOL_TX_COPYBREAK. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Amir Vadai am...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 + .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 53 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 13 ++ drivers/net/ethernet/mellanox/mlx5/core/en_tx.c| 10 +++- 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 61d8433..d9dc506 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -196,6 +196,7 @@ struct mlx5e_params { bool lro_en; u32 lro_wqe_sz; u8 rss_hfunc; + u16 tx_max_inline; }; enum { @@ -520,3 +521,4 @@ static inline void mlx5e_cq_arm(struct mlx5e_cq *cq) } extern const struct ethtool_ops mlx5e_ethtool_ops; +u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index cb28535..14fd82c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -699,6 +699,57 @@ static int mlx5e_set_rxfh(struct net_device *netdev, const u32 *indir, return err; } +static int mlx5e_get_tunable(struct net_device *dev, +const struct ethtool_tunable *tuna, +void *data) +{ + const struct mlx5e_priv *priv = netdev_priv(dev); + int err = 0; + + switch (tuna-id) { + case ETHTOOL_TX_COPYBREAK: + *(u32 *)data = priv-params.tx_max_inline; + break; + default: + err = -EINVAL; + break; + } + + return err; +} + +static int mlx5e_set_tunable(struct net_device *dev, +const struct ethtool_tunable *tuna, +const void *data) +{ + struct mlx5e_priv *priv = netdev_priv(dev); + struct mlx5_core_dev *mdev = priv-mdev; + struct mlx5e_params new_params; + u32 val; + int err = 0; + + switch (tuna-id) { + case ETHTOOL_TX_COPYBREAK: + val = *(u32 *)data; + if (val mlx5e_get_max_inline_cap(mdev)) { + err = -EINVAL; + break; + } + + mutex_lock(priv-state_lock); + new_params = priv-params; + new_params.tx_max_inline = val; + err = mlx5e_update_priv_params(priv, new_params); + mutex_unlock(priv-state_lock); + break; + default: + err = -EINVAL; + break; + } + + return err; +} + const struct ethtool_ops mlx5e_ethtool_ops = { .get_drvinfo = mlx5e_get_drvinfo, .get_link = ethtool_op_get_link, @@ -715,4 +766,6 @@ const struct ethtool_ops mlx5e_ethtool_ops = { .set_settings = mlx5e_set_settings, .get_rxfh = mlx5e_get_rxfh, .set_rxfh = mlx5e_set_rxfh, + .get_tunable = mlx5e_get_tunable, + .set_tunable = mlx5e_set_tunable, }; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 57cc896..c55fad4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -41,6 +41,7 @@ struct mlx5e_rq_param { struct mlx5e_sq_param { u32sqc[MLX5_ST_SZ_DW(sqc)]; struct mlx5_wq_param wq; + u16max_inline; }; struct mlx5e_cq_param { @@ -514,6 +515,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c, sq-wq.db = sq-wq.db[MLX5_SND_DBR]; sq-uar_map = sq-uar.map; sq-bf_buf_size = (1 MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; + sq-max_inline = param-max_inline; err = mlx5e_alloc_sq_db(sq, cpu_to_node(c-cpu)); if (err) @@ -1020,6 +1022,7 @@ static void mlx5e_build_sq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, pd,priv-pdn); param-wq.buf_numa_node = dev_to_node(priv-mdev-pdev-dev); + param-max_inline = priv-params.tx_max_inline; } static void mlx5e_build_common_cq_param(struct mlx5e_priv *priv, @@ -1703,6 +1706,15 @@ static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) return 0; } +u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) +{ + int bf_buf_size = (1 MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; + + return bf_buf_size - + sizeof(struct mlx5e_tx_wqe) + + 2
[PATCH net-next 5/6] net/mlx5e: Cosmetics: use BIT() instead of 1 , and others
From: Achiad Shochat ach...@mellanox.com No logical change in this commit. Signed-off-by: Achiad Shochat ach...@mellanox.com Signed-off-by: Amir Vadai am...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 16 +- .../ethernet/mellanox/mlx5/core/en_flow_table.c| 166 +++-- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 20 +-- 3 files changed, 104 insertions(+), 98 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index b66edd2..39294f2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -330,14 +330,14 @@ struct mlx5e_channel { }; enum mlx5e_traffic_types { - MLX5E_TT_IPV4_TCP = 0, - MLX5E_TT_IPV6_TCP = 1, - MLX5E_TT_IPV4_UDP = 2, - MLX5E_TT_IPV6_UDP = 3, - MLX5E_TT_IPV4 = 4, - MLX5E_TT_IPV6 = 5, - MLX5E_TT_ANY = 6, - MLX5E_NUM_TT = 7, + MLX5E_TT_IPV4_TCP, + MLX5E_TT_IPV6_TCP, + MLX5E_TT_IPV4_UDP, + MLX5E_TT_IPV6_UDP, + MLX5E_TT_IPV4, + MLX5E_TT_IPV6, + MLX5E_TT_ANY, + MLX5E_NUM_TT, }; enum { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c index 120db80..cca34f6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c @@ -105,25 +105,25 @@ static void mlx5e_del_eth_addr_from_flow_table(struct mlx5e_priv *priv, { void *ft = priv-ft.main; - if (ai-tt_vec (1 MLX5E_TT_IPV6_TCP)) + if (ai-tt_vec BIT(MLX5E_TT_IPV6_TCP)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV6_TCP]); - if (ai-tt_vec (1 MLX5E_TT_IPV4_TCP)) + if (ai-tt_vec BIT(MLX5E_TT_IPV4_TCP)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV4_TCP]); - if (ai-tt_vec (1 MLX5E_TT_IPV6_UDP)) + if (ai-tt_vec BIT(MLX5E_TT_IPV6_UDP)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV6_UDP]); - if (ai-tt_vec (1 MLX5E_TT_IPV4_UDP)) + if (ai-tt_vec BIT(MLX5E_TT_IPV4_UDP)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV4_UDP]); - if (ai-tt_vec (1 MLX5E_TT_IPV6)) + if (ai-tt_vec BIT(MLX5E_TT_IPV6)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV6]); - if (ai-tt_vec (1 MLX5E_TT_IPV4)) + if (ai-tt_vec BIT(MLX5E_TT_IPV4)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_IPV4]); - if (ai-tt_vec (1 MLX5E_TT_ANY)) + if (ai-tt_vec BIT(MLX5E_TT_ANY)) mlx5_del_flow_table_entry(ft, ai-ft_ix[MLX5E_TT_ANY]); } @@ -156,33 +156,33 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type) switch (eth_addr_type) { case MLX5E_UC: ret = - (1 MLX5E_TT_IPV4_TCP) | - (1 MLX5E_TT_IPV6_TCP) | - (1 MLX5E_TT_IPV4_UDP) | - (1 MLX5E_TT_IPV6_UDP) | - (1 MLX5E_TT_IPV4) | - (1 MLX5E_TT_IPV6) | - (1 MLX5E_TT_ANY) | + BIT(MLX5E_TT_IPV4_TCP) | + BIT(MLX5E_TT_IPV6_TCP) | + BIT(MLX5E_TT_IPV4_UDP) | + BIT(MLX5E_TT_IPV6_UDP) | + BIT(MLX5E_TT_IPV4) | + BIT(MLX5E_TT_IPV6) | + BIT(MLX5E_TT_ANY)| 0; break; case MLX5E_MC_IPV4: ret = - (1 MLX5E_TT_IPV4_UDP) | - (1 MLX5E_TT_IPV4) | + BIT(MLX5E_TT_IPV4_UDP) | + BIT(MLX5E_TT_IPV4) | 0; break; case MLX5E_MC_IPV6: ret = - (1 MLX5E_TT_IPV6_UDP) | - (1 MLX5E_TT_IPV6) | + BIT(MLX5E_TT_IPV6_UDP) | + BIT(MLX5E_TT_IPV6) | 0; break; case MLX5E_MC_OTHER: ret = - (1 MLX5E_TT_ANY) | + BIT(MLX5E_TT_ANY)| 0; break; } @@ -191,23 +191,23 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai,
[PATCH net-next 1/6] net/mlx5e: Support ETH_RSS_HASH_XOR
From: Saeed Mahameed sae...@mellanox.com The ConnectX-4 HW implements inverted XOR8. To make it act as XOR we re-order the HW RSS indirection table. Set XOR to be the default RSS hash function and add ethtool API to control it. Signed-off-by: Saeed Mahameed sae...@mellanox.com Signed-off-by: Amir Vadai am...@mellanox.com --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 39 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 46 +- include/linux/mlx5/mlx5_ifc.h | 6 +-- 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 3d23bd6..61d8433 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -195,6 +195,7 @@ struct mlx5e_params { u16 rx_hash_log_tbl_sz; bool lro_en; u32 lro_wqe_sz; + u8 rss_hfunc; }; enum { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 3889384..cb28535 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -662,6 +662,43 @@ out: return err; } +static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 *hfunc) +{ + struct mlx5e_priv *priv = netdev_priv(netdev); + + if (hfunc) + *hfunc = priv-params.rss_hfunc; + + return 0; +} + +static int mlx5e_set_rxfh(struct net_device *netdev, const u32 *indir, + const u8 *key, const u8 hfunc) +{ + struct mlx5e_priv *priv = netdev_priv(netdev); + int err = 0; + + if (hfunc == ETH_RSS_HASH_NO_CHANGE) + return 0; + + if ((hfunc != ETH_RSS_HASH_XOR) + (hfunc != ETH_RSS_HASH_TOP)) + return -EINVAL; + + mutex_lock(priv-state_lock); + + priv-params.rss_hfunc = hfunc; + if (test_bit(MLX5E_STATE_OPENED, priv-state)) { + mlx5e_close_locked(priv-netdev); + err = mlx5e_open_locked(priv-netdev); + } + + mutex_unlock(priv-state_lock); + + return err; +} + const struct ethtool_ops mlx5e_ethtool_ops = { .get_drvinfo = mlx5e_get_drvinfo, .get_link = ethtool_op_get_link, @@ -676,4 +713,6 @@ const struct ethtool_ops mlx5e_ethtool_ops = { .set_coalesce = mlx5e_set_coalesce, .get_settings = mlx5e_get_settings, .set_settings = mlx5e_set_settings, + .get_rxfh = mlx5e_get_rxfh, + .set_rxfh = mlx5e_set_rxfh, }; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 40206da..07d3627 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1158,6 +1158,24 @@ static void mlx5e_close_tises(struct mlx5e_priv *priv) mlx5e_close_tis(priv, tc); } +static int mlx5e_rx_hash_fn(int hfunc) +{ + return (hfunc == ETH_RSS_HASH_TOP) ? + MLX5_RX_HASH_FN_TOEPLITZ : + MLX5_RX_HASH_FN_INVERTED_XOR8; +} + +static int mlx5e_bits_invert(unsigned long a, int size) +{ + int inv = 0; + int i; + + for (i = 0; i size; i++) + inv |= (test_bit(size - i - 1, a) ? 1 : 0) i; + + return inv; +} + static int mlx5e_open_rqt(struct mlx5e_priv *priv) { struct mlx5_core_dev *mdev = priv-mdev; @@ -1166,11 +1184,10 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv) void *rqtc; int inlen; int err; - int sz; + int log_tbl_sz = priv-params.rx_hash_log_tbl_sz; + int sz = 1 log_tbl_sz; int i; - sz = 1 priv-params.rx_hash_log_tbl_sz; - inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + sizeof(u32) * sz; in = mlx5_vzalloc(inlen); if (!in) @@ -1182,8 +1199,12 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv) MLX5_SET(rqtc, rqtc, rqt_max_size, sz); for (i = 0; i sz; i++) { - int ix = i % priv-params.num_channels; + int ix = i; + + if (priv-params.rss_hfunc == ETH_RSS_HASH_XOR) + ix = mlx5e_bits_invert(i, log_tbl_sz); + ix = ix % priv-params.num_channels; MLX5_SET(rqtc, rqtc, rq_num[i], priv-channel[ix]-rq.rqn); } @@ -1254,12 +1275,16 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) MLX5_SET(tirc, tirc, indirect_table, priv-rqtn); MLX5_SET(tirc, tirc, rx_hash_fn, -MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ); - MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); -
Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events
On Thu, Jul 23, 2015 at 05:43:35PM +0200, Jiri Pirko wrote: From: Ido Schimmel ido...@mellanox.com Add the ability to construct mailbox-style register access messages called EMADs with provisions to construct and parse the registers payload. Implement EMAD transaction layer which is responsible for the reliable transmission of EMADs. Also, add an infrastructure used by the switch driver to register for particular events generated by the device. Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- drivers/net/ethernet/mellanox/mlxsw/core.c | 736 drivers/net/ethernet/mellanox/mlxsw/core.h | 21 + drivers/net/ethernet/mellanox/mlxsw/emad.h | 127 +++ drivers/net/ethernet/mellanox/mlxsw/port.h | 19 + drivers/net/ethernet/mellanox/mlxsw/reg.h | 1289 5 files changed, 2192 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/emad.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/reg.h diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 211ec9b..bd0f692 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c [...] + struct list_head event_listener_list; + struct { + struct sk_buff *resp_skb; + u64 tid; + wait_queue_head_t wait; + bool trans_active; + struct mutex lock; /* One EMAD transaction at a time. */ + bool use_emad; + } emad; struct mlxsw_core_pcpu_stats __percpu *pcpu_stats; struct dentry *dbg_dir; struct { [...] } INIT_LIST_HEAD(mlxsw_core-rx_listener_list); + INIT_LIST_HEAD(mlxsw_core-event_listener_list); mlxsw_core-driver = mlxsw_driver; mlxsw_core-bus = mlxsw_bus; mlxsw_core-bus_priv = bus_priv; [...] + /* No reason to save item if we did not manage to register an RX + * listener for it. + */ + list_add_rcu(el_item-list, mlxsw_core-event_listener_list); + I see where 'event_listener_list' is defined and where entries are added/removed, but where is the code that would receive these events and presumably search this list so all handlers registered (currently just PUDE) can handle events? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 07/15] i40e: clean up unneeded gotos
From: Shannon Nelson shannon.nel...@intel.com With a little work we can clean up some unnecessary logic jumping and drop a variable. Signed-off-by: Shannon Nelson shannon.nel...@intel.com Cc: Laurent Navet laurent.na...@gmail.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_hmc.c | 37 ++ 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_hmc.c b/drivers/net/ethernet/intel/i40e/i40e_hmc.c index b89856a..5ebe12d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_hmc.c +++ b/drivers/net/ethernet/intel/i40e/i40e_hmc.c @@ -297,21 +297,15 @@ i40e_status i40e_remove_sd_bp_new(struct i40e_hw *hw, u32 idx, bool is_pf) { struct i40e_hmc_sd_entry *sd_entry; - i40e_status ret_code = 0; + + if (!is_pf) + return I40E_NOT_SUPPORTED; /* get the entry and decrease its ref counter */ sd_entry = hmc_info-sd_table.sd_entry[idx]; - if (is_pf) { - I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_DIRECT); - } else { - ret_code = I40E_NOT_SUPPORTED; - goto exit; - } - ret_code = i40e_free_dma_mem(hw, (sd_entry-u.bp.addr)); - if (ret_code) - goto exit; -exit: - return ret_code; + I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_DIRECT); + + return i40e_free_dma_mem(hw, sd_entry-u.bp.addr); } /** @@ -351,20 +345,13 @@ i40e_status i40e_remove_pd_page_new(struct i40e_hw *hw, struct i40e_hmc_info *hmc_info, u32 idx, bool is_pf) { - i40e_status ret_code = 0; struct i40e_hmc_sd_entry *sd_entry; + if (!is_pf) + return I40E_NOT_SUPPORTED; + sd_entry = hmc_info-sd_table.sd_entry[idx]; - if (is_pf) { - I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED); - } else { - ret_code = I40E_NOT_SUPPORTED; - goto exit; - } - /* free memory here */ - ret_code = i40e_free_dma_mem(hw, (sd_entry-u.pd_table.pd_page_addr)); - if (ret_code) - goto exit; -exit: - return ret_code; + I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED); + + return i40e_free_dma_mem(hw, sd_entry-u.pd_table.pd_page_addr); } -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 10/15] i40e: support virtual channel API 1.1
From: Mitch Williams mitch.a.willi...@intel.com Store off the VF API version for use when figuring out the VF driver capabilities. Add support for the VF driver handing its capabilities to the PF driver and then use this information when sending VF resource information back to the VF driver. Change-ID: Ic00d0eeeb5b8118085e12f068ef857089a8f7c2d Signed-off-by: Mitch Williams mitch.a.willi...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 25 -- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index fdd7f5e..176a289 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1121,12 +1121,13 @@ static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf, * * called from the VF to request the API version used by the PF **/ -static int i40e_vc_get_version_msg(struct i40e_vf *vf) +static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) { struct i40e_virtchnl_version_info info = { I40E_VIRTCHNL_VERSION_MAJOR, I40E_VIRTCHNL_VERSION_MINOR }; + vf-vf_ver = *(struct i40e_virtchnl_version_info *)msg; return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, I40E_SUCCESS, (u8 *)info, sizeof(struct @@ -1141,7 +1142,7 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf) * * called from the VF to request its resources **/ -static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf) +static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) { struct i40e_virtchnl_vf_resource *vfres = NULL; struct i40e_pf *pf = vf-pf; @@ -1165,11 +1166,18 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf) len = 0; goto err; } + if (VF_IS_V11(vf)) + vf-driver_caps = *(u32 *)msg; + else + vf-driver_caps = I40E_VIRTCHNL_VF_OFFLOAD_L2 | + I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG | + I40E_VIRTCHNL_VF_OFFLOAD_VLAN; vfres-vf_offload_flags = I40E_VIRTCHNL_VF_OFFLOAD_L2; vsi = pf-vsi[vf-lan_vsi_idx]; if (!vsi-info.pvid) - vfres-vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_VLAN; + vfres-vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_VLAN | + I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG; vfres-num_vsis = num_vsis; vfres-num_queue_pairs = vf-num_queue_pairs; @@ -1771,9 +1779,14 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, valid_len = sizeof(struct i40e_virtchnl_version_info); break; case I40E_VIRTCHNL_OP_RESET_VF: - case I40E_VIRTCHNL_OP_GET_VF_RESOURCES: valid_len = 0; break; + case I40E_VIRTCHNL_OP_GET_VF_RESOURCES: + if (VF_IS_V11(vf)) + valid_len = sizeof(u32); + else + valid_len = 0; + break; case I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE: valid_len = sizeof(struct i40e_virtchnl_txq_info); break; @@ -1886,10 +1899,10 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, switch (v_opcode) { case I40E_VIRTCHNL_OP_VERSION: - ret = i40e_vc_get_version_msg(vf); + ret = i40e_vc_get_version_msg(vf, msg); break; case I40E_VIRTCHNL_OP_GET_VF_RESOURCES: - ret = i40e_vc_get_vf_resources_msg(vf); + ret = i40e_vc_get_vf_resources_msg(vf, msg); break; case I40E_VIRTCHNL_OP_RESET_VF: i40e_vc_reset_vf_msg(vf); diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h index d254a5e..736f6f0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h @@ -78,6 +78,8 @@ struct i40e_vf { u16 vf_id; /* all VF vsis connect to the same parent */ enum i40e_switch_element_types parent_type; + struct i40e_virtchnl_version_info vf_ver; + u32 driver_caps; /* reported by VF driver */ /* VF Port Extender (PE) stag if used */ u16 stag; -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 11/15] i40evf: handle big resets
From: Mitch Williams mitch.a.willi...@intel.com The most common type of reset that the VF will encounter is a PF reset that cascades down into a VF reset for each VF. In this case, the VF will always be assigned the same VSI and recovery is fairly simple. However, in the case of 'bigger' resets, such as a Core or EMP reset, when the device is reinitialized, it's probable that the VF will NOT get the same VSI. When this happens, the VF will not be able to recover, as it will continue to request resources for its original VSI. Add an extra state to the admin queue state machine so that the driver can re-request its configuration information at runtime. During reset recovery, set this bit in the aq_required field, and fetch the (possibly new) configuration information before attempting to bring the driver back up. Since the driver doesn't know what kind of reset it has encountered, this step is done even for a PF reset, but it doesn't hurt anything - it just gets the same VSI back. Change-ID: I915d59ffb40375215117362f4ac7a37811aba748 Signed-off-by: Mitch Williams mitch.a.willi...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 + drivers/net/ethernet/intel/i40evf/i40evf_main.c| 109 + .../net/ethernet/intel/i40evf/i40evf_virtchnl.c| 30 +- 3 files changed, 95 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h index f3bcd05..dfc5bc5 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf.h +++ b/drivers/net/ethernet/intel/i40evf/i40evf.h @@ -234,6 +234,7 @@ struct i40evf_adapter { #define I40EVF_FLAG_AQ_CONFIGURE_QUEUES(u32)(1 6) #define I40EVF_FLAG_AQ_MAP_VECTORS (u32)(1 7) #define I40EVF_FLAG_AQ_HANDLE_RESET(u32)(1 8) +#define I40EVF_FLAG_AQ_GET_CONFIG (u32)(1 10) /* OS defined structs */ struct net_device *netdev; @@ -273,6 +274,7 @@ extern const char i40evf_driver_version[]; int i40evf_up(struct i40evf_adapter *adapter); void i40evf_down(struct i40evf_adapter *adapter); +int i40evf_process_config(struct i40evf_adapter *adapter); void i40evf_reset(struct i40evf_adapter *adapter); void i40evf_set_ethtool_ops(struct net_device *netdev); void i40evf_update_stats(struct i40evf_adapter *adapter); diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index c698523..7b90371 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c @@ -1371,6 +1371,10 @@ static void i40evf_watchdog_task(struct work_struct *work) } goto watchdog_done; } + if (adapter-aq_required I40EVF_FLAG_AQ_GET_CONFIG) { + i40evf_send_vf_config_msg(adapter); + goto watchdog_done; + } if (adapter-aq_required I40EVF_FLAG_AQ_DISABLE_QUEUES) { i40evf_disable_queues(adapter); @@ -1606,7 +1610,8 @@ continue_reset: dev_info(adapter-pdev-dev, Failed to init adminq: %d\n, err); - i40evf_map_queues(adapter); + adapter-aq_required = I40EVF_FLAG_AQ_GET_CONFIG; + adapter-aq_required |= I40EVF_FLAG_AQ_MAP_VECTORS; /* re-add all MAC filters */ list_for_each_entry(f, adapter-mac_filter_list, list) { @@ -1616,7 +1621,7 @@ continue_reset: list_for_each_entry(f, adapter-vlan_filter_list, list) { f-add = true; } - adapter-aq_required = I40EVF_FLAG_AQ_ADD_MAC_FILTER; + adapter-aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER; adapter-aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER; clear_bit(__I40EVF_IN_CRITICAL_TASK, adapter-crit_section); i40evf_misc_irq_enable(adapter); @@ -1982,6 +1987,62 @@ static int i40evf_check_reset_complete(struct i40e_hw *hw) } /** + * i40evf_process_config - Process the config information we got from the PF + * @adapter: board private structure + * + * Verify that we have a valid config struct, and set up our netdev features + * and our VSI struct. + **/ +int i40evf_process_config(struct i40evf_adapter *adapter) +{ + struct net_device *netdev = adapter-netdev; + int i; + + /* got VF config message back from PF, now we can parse it */ + for (i = 0; i adapter-vf_res-num_vsis; i++) { + if (adapter-vf_res-vsi_res[i].vsi_type == I40E_VSI_SRIOV) + adapter-vsi_res = adapter-vf_res-vsi_res[i]; + } + if (!adapter-vsi_res) { + dev_err(adapter-pdev-dev, No LAN VSI found\n); + return -ENODEV; + } + + if (adapter-vf_res-vf_offload_flags +I40E_VIRTCHNL_VF_OFFLOAD_VLAN) { + netdev-vlan_features = netdev-features; +
[net-next 15/15] i40e: use BIT and BIT_ULL macros
From: Jesse Brandeburg jesse.brandeb...@intel.com Use macros for abstracting (1 foo) to BIT(foo) and (1ULL foo64) to BIT_ULL(foo64) in order to match better with kernel requirements. NOTE: the adminq_cmd.h file was not modified on purpose because of the dependency upon firmware for that file. Change-ID: I73ee2e48c880d671948aad19bd53ca6b2ac558fc Signed-off-by: Jesse Brandeburg jesse.brandeb...@intel.com Signed-off-by: Catherine Sullivan catherine.sulli...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e.h | 56 - drivers/net/ethernet/intel/i40e/i40e_common.c | 4 +- drivers/net/ethernet/intel/i40e/i40e_dcb.h | 8 +-- drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 10 +-- drivers/net/ethernet/intel/i40e/i40e_diag.c| 11 ++-- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 54 drivers/net/ethernet/intel/i40e/i40e_fcoe.c| 12 ++-- drivers/net/ethernet/intel/i40e/i40e_fcoe.h| 4 +- drivers/net/ethernet/intel/i40e/i40e_hmc.h | 6 +- drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c | 16 ++--- drivers/net/ethernet/intel/i40e/i40e_main.c| 73 +++--- drivers/net/ethernet/intel/i40e/i40e_nvm.c | 6 +- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 7 +-- drivers/net/ethernet/intel/i40e/i40e_txrx.c| 39 ++-- drivers/net/ethernet/intel/i40e/i40e_txrx.h| 44 ++--- drivers/net/ethernet/intel/i40e/i40e_type.h| 22 +++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 18 +++--- drivers/net/ethernet/intel/i40evf/i40e_hmc.h | 6 +- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 37 ++- drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 42 ++--- drivers/net/ethernet/intel/i40evf/i40e_type.h | 22 +++ drivers/net/ethernet/intel/i40evf/i40evf.h | 42 ++--- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 44 ++--- drivers/net/ethernet/intel/i40evf/i40evf_main.c| 8 +-- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c| 4 +- 26 files changed, 293 insertions(+), 304 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index ec76c3f..281fd84 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -98,7 +98,7 @@ #define I40E_INT_NAME_STR_LEN(IFNAMSIZ + 9) /* Ethtool Private Flags */ -#define I40E_PRIV_FLAGS_NPAR_FLAG (1 0) +#define I40E_PRIV_FLAGS_NPAR_FLAG BIT(0) #define I40E_NVM_VERSION_LO_SHIFT 0 #define I40E_NVM_VERSION_LO_MASK (0xff I40E_NVM_VERSION_LO_SHIFT) @@ -289,35 +289,35 @@ struct i40e_pf { struct work_struct service_task; u64 flags; -#define I40E_FLAG_RX_CSUM_ENABLED (u64)(1 1) -#define I40E_FLAG_MSI_ENABLED (u64)(1 2) -#define I40E_FLAG_MSIX_ENABLED (u64)(1 3) -#define I40E_FLAG_RX_1BUF_ENABLED (u64)(1 4) -#define I40E_FLAG_RX_PS_ENABLED(u64)(1 5) -#define I40E_FLAG_RSS_ENABLED (u64)(1 6) -#define I40E_FLAG_VMDQ_ENABLED (u64)(1 7) -#define I40E_FLAG_FDIR_REQUIRES_REINIT (u64)(1 8) -#define I40E_FLAG_NEED_LINK_UPDATE (u64)(1 9) +#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1) +#define I40E_FLAG_MSI_ENABLED BIT_ULL(2) +#define I40E_FLAG_MSIX_ENABLED BIT_ULL(3) +#define I40E_FLAG_RX_1BUF_ENABLED BIT_ULL(4) +#define I40E_FLAG_RX_PS_ENABLEDBIT_ULL(5) +#define I40E_FLAG_RSS_ENABLED BIT_ULL(6) +#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7) +#define I40E_FLAG_FDIR_REQUIRES_REINIT BIT_ULL(8) +#define I40E_FLAG_NEED_LINK_UPDATE BIT_ULL(9) #ifdef I40E_FCOE -#define I40E_FLAG_FCOE_ENABLED (u64)(1 11) +#define I40E_FLAG_FCOE_ENABLED BIT_ULL(11) #endif /* I40E_FCOE */ -#define I40E_FLAG_IN_NETPOLL (u64)(1 12) -#define I40E_FLAG_16BYTE_RX_DESC_ENABLED (u64)(1 13) -#define I40E_FLAG_CLEAN_ADMINQ (u64)(1 14) -#define I40E_FLAG_FILTER_SYNC (u64)(1 15) -#define I40E_FLAG_PROCESS_MDD_EVENT(u64)(1 17) -#define I40E_FLAG_PROCESS_VFLR_EVENT (u64)(1 18) -#define I40E_FLAG_SRIOV_ENABLED(u64)(1 19) -#define I40E_FLAG_DCB_ENABLED (u64)(1 20) -#define I40E_FLAG_FD_SB_ENABLED(u64)(1 21) -#define I40E_FLAG_FD_ATR_ENABLED (u64)(1 22) -#define I40E_FLAG_PTP (u64)(1 25) -#define I40E_FLAG_MFP_ENABLED (u64)(1 26) +#define I40E_FLAG_IN_NETPOLL BIT_ULL(12) +#define
[net-next 13/15] i40e: provide correct API version to older VF drivers
From: Mitch Williams mitch.a.willi...@intel.com This driver fully supports VF drivers using both the 1.0 and 1.1 versions of the virtual channel API. However, VF drivers using version 1.0 get upset if we provide them with a version other than that, and refuse to play with us. Correct this by checking the VFs API version at the time that we store it off, and provide the correct version number back to the VF so we can all get along. Change-ID: I86dfe02e67b2bef336b4b49a1bb072f3e7229abc Signed-off-by: Mitch Williams mitch.a.willi...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 176a289..51aff70 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1128,6 +1128,9 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) }; vf-vf_ver = *(struct i40e_virtchnl_version_info *)msg; + /* VFs running the 1.0 API expect to get 1.0 back or they will cry. */ + if (VF_IS_V10(vf)) + info.minor = I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS; return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, I40E_SUCCESS, (u8 *)info, sizeof(struct -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 08/15] i40e: add VF capabilities to virtual channel interface
From: Mitch Williams mitch.a.willi...@intel.com To prepare for the changes coming up in the X722 device and future devices, the virtual channel interface has to change slightly. The VF driver can now report what its capable of supporting, which then informs the PF driver when it sends the configuration information back to the VF. A 1.1 VF driver on a 1.0 PF driver should not send its capabilities. Likewise, a 1.1 PF driver controlling a 1.0 VF driver should not expect or depend upon receiving the VF capabilities. All other aspects of the API are unchanged. Change-ID: I530cc55f107edd1ee8bdf95830aa90b87854058a Signed-off-by: Mitch Williams mitch.a.willi...@intel.com Acked-by: Shannon Nelson shannon.nel...@intel.com Acked-by: Anjali Singhai anjali.sing...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_virtchnl.h | 16 +++- drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 16 +++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h index 2d20af2..a7ab463 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h @@ -110,7 +110,9 @@ struct i40e_virtchnl_msg { * error regardless of version mismatch. */ #define I40E_VIRTCHNL_VERSION_MAJOR1 -#define I40E_VIRTCHNL_VERSION_MINOR0 +#define I40E_VIRTCHNL_VERSION_MINOR1 +#define I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0 + struct i40e_virtchnl_version_info { u32 major; u32 minor; @@ -129,7 +131,8 @@ struct i40e_virtchnl_version_info { */ /* I40E_VIRTCHNL_OP_GET_VF_RESOURCES - * VF sends this request to PF with no parameters + * Version 1.0 VF sends this request to PF with no parameters + * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities * PF responds with an indirect message containing * i40e_virtchnl_vf_resource and one or more * i40e_virtchnl_vsi_resource structures. @@ -143,9 +146,12 @@ struct i40e_virtchnl_vsi_resource { u8 default_mac_addr[ETH_ALEN]; }; /* VF offload flags */ -#define I40E_VIRTCHNL_VF_OFFLOAD_L20x0001 -#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x0004 -#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x0001 +#define I40E_VIRTCHNL_VF_OFFLOAD_L20x0001 +#define I40E_VIRTCHNL_VF_OFFLOAD_IWARP 0x0002 +#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x0004 +#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ0x0008 +#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG 0x0010 +#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x0001 struct i40e_virtchnl_vf_resource { u16 num_vsis; diff --git a/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h b/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h index 59f62f0..1e89dea 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h @@ -110,7 +110,9 @@ struct i40e_virtchnl_msg { * error regardless of version mismatch. */ #define I40E_VIRTCHNL_VERSION_MAJOR1 -#define I40E_VIRTCHNL_VERSION_MINOR0 +#define I40E_VIRTCHNL_VERSION_MINOR1 +#define I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0 + struct i40e_virtchnl_version_info { u32 major; u32 minor; @@ -129,7 +131,8 @@ struct i40e_virtchnl_version_info { */ /* I40E_VIRTCHNL_OP_GET_VF_RESOURCES - * VF sends this request to PF with no parameters + * Version 1.0 VF sends this request to PF with no parameters + * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities * PF responds with an indirect message containing * i40e_virtchnl_vf_resource and one or more * i40e_virtchnl_vsi_resource structures. @@ -143,9 +146,12 @@ struct i40e_virtchnl_vsi_resource { u8 default_mac_addr[ETH_ALEN]; }; /* VF offload flags */ -#define I40E_VIRTCHNL_VF_OFFLOAD_L20x0001 -#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x0004 -#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x0001 +#define I40E_VIRTCHNL_VF_OFFLOAD_L20x0001 +#define I40E_VIRTCHNL_VF_OFFLOAD_IWARP 0x0002 +#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x0004 +#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ0x0008 +#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG 0x0010 +#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x0001 struct i40e_virtchnl_vf_resource { u16 num_vsis; -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 14/15] i40e: clean up error status messages
From: Shannon Nelson shannon.nel...@intel.com Clean up a little confusion in reporting error status in phy and fcoe setup error reports by separating the return status from the AQ error. Add two decoder functions to make this easier. Change-ID: I960bcdeef3978a15fec1cdb5eff781d5cbae42fb Signed-off-by: Shannon Nelson shannon.nel...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_common.c | 206 +++ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 30 +- drivers/net/ethernet/intel/i40e/i40e_main.c| 392 - drivers/net/ethernet/intel/i40e/i40e_prototype.h | 2 + drivers/net/ethernet/intel/i40e/i40e_type.h| 1 + drivers/net/ethernet/intel/i40evf/i40e_common.c| 206 +++ drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 2 + drivers/net/ethernet/intel/i40evf/i40e_type.h | 1 + .../net/ethernet/intel/i40evf/i40evf_virtchnl.c| 10 +- 9 files changed, 673 insertions(+), 177 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index 0703222..8f2ecbe 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c @@ -72,6 +72,212 @@ static i40e_status i40e_set_mac_type(struct i40e_hw *hw) } /** + * i40e_aq_str - convert AQ err code to a string + * @hw: pointer to the HW structure + * @aq_err: the AQ error code to convert + **/ +char *i40e_aq_str(struct i40e_hw *hw, enum i40e_admin_queue_err aq_err) +{ + switch (aq_err) { + case I40E_AQ_RC_OK: + return OK; + case I40E_AQ_RC_EPERM: + return I40E_AQ_RC_EPERM; + case I40E_AQ_RC_ENOENT: + return I40E_AQ_RC_ENOENT; + case I40E_AQ_RC_ESRCH: + return I40E_AQ_RC_ESRCH; + case I40E_AQ_RC_EINTR: + return I40E_AQ_RC_EINTR; + case I40E_AQ_RC_EIO: + return I40E_AQ_RC_EIO; + case I40E_AQ_RC_ENXIO: + return I40E_AQ_RC_ENXIO; + case I40E_AQ_RC_E2BIG: + return I40E_AQ_RC_E2BIG; + case I40E_AQ_RC_EAGAIN: + return I40E_AQ_RC_EAGAIN; + case I40E_AQ_RC_ENOMEM: + return I40E_AQ_RC_ENOMEM; + case I40E_AQ_RC_EACCES: + return I40E_AQ_RC_EACCES; + case I40E_AQ_RC_EFAULT: + return I40E_AQ_RC_EFAULT; + case I40E_AQ_RC_EBUSY: + return I40E_AQ_RC_EBUSY; + case I40E_AQ_RC_EEXIST: + return I40E_AQ_RC_EEXIST; + case I40E_AQ_RC_EINVAL: + return I40E_AQ_RC_EINVAL; + case I40E_AQ_RC_ENOTTY: + return I40E_AQ_RC_ENOTTY; + case I40E_AQ_RC_ENOSPC: + return I40E_AQ_RC_ENOSPC; + case I40E_AQ_RC_ENOSYS: + return I40E_AQ_RC_ENOSYS; + case I40E_AQ_RC_ERANGE: + return I40E_AQ_RC_ERANGE; + case I40E_AQ_RC_EFLUSHED: + return I40E_AQ_RC_EFLUSHED; + case I40E_AQ_RC_BAD_ADDR: + return I40E_AQ_RC_BAD_ADDR; + case I40E_AQ_RC_EMODE: + return I40E_AQ_RC_EMODE; + case I40E_AQ_RC_EFBIG: + return I40E_AQ_RC_EFBIG; + } + + snprintf(hw-err_str, sizeof(hw-err_str), %d, aq_err); + return hw-err_str; +} + +/** + * i40e_stat_str - convert status err code to a string + * @hw: pointer to the HW structure + * @stat_err: the status error code to convert + **/ +char *i40e_stat_str(struct i40e_hw *hw, i40e_status stat_err) +{ + switch (stat_err) { + case 0: + return OK; + case I40E_ERR_NVM: + return I40E_ERR_NVM; + case I40E_ERR_NVM_CHECKSUM: + return I40E_ERR_NVM_CHECKSUM; + case I40E_ERR_PHY: + return I40E_ERR_PHY; + case I40E_ERR_CONFIG: + return I40E_ERR_CONFIG; + case I40E_ERR_PARAM: + return I40E_ERR_PARAM; + case I40E_ERR_MAC_TYPE: + return I40E_ERR_MAC_TYPE; + case I40E_ERR_UNKNOWN_PHY: + return I40E_ERR_UNKNOWN_PHY; + case I40E_ERR_LINK_SETUP: + return I40E_ERR_LINK_SETUP; + case I40E_ERR_ADAPTER_STOPPED: + return I40E_ERR_ADAPTER_STOPPED; + case I40E_ERR_INVALID_MAC_ADDR: + return I40E_ERR_INVALID_MAC_ADDR; + case I40E_ERR_DEVICE_NOT_SUPPORTED: + return I40E_ERR_DEVICE_NOT_SUPPORTED; + case I40E_ERR_MASTER_REQUESTS_PENDING: + return I40E_ERR_MASTER_REQUESTS_PENDING; + case I40E_ERR_INVALID_LINK_SETTINGS: + return I40E_ERR_INVALID_LINK_SETTINGS; + case I40E_ERR_AUTONEG_NOT_COMPLETE: + return I40E_ERR_AUTONEG_NOT_COMPLETE; + case I40E_ERR_RESET_FAILED: + return I40E_ERR_RESET_FAILED; + case I40E_ERR_SWFW_SYNC: +
[net-next 12/15] i40evf: support virtual channel API version 1.1
From: Mitch Williams mitch.a.willi...@intel.com Store off the PF's API version, then use it to determine whether or not to send it our capabilities. Change the version checking to allow for PF drivers with lower API versions than our current version, so we can still talk to PF drivers over the 1.0 API. Change-ID: I8edc55d1229c7decf0ed3f285a63032694007c2e Signed-off-by: Mitch Williams mitch.a.willi...@intel.com Tested-by: Jim young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 6 ++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 7 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index 7b90371..f43ac9c 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c @@ -2113,6 +2113,12 @@ static void i40evf_init_task(struct work_struct *work) if (err) { if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK) err = i40evf_send_api_ver(adapter); + else + dev_err(pdev-dev, Unsupported PF API version %d.%d, expected %d.%d\n, + adapter-pf_version.major, + adapter-pf_version.minor, + I40E_VIRTCHNL_VERSION_MAJOR, + I40E_VIRTCHNL_VERSION_MINOR); goto err; } err = i40evf_send_vf_config_msg(adapter); diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c index a37d56b..52c6959 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c @@ -125,8 +125,11 @@ int i40evf_verify_api_ver(struct i40evf_adapter *adapter) } pf_vvi = (struct i40e_virtchnl_version_info *)event.msg_buf; - if ((pf_vvi-major != I40E_VIRTCHNL_VERSION_MAJOR) || - (pf_vvi-minor != I40E_VIRTCHNL_VERSION_MINOR)) + adapter-pf_version = *pf_vvi; + + if ((pf_vvi-major I40E_VIRTCHNL_VERSION_MAJOR) || + ((pf_vvi-major == I40E_VIRTCHNL_VERSION_MAJOR) +(pf_vvi-minor I40E_VIRTCHNL_VERSION_MINOR))) err = -EIO; out_alloc: -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-07-23
This series contains updates to e1000e, igb, ixgbevf, i40e and i40evf. Emil extends the reporting of the RSS key and hash table by adding support for x550 VFs. Jia-Ju Bai fixes a QoS issue in e1000e where the error handling lacked a call to pm_qos_remove_request() to cleanup the QoS request made in e1000_open(). Todd updates igb to report unsupported for ethtool coalesce settings that are not supported. Also updated the driver to use the ARRAY_SIZE() macro. Carolyn fixes and refactors the dynamic ITR code for i40e and i40evf which would never change dynamically. So update the switch() statement to have a default case and switch on new_latency_range versus the current ITR setting. Shannon cleans up i40e code, where there were un-needed goto's. Also clean up error status messages that were causing some confusion in PHY and FCoE setup error reports. Mitch updates the virtual channel interface to prepare for the x722 device and other future devices, so that the VF driver can report what its capable of supporting to the PF driver. Updates the i40evf driver to handle resets like Core or EMP resets, where the device is reinitialized and the VF will not get the same VSI. Jesse updates the i40e and i40evf driver to use the kernel BIT() and BIT_ULL() macros. The following are changes since commit 045a0fa0c5f5ea0f16c009f924ea579634afbba8: ip_tunnel: Call ip_tunnel_core_init() from inet_init() and are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue master Carolyn Wyborny (1): i40e/i40evf: Fix and refactor dynamic ITR code Emil Tantilov (1): ixgbevf: add support for reporting RSS key and hash table for X550 Jesse Brandeburg (1): i40e: use BIT and BIT_ULL macros Jia-Ju Bai (1): e1000e: Cleanup qos request in error handling of e1000_open Mitch Williams (6): i40e: add VF capabilities to virtual channel interface i40e/i40evf: add macros for virtual channel API version and device capability i40e: support virtual channel API 1.1 i40evf: handle big resets i40evf: support virtual channel API version 1.1 i40e: provide correct API version to older VF drivers Shannon Nelson (2): i40e: clean up unneeded gotos i40e: clean up error status messages Todd Fujinaka (3): igb: report unsupported ethtool settings in set_coalesce igb: use ARRAY_SIZE to replace calculating sizeof(a)/sizeof(a[0]) igb: bump version to igb-5.3.0 drivers/net/ethernet/intel/e1000e/netdev.c | 1 + drivers/net/ethernet/intel/i40e/i40e.h | 56 +-- drivers/net/ethernet/intel/i40e/i40e_common.c | 210 +- drivers/net/ethernet/intel/i40e/i40e_dcb.h | 8 +- drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 10 +- drivers/net/ethernet/intel/i40e/i40e_diag.c| 11 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 84 ++-- drivers/net/ethernet/intel/i40e/i40e_fcoe.c| 12 +- drivers/net/ethernet/intel/i40e/i40e_fcoe.h| 4 +- drivers/net/ethernet/intel/i40e/i40e_hmc.c | 37 +- drivers/net/ethernet/intel/i40e/i40e_hmc.h | 6 +- drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c | 16 +- drivers/net/ethernet/intel/i40e/i40e_main.c| 465 - drivers/net/ethernet/intel/i40e/i40e_nvm.c | 6 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 2 + drivers/net/ethernet/intel/i40e/i40e_ptp.c | 7 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c| 185 drivers/net/ethernet/intel/i40e/i40e_txrx.h| 44 +- drivers/net/ethernet/intel/i40e/i40e_type.h| 23 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl.h| 16 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 46 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 5 + drivers/net/ethernet/intel/i40evf/i40e_common.c| 206 + drivers/net/ethernet/intel/i40evf/i40e_hmc.h | 6 +- drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 2 + drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 146 --- drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 42 +- drivers/net/ethernet/intel/i40evf/i40e_type.h | 23 +- drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 16 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 51 ++- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 44 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c| 123 +++--- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c| 51 ++- drivers/net/ethernet/intel/igb/e1000_phy.c | 16 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 21 + drivers/net/ethernet/intel/igb/igb_main.c | 4 +- drivers/net/ethernet/intel/ixgbevf/ethtool.c | 51 ++- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 9 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 21 +- 40 files changed, 1376 insertions(+), 712 deletions(-) --
[net-next 06/15] i40e/i40evf: Fix and refactor dynamic ITR code
From: Carolyn Wyborny carolyn.wybo...@intel.com This patch changes the switch statement for dynamic interrupt throttling and adds a default case. With this patch, we check the latency setting instead of the current ITR settings and the included refactor improves performance. Without this patch, the ITR setting would never change dynamically, and there was no default. Change-ID: Idb5a8a14c7109ec47c90f6e94bd43baa17d7ee37 Signed-off-by: Carolyn Wyborny carolyn.wybo...@intel.com Signed-off-by: Anjali Singhai Jain anjali.sing...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 146 -- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 113 +--- 2 files changed, 161 insertions(+), 98 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 1fe230d..a72278c 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -892,7 +892,7 @@ static void i40e_set_new_dynamic_itr(struct i40e_ring_container *rc) * 20-1249MB/s bulk (8000 ints/s) */ bytes_per_int = rc-total_bytes / rc-itr; - switch (rc-itr) { + switch (new_latency_range) { case I40E_LOWEST_LATENCY: if (bytes_per_int 10) new_latency_range = I40E_LOW_LATENCY; @@ -905,9 +905,14 @@ static void i40e_set_new_dynamic_itr(struct i40e_ring_container *rc) break; case I40E_BULK_LATENCY: if (bytes_per_int = 20) - rc-latency_range = I40E_LOW_LATENCY; + new_latency_range = I40E_LOW_LATENCY; + break; + default: + if (bytes_per_int = 20) + new_latency_range = I40E_LOW_LATENCY; break; } + rc-latency_range = new_latency_range; switch (new_latency_range) { case I40E_LOWEST_LATENCY: @@ -923,42 +928,14 @@ static void i40e_set_new_dynamic_itr(struct i40e_ring_container *rc) break; } - if (new_itr != rc-itr) { - /* do an exponential smoothing */ - new_itr = (10 * new_itr * rc-itr) / - ((9 * new_itr) + rc-itr); - rc-itr = new_itr I40E_MAX_ITR; - } + if (new_itr != rc-itr) + rc-itr = new_itr; rc-total_bytes = 0; rc-total_packets = 0; } /** - * i40e_update_dynamic_itr - Adjust ITR based on bytes per int - * @q_vector: the vector to adjust - **/ -static void i40e_update_dynamic_itr(struct i40e_q_vector *q_vector) -{ - u16 vector = q_vector-vsi-base_vector + q_vector-v_idx; - struct i40e_hw *hw = q_vector-vsi-back-hw; - u32 reg_addr; - u16 old_itr; - - reg_addr = I40E_PFINT_ITRN(I40E_RX_ITR, vector - 1); - old_itr = q_vector-rx.itr; - i40e_set_new_dynamic_itr(q_vector-rx); - if (old_itr != q_vector-rx.itr) - wr32(hw, reg_addr, q_vector-rx.itr); - - reg_addr = I40E_PFINT_ITRN(I40E_TX_ITR, vector - 1); - old_itr = q_vector-tx.itr; - i40e_set_new_dynamic_itr(q_vector-tx); - if (old_itr != q_vector-tx.itr) - wr32(hw, reg_addr, q_vector-tx.itr); -} - -/** * i40e_clean_programming_status - clean the programming status descriptor * @rx_ring: the rx ring that has this descriptor * @rx_desc: the rx descriptor written back by HW @@ -1827,6 +1804,68 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget) } /** + * i40e_update_enable_itr - Update itr and re-enable MSIX interrupt + * @vsi: the VSI we care about + * @q_vector: q_vector for which itr is being updated and interrupt enabled + * + **/ +static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, + struct i40e_q_vector *q_vector) +{ + struct i40e_hw *hw = vsi-back-hw; + u16 old_itr; + int vector; + u32 val; + + vector = (q_vector-v_idx + vsi-base_vector); + if (ITR_IS_DYNAMIC(vsi-rx_itr_setting)) { + old_itr = q_vector-rx.itr; + i40e_set_new_dynamic_itr(q_vector-rx); + if (old_itr != q_vector-rx.itr) { + val = I40E_PFINT_DYN_CTLN_INTENA_MASK | + I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (I40E_RX_ITR + I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT) | + (q_vector-rx.itr + I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT); + } else { + val = I40E_PFINT_DYN_CTLN_INTENA_MASK | + I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (I40E_ITR_NONE + I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT); +
[net-next 03/15] igb: report unsupported ethtool settings in set_coalesce
From: Todd Fujinaka todd.fujin...@intel.com There are many settings possible using ethtool -C/--coalesce, but not all of them are supported in igb. Report failure when an unsupported option is set. Signed-off-by: Todd Fujinaka todd.fujin...@intel.com Tested-by: Aaron Brown aaron.f.br...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 109cad9..b7b9c67 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -2159,6 +2159,27 @@ static int igb_set_coalesce(struct net_device *netdev, struct igb_adapter *adapter = netdev_priv(netdev); int i; + if (ec-rx_max_coalesced_frames || + ec-rx_coalesce_usecs_irq || + ec-rx_max_coalesced_frames_irq || + ec-tx_max_coalesced_frames || + ec-tx_coalesce_usecs_irq || + ec-stats_block_coalesce_usecs || + ec-use_adaptive_rx_coalesce || + ec-use_adaptive_tx_coalesce || + ec-pkt_rate_low || + ec-rx_coalesce_usecs_low || + ec-rx_max_coalesced_frames_low || + ec-tx_coalesce_usecs_low || + ec-tx_max_coalesced_frames_low || + ec-pkt_rate_high || + ec-rx_coalesce_usecs_high || + ec-rx_max_coalesced_frames_high || + ec-tx_coalesce_usecs_high || + ec-tx_max_coalesced_frames_high || + ec-rate_sample_interval) + return -ENOTSUPP; + if ((ec-rx_coalesce_usecs IGB_MAX_ITR_USECS) || ((ec-rx_coalesce_usecs 3) (ec-rx_coalesce_usecs IGB_MIN_ITR_USECS)) || -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 04/15] igb: use ARRAY_SIZE to replace calculating sizeof(a)/sizeof(a[0])
From: Todd Fujinaka todd.fujin...@intel.com Use the ARRAY_SIZE macro rather than calculating sizeof(a)/sizeof(a[0]). Also directly replace the code rather than using an unnecessary define. Reported-by: Maninder Singh maninder...@samsung.com Reported-by: Joe Perches j...@perches.com Signed-off-by: Todd Fujinaka todd.fujin...@intel.com Tested-by: Aaron Brown aaron.f.br...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/igb/e1000_phy.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c index c1bb64d..987c9de 100644 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c @@ -1,5 +1,5 @@ /* Intel(R) Gigabit Ethernet Linux driver - * Copyright(c) 2007-2014 Intel Corporation. + * Copyright(c) 2007-2015 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -36,9 +36,6 @@ static s32 igb_set_master_slave_mode(struct e1000_hw *hw); /* Cable length tables */ static const u16 e1000_m88_cable_length_table[] = { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; -#define M88E1000_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_m88_cable_length_table) / \ - sizeof(e1000_m88_cable_length_table[0])) static const u16 e1000_igp_2_cable_length_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, @@ -49,9 +46,6 @@ static const u16 e1000_igp_2_cable_length_table[] = { 60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121, 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121, 124}; -#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_igp_2_cable_length_table) / \ -sizeof(e1000_igp_2_cable_length_table[0])) /** * igb_check_reset_block - Check if PHY reset is blocked @@ -1700,7 +1694,7 @@ s32 igb_get_cable_length_m88(struct e1000_hw *hw) index = (phy_data M88E1000_PSSR_CABLE_LENGTH) M88E1000_PSSR_CABLE_LENGTH_SHIFT; - if (index = M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) { + if (index = ARRAY_SIZE(e1000_m88_cable_length_table) - 1) { ret_val = -E1000_ERR_PHY; goto out; } @@ -1796,7 +1790,7 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw) index = (phy_data M88E1000_PSSR_CABLE_LENGTH) M88E1000_PSSR_CABLE_LENGTH_SHIFT; - if (index = M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) { + if (index = ARRAY_SIZE(e1000_m88_cable_length_table) - 1) { ret_val = -E1000_ERR_PHY; goto out; } @@ -1840,7 +1834,7 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw) s32 ret_val = 0; u16 phy_data, i, agc_value = 0; u16 cur_agc_index, max_agc_index = 0; - u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; + u16 min_agc_index = ARRAY_SIZE(e1000_igp_2_cable_length_table) - 1; static const u16 agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = { IGP02E1000_PHY_AGC_A, IGP02E1000_PHY_AGC_B, @@ -1863,7 +1857,7 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw) IGP02E1000_AGC_LENGTH_MASK; /* Array index bound check. */ - if ((cur_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE) || + if ((cur_agc_index = ARRAY_SIZE(e1000_igp_2_cable_length_table)) || (cur_agc_index == 0)) { ret_val = -E1000_ERR_PHY; goto out; -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 05/15] igb: bump version to igb-5.3.0
From: Todd Fujinaka todd.fujin...@intel.com Signed-off-by: Todd Fujinaka todd.fujin...@intel.com Tested-by: Aaron Brown aaron.f.br...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index fc7729e..41e2740 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -57,8 +57,8 @@ #include igb.h #define MAJ 5 -#define MIN 2 -#define BUILD 18 +#define MIN 3 +#define BUILD 0 #define DRV_VERSION __stringify(MAJ) . __stringify(MIN) . \ __stringify(BUILD) -k char igb_driver_name[] = igb; -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 09/15] i40e/i40evf: add macros for virtual channel API version and device capability
From: Mitch Williams mitch.a.willi...@intel.com Now that we've rolled the virtual channel API version to 1.1, add some macros to test what version is being used by our partner in crime. For the VF, add some macros to determine what our device capabilities are. Change-ID: I79f6683d4c23bd76a8ad9fd492776fcc1208e1dc Signed-off-by: Mitch Williams mitch.a.willi...@intel.com Tested-by: Jim Young james.m.yo...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 +++ drivers/net/ethernet/intel/i40evf/i40evf.h | 9 + 2 files changed, 12 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h index 09043c1..d254a5e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h @@ -42,6 +42,9 @@ #define I40E_VLAN_MASK 0xFFF #define I40E_PRIORITY_MASK 0x7000 +#define VF_IS_V10(_v) (((_v)-vf_ver.major == 1) ((_v)-vf_ver.minor == 0)) +#define VF_IS_V11(_v) (((_v)-vf_ver.major == 1) ((_v)-vf_ver.minor == 1)) + /* Various queue ctrls */ enum i40e_queue_ctrl { I40E_QUEUE_CTRL_UNKNOWN = 0, diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h index fea3b75..f3bcd05 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf.h +++ b/drivers/net/ethernet/intel/i40evf/i40evf.h @@ -249,8 +249,17 @@ struct i40evf_adapter { bool netdev_registered; bool link_up; enum i40e_virtchnl_ops current_op; +#define CLIENT_ENABLED(_a) ((_a)-vf_res-vf_offload_flags \ + I40E_VIRTCHNL_VF_OFFLOAD_IWARP) +#define RSS_AQ(_a) ((_a)-vf_res-vf_offload_flags \ + I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ) +#define VLAN_ALLOWED(_a) ((_a)-vf_res-vf_offload_flags \ + I40E_VIRTCHNL_VF_OFFLOAD_VLAN) struct i40e_virtchnl_vf_resource *vf_res; /* incl. all VSIs */ struct i40e_virtchnl_vsi_resource *vsi_res; /* our LAN VSI */ + struct i40e_virtchnl_version_info pf_version; +#define PF_IS_V11(_a) (((_a)-pf_version.major == 1) \ + ((_a)-pf_version.minor == 1)) u16 msg_enable; struct i40e_eth_stats current_stats; struct i40e_vsi vsi; -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [net-next PATCH v0 3/6] net: netcp: Fixes error in oversized memory allocation for statistics storage
On 07/23/2015 09:32 AM, WingMan Kwok wrote: The CPSW driver keeps internally some, but not all, of the statistics available in the hw statistics modules. Furthermore, some of the locations in the hw statistics modules are reserved and contain no useful information. Prior to this patch, the driver allocates memory of the size of the the whole hw statistics modules, instead of the size of statistics-entries-interested-in (i.e. et_stats), for internal storage. This patch fixes that. Signed-off-by: WingMan Kwok w-kw...@ti.com --- drivers/net/ethernet/ti/netcp_ethss.c | 42 - 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index b954856..a1f16e1 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -2555,10 +2555,12 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, } gbe_dev-xgbe_serdes_regs = regs; + gbe_dev-et_stats = xgbe10_et_stats; + gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - XGBE10_NUM_STAT_ENTRIES * - (gbe_dev-max_num_ports) * sizeof(u64), - GFP_KERNEL); Looks like XGBE10_NUM_STAT_ENTRIES is used only here and this is being replaced. So could you please remove the #define as well? same for other instances if any below. +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2577,8 +2579,6 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = XGBE10_HOST_PORT_NUM; gbe_dev-ale_entries = XGBE10_NUM_ALE_ENTRIES; - gbe_dev-et_stats = xgbe10_et_stats; - gbe_dev-num_et_stats = ARRAY_SIZE(xgbe10_et_stats); gbe_dev-stats_en_mask = (1 (gbe_dev-max_num_ports)) - 1; /* Subsystem registers */ @@ -2663,10 +2663,12 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, } gbe_dev-switch_regs = regs; + gbe_dev-et_stats = gbe13_et_stats; + gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - GBE13_NUM_HW_STAT_ENTRIES * - gbe_dev-max_num_slaves * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2689,8 +2691,6 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = GBE13_HOST_PORT_NUM; gbe_dev-ale_entries = GBE13_NUM_ALE_ENTRIES; - gbe_dev-et_stats = gbe13_et_stats; - gbe_dev-num_et_stats = ARRAY_SIZE(gbe13_et_stats); gbe_dev-stats_en_mask = GBE13_REG_VAL_STAT_ENABLE_ALL; /* Subsystem registers */ @@ -2717,10 +2717,18 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, void __iomem *regs; int i, ret; + gbe_dev-et_stats = gbenu_et_stats; + + if (IS_SS_ID_NU(gbe_dev)) + gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + + (gbe_dev-max_num_slaves * GBENU_ET_STATS_PORT_SIZE); + else + gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + + GBENU_ET_STATS_PORT_SIZE; + gbe_dev-hw_stats = devm_kzalloc(gbe_dev-dev, - GBENU_NUM_HW_STAT_ENTRIES * - (gbe_dev-max_num_ports) * sizeof(u64), - GFP_KERNEL); +gbe_dev-num_et_stats * sizeof(u64), +GFP_KERNEL); if (!gbe_dev-hw_stats) { dev_err(gbe_dev-dev, hw_stats memory allocation failed\n); return -ENOMEM; @@ -2753,16 +2761,8 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, gbe_dev-ale_ports = gbe_dev-max_num_ports; gbe_dev-host_port = GBENU_HOST_PORT_NUM; gbe_dev-ale_entries = GBE13_NUM_ALE_ENTRIES; - gbe_dev-et_stats = gbenu_et_stats; gbe_dev-stats_en_mask = (1 (gbe_dev-max_num_ports)) - 1; - if (IS_SS_ID_NU(gbe_dev)) - gbe_dev-num_et_stats = GBENU_ET_STATS_HOST_SIZE + - (gbe_dev-max_num_slaves * GBENU_ET_STATS_PORT_SIZE); - else -
Re: [PATCH net-next] lwtunnel: export linux/lwtunnel.h to userspace
On 7/23/15, 6:43 AM, Nicolas Dichtel wrote: Note also that include/linux/lwtunnel.h is not needed. CC: Thomas Graf tg...@suug.ch CC: Roopa Prabhu ro...@cumulusnetworks.com Fixes: 499a24256862 (lwtunnel: infrastructure for handling light weight tunnels like mpls) Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com Acked-by: Roopa Prabhu ro...@cumulusnetworks.com Thanks. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net v3] macvtap: fix network header pointer for VLAN tagged pkts
Network header is set with offset ETH_HLEN but it is not true for VLAN (multiple-)tagged and results in checksum issues in lower devices. v2: leave skb-protocol untouched (thx Vlad), comment added v3: moved after skb_probe_transport_header() call (thx Toshiaki) Signed-off-by: Ivan Vecera ivec...@redhat.com --- drivers/net/macvtap.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3b933bb..edd7734 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -719,6 +719,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, struct virtio_net_hdr vnet_hdr = { 0 }; int vnet_hdr_len = 0; int copylen = 0; + int depth; bool zerocopy = false; size_t linear; ssize_t n; @@ -804,6 +805,12 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, skb_probe_transport_header(skb, ETH_HLEN); + /* Move network header to the right position for VLAN tagged packets */ + if ((skb-protocol == htons(ETH_P_8021Q) || +skb-protocol == htons(ETH_P_8021AD)) + __vlan_get_protocol(skb, skb-protocol, depth) != 0) + skb_set_network_header(skb, depth); + rcu_read_lock(); vlan = rcu_dereference(q-vlan); /* copy skb_ubuf_info for callback when skb has no error */ -- 2.3.6 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 02/15] e1000e: Cleanup qos request in error handling of e1000_open
From: Jia-Ju Bai baijiaju1...@163.com The driver lacks pm_qos_remove_request in error handling (err_req_irq) of e1000_open, and qos request inserted by pm_qos_add_request is not removed. This patch add pm_qos_remove_request in error handling to fix it. Signed-off-by: Jia-Ju Bai baijiaju1...@163.com Tested-by: Aaron Brown aaron.f.br...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/e1000e/netdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 89d788d..fea1601 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -4588,6 +4588,7 @@ static int e1000_open(struct net_device *netdev) return 0; err_req_irq: + pm_qos_remove_request(adapter-pm_qos_req); e1000e_release_hw_control(adapter); e1000_power_down_phy(adapter); e1000e_free_rx_resources(adapter-rx_ring); -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[net-next 01/15] ixgbevf: add support for reporting RSS key and hash table for X550
From: Emil Tantilov emil.s.tanti...@intel.com This patch extends the reporting of the RSS key and hash table by adding support for X550 VFs. The difference is that X550 VFs have their own registers for RSS key and indirection table, so there is no need to query the PF. The RSS key and indirection table are stored in the adapter structure during the configuration of VFRSSRK and VFRETA which in turn can be used in ethtool for reporting. The logic for writing VFRETA is also changed to make sure that the indirection table is reported correctly. In addition this patch adds defines for the VFRETA entries and number of VFRSSRK registers as well as some whitespace cleanups. Reported-by: Vlad Zolotarov vl...@cloudius-systems.com Signed-off-by: Emil Tantilov emil.s.tanti...@intel.com Tested-by: Phil Schmitt phillip.j.schm...@intel.com Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com --- drivers/net/ethernet/intel/ixgbevf/ethtool.c | 51 +-- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 9 +++- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 21 ++ 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c index b2f5b16..d3e5f5b 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c @@ -813,22 +813,15 @@ static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev) { struct ixgbevf_adapter *adapter = netdev_priv(netdev); - /* We support this operation only for 82599 and x540 at the moment */ - if (adapter-hw.mac.type ixgbe_mac_X550_vf) - return IXGBEVF_82599_RETA_SIZE; + if (adapter-hw.mac.type = ixgbe_mac_X550_vf) + return IXGBEVF_X550_VFRETA_SIZE; - return 0; + return IXGBEVF_82599_RETA_SIZE; } static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev) { - struct ixgbevf_adapter *adapter = netdev_priv(netdev); - - /* We support this operation only for 82599 and x540 at the moment */ - if (adapter-hw.mac.type ixgbe_mac_X550_vf) - return IXGBEVF_RSS_HASH_KEY_SIZE; - - return 0; + return IXGBEVF_RSS_HASH_KEY_SIZE; } static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, @@ -840,21 +833,33 @@ static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, if (hfunc) *hfunc = ETH_RSS_HASH_TOP; - /* If neither indirection table nor hash key was requested - just -* return a success avoiding taking any locks. -*/ - if (!indir !key) - return 0; + if (adapter-hw.mac.type = ixgbe_mac_X550_vf) { + if (key) + memcpy(key, adapter-rss_key, sizeof(adapter-rss_key)); - spin_lock_bh(adapter-mbx_lock); - if (indir) - err = ixgbevf_get_reta_locked(adapter-hw, indir, - adapter-num_rx_queues); + if (indir) { + int i; - if (!err key) - err = ixgbevf_get_rss_key_locked(adapter-hw, key); + for (i = 0; i IXGBEVF_X550_VFRETA_SIZE; i++) + indir[i] = adapter-rss_indir_tbl[i]; + } + } else { + /* If neither indirection table nor hash key was requested +* - just return a success avoiding taking any locks. +*/ + if (!indir !key) + return 0; - spin_unlock_bh(adapter-mbx_lock); + spin_lock_bh(adapter-mbx_lock); + if (indir) + err = ixgbevf_get_reta_locked(adapter-hw, indir, + adapter-num_rx_queues); + + if (!err key) + err = ixgbevf_get_rss_key_locked(adapter-hw, key); + + spin_unlock_bh(adapter-mbx_lock); + } return err; } diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h index 775d089..04c7ec8 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h @@ -144,9 +144,11 @@ struct ixgbevf_ring { #define MAX_RX_QUEUES IXGBE_VF_MAX_RX_QUEUES #define MAX_TX_QUEUES IXGBE_VF_MAX_TX_QUEUES -#define IXGBEVF_MAX_RSS_QUEUES 2 -#define IXGBEVF_82599_RETA_SIZE128 +#define IXGBEVF_MAX_RSS_QUEUES 2 +#define IXGBEVF_82599_RETA_SIZE128 /* 128 entries */ +#define IXGBEVF_X550_VFRETA_SIZE 64 /* 64 entries */ #define IXGBEVF_RSS_HASH_KEY_SIZE 40 +#define IXGBEVF_VFRSSRK_REGS 10 /* 10 registers for RSS key */ #define IXGBEVF_DEFAULT_TXD1024 #define IXGBEVF_DEFAULT_RXD512 @@ -447,6 +449,9 @@ struct ixgbevf_adapter { spinlock_t
Re: [PATCH] e1000e: Move e1000e_disable_aspm_locked() inside CONFIG_PM
On Wed, 2015-07-22 at 11:41 +1000, Michael Ellerman wrote: On Wed, 2015-07-15 at 03:30 -0700, Jeff Kirsher wrote: On Tue, 2015-07-14 at 13:54 +1000, Michael Ellerman wrote: e1000e_disable_aspm_locked() is only used in __e1000_resume() which is inside CONFIG_PM. So when CONFIG_PM=n we get a defined but not used warning for e1000e_disable_aspm_locked(). Move it inside the existing CONFIG_PM block to avoid the warning. Signed-off-by: Michael Ellerman m...@ellerman.id.au --- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) NACK, this is already fixed in my next-queue tree. Raanan submitted a patch back on July 6th to resolve this issue, see commit id a75787d2246a93d256061db602f252703559af65 in my dev-queue branch of my next-queue tree. OK. I take it your next-queue is destined for 4.3, so we'll just have to suck on the warning until then? Yes, but I can queue Raanan's patch up for 4.2 (and possibly stable) if necessary. I have no issue with doing that. signature.asc Description: This is a digitally signed message part
Re: [PATCH net-next] route: allow to route in a peer netns via lwt framework
On 7/23/15, 7:22 AM, Nicolas Dichtel wrote: This patch takes advantage of the newly added lwtunnel framework to allow the user to set routes that points to a peer netns. Packets are injected to the peer netns via the loopback device. It works only when the output device is 'lo'. Example: ip route add 40.1.1.1/32 encap netns nsid 5 via dev lo Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com --- drivers/net/loopback.c| 16 + include/net/lwtunnel.h| 23 +++ include/uapi/linux/lwtunnel.h | 1 + net/core/net_namespace.c | 52 +++ 4 files changed, 92 insertions(+) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index c76283c2f84a..758d02f592f9 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -57,6 +57,7 @@ #include linux/percpu.h #include net/net_namespace.h #include linux/u64_stats_sync.h +#include net/lwtunnel.h struct pcpu_lstats { u64 packets; @@ -71,9 +72,23 @@ struct pcpu_lstats { static netdev_tx_t loopback_xmit(struct sk_buff *skb, struct net_device *dev) { + int nsid = skb_lwt_netns_info(skb); struct pcpu_lstats *lb_stats; int len; + if (nsid = 0) { + struct net *peernet = get_net_ns_by_id(dev_net(dev), nsid); + + if (!peernet) { + kfree_skb(skb); + goto end; + } + + dev_forward_skb(peernet-loopback_dev, skb); + put_net(peernet); + goto end; + } + skb_orphan(skb); /* Before queueing this packet to netif_rx(), @@ -94,6 +109,7 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb, u64_stats_update_end(lb_stats-syncp); } +end: return NETDEV_TX_OK; } diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h index 918e03c1dafa..cc05ce3c1aae 100644 --- a/include/net/lwtunnel.h +++ b/include/net/lwtunnel.h @@ -5,7 +5,9 @@ #include linux/netdevice.h #include linux/skbuff.h #include linux/types.h +#include linux/net_namespace.h #include net/route.h +#include net/ip6_fib.h #define LWTUNNEL_HASH_BITS 7 #define LWTUNNEL_HASH_SIZE (1 LWTUNNEL_HASH_BITS) @@ -141,4 +143,25 @@ static inline int lwtunnel_output6(struct sock *sk, struct sk_buff *skb) #endif +static inline u32 *lwt_netns_info(struct lwtunnel_state *lwtstate) +{ + return (u32 *)lwtstate-data; +} + +static inline int skb_lwt_netns_info(struct sk_buff *skb) +{ + if (skb-protocol == htons(ETH_P_IP)) { + struct rtable *rt = (struct rtable *)skb_dst(skb); + + if (rt rt-rt_lwtstate) + return *lwt_netns_info(rt-rt_lwtstate); + } else if (skb-protocol == htons(ETH_P_IPV6)) { + struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); + + if (rt6 rt6-rt6i_lwtstate) + return *lwt_netns_info(rt6-rt6i_lwtstate); + } + + return NETNSA_NSID_NOT_ASSIGNED; +} #endif /* __NET_LWTUNNEL_H */ since these apis' don't have to be netns specific, Can they just be named lwtunnel_get_state_data and skb_lwtunnel_state ? and seems like they should be declared for both CONFIG_LWTUNNEL 'y' and 'n'. Thanks, Roopa -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Patch v2 resend 1/2] net: fec: use managed DMA API functions to allocate BD ring
So it gets freed when the device is going away. This fixes a DMA memory leak on driver probe() fail and driver remove(). Signed-off-by: Lucas Stach l.st...@pengutronix.de --- v2: Fix indentation of second line to fix alignment with opening bracket. --- drivers/net/ethernet/freescale/fec_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 349365d85b92..a7f1bdf718f8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3142,8 +3142,8 @@ static int fec_enet_init(struct net_device *ndev) fep-bufdesc_size; /* Allocate memory for buffer descriptors. */ - cbd_base = dma_alloc_coherent(NULL, bd_size, bd_dma, - GFP_KERNEL); + cbd_base = dmam_alloc_coherent(fep-pdev-dev, bd_size, bd_dma, + GFP_KERNEL); if (!cbd_base) { return -ENOMEM; } -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Patch v2 resend 2/2] net: fec: introduce fec_ptp_stop and use in probe fail path
This function frees resources and cancels delayed work item that have been initialized in fec_ptp_init(). Use this to do proper error handling if something goes wrong in probe function after fec_ptp_init has been called. Signed-off-by: Lucas Stach l.st...@pengutronix.de Acked-by: Fugang Duan b38...@freescale.com --- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 5 ++--- drivers/net/ethernet/freescale/fec_ptp.c | 10 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 1eee73cccdf5..99d33e2d35e6 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -562,6 +562,7 @@ struct fec_enet_private { }; void fec_ptp_init(struct platform_device *pdev); +void fec_ptp_stop(struct platform_device *pdev); void fec_ptp_start_cyclecounter(struct net_device *ndev); int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr); int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr); diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index a7f1bdf718f8..32e3807c650e 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3494,6 +3494,7 @@ failed_register: failed_mii_init: failed_irq: failed_init: + fec_ptp_stop(pdev); if (fep-reg_phy) regulator_disable(fep-reg_phy); failed_regulator: @@ -3515,14 +3516,12 @@ fec_drv_remove(struct platform_device *pdev) struct net_device *ndev = platform_get_drvdata(pdev); struct fec_enet_private *fep = netdev_priv(ndev); - cancel_delayed_work_sync(fep-time_keep); cancel_work_sync(fep-tx_timeout_work); + fec_ptp_stop(pdev); unregister_netdev(ndev); fec_enet_mii_remove(fep); if (fep-reg_phy) regulator_disable(fep-reg_phy); - if (fep-ptp_clock) - ptp_clock_unregister(fep-ptp_clock); of_node_put(fep-phy_node); free_netdev(ndev); diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index a15663ad7f5e..f457a23d0bfb 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -604,6 +604,16 @@ void fec_ptp_init(struct platform_device *pdev) schedule_delayed_work(fep-time_keep, HZ); } +void fec_ptp_stop(struct platform_device *pdev) +{ + struct net_device *ndev = platform_get_drvdata(pdev); + struct fec_enet_private *fep = netdev_priv(ndev); + + cancel_delayed_work_sync(fep-time_keep); + if (fep-ptp_clock) + ptp_clock_unregister(fep-ptp_clock); +} + /** * fec_ptp_check_pps_event * @fep: the fec_enet_private structure handle -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next] route: allow to route in a peer netns via lwt framework
This patch takes advantage of the newly added lwtunnel framework to allow the user to set routes that points to a peer netns. Packets are injected to the peer netns via the loopback device. It works only when the output device is 'lo'. Example: ip route add 40.1.1.1/32 encap netns nsid 5 via dev lo Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com --- drivers/net/loopback.c| 16 + include/net/lwtunnel.h| 23 +++ include/uapi/linux/lwtunnel.h | 1 + net/core/net_namespace.c | 52 +++ 4 files changed, 92 insertions(+) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index c76283c2f84a..758d02f592f9 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -57,6 +57,7 @@ #include linux/percpu.h #include net/net_namespace.h #include linux/u64_stats_sync.h +#include net/lwtunnel.h struct pcpu_lstats { u64 packets; @@ -71,9 +72,23 @@ struct pcpu_lstats { static netdev_tx_t loopback_xmit(struct sk_buff *skb, struct net_device *dev) { + int nsid = skb_lwt_netns_info(skb); struct pcpu_lstats *lb_stats; int len; + if (nsid = 0) { + struct net *peernet = get_net_ns_by_id(dev_net(dev), nsid); + + if (!peernet) { + kfree_skb(skb); + goto end; + } + + dev_forward_skb(peernet-loopback_dev, skb); + put_net(peernet); + goto end; + } + skb_orphan(skb); /* Before queueing this packet to netif_rx(), @@ -94,6 +109,7 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb, u64_stats_update_end(lb_stats-syncp); } +end: return NETDEV_TX_OK; } diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h index 918e03c1dafa..cc05ce3c1aae 100644 --- a/include/net/lwtunnel.h +++ b/include/net/lwtunnel.h @@ -5,7 +5,9 @@ #include linux/netdevice.h #include linux/skbuff.h #include linux/types.h +#include linux/net_namespace.h #include net/route.h +#include net/ip6_fib.h #define LWTUNNEL_HASH_BITS 7 #define LWTUNNEL_HASH_SIZE (1 LWTUNNEL_HASH_BITS) @@ -141,4 +143,25 @@ static inline int lwtunnel_output6(struct sock *sk, struct sk_buff *skb) #endif +static inline u32 *lwt_netns_info(struct lwtunnel_state *lwtstate) +{ + return (u32 *)lwtstate-data; +} + +static inline int skb_lwt_netns_info(struct sk_buff *skb) +{ + if (skb-protocol == htons(ETH_P_IP)) { + struct rtable *rt = (struct rtable *)skb_dst(skb); + + if (rt rt-rt_lwtstate) + return *lwt_netns_info(rt-rt_lwtstate); + } else if (skb-protocol == htons(ETH_P_IPV6)) { + struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); + + if (rt6 rt6-rt6i_lwtstate) + return *lwt_netns_info(rt6-rt6i_lwtstate); + } + + return NETNSA_NSID_NOT_ASSIGNED; +} #endif /* __NET_LWTUNNEL_H */ diff --git a/include/uapi/linux/lwtunnel.h b/include/uapi/linux/lwtunnel.h index 31377bbea3f8..6715e7a1b335 100644 --- a/include/uapi/linux/lwtunnel.h +++ b/include/uapi/linux/lwtunnel.h @@ -7,6 +7,7 @@ enum lwtunnel_encap_types { LWTUNNEL_ENCAP_NONE, LWTUNNEL_ENCAP_MPLS, LWTUNNEL_ENCAP_IP, + LWTUNNEL_ENCAP_NETNS, __LWTUNNEL_ENCAP_MAX, }; diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 2c2eb1b629b1..c1267aac373d 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -20,6 +20,7 @@ #include net/netlink.h #include net/net_namespace.h #include net/netns/generic.h +#include net/lwtunnel.h /* * Our network namespace constructor/destructor lists @@ -725,6 +726,56 @@ out: rtnl_set_sk_err(net, RTNLGRP_NSID, err); } +static int lwt_netns_build_state(struct net_device *dev, struct nlattr *nla, +struct lwtunnel_state **ts) +{ + struct nlattr *tb[NETNSA_MAX + 1]; + struct lwtunnel_state *newts; + int *nsid; + int ret; + + ret = nla_parse_nested(tb, NETNSA_MAX, nla, rtnl_net_policy); + if (ret 0) + return ret; + + if (!tb[NETNSA_NSID]) + return -EINVAL; + + newts = lwtunnel_state_alloc(sizeof(*nsid)); + if (!newts) + return -ENOMEM; + + newts-len = sizeof(*nsid); + nsid = lwt_netns_info(newts); + *nsid = nla_get_s32(tb[NETNSA_NSID]); + newts-type = LWTUNNEL_ENCAP_NETNS; + + *ts = newts; + return 0; +} + +static int lwt_netns_fill_encap_info(struct sk_buff *skb, +struct lwtunnel_state *lwtstate) +{ + int *nsid = lwt_netns_info(lwtstate); + + if (nla_put_s32(skb, NETNSA_NSID, *nsid)) + return -ENOMEM; + + return 0; +} + +static int
Re: [PATCH net-next] route: allow to route in a peer netns via lwt framework
Le 23/07/2015 17:01, roopa a écrit : On 7/23/15, 7:22 AM, Nicolas Dichtel wrote: [snip] +static inline u32 *lwt_netns_info(struct lwtunnel_state *lwtstate) +{ +return (u32 *)lwtstate-data; +} + +static inline int skb_lwt_netns_info(struct sk_buff *skb) +{ +if (skb-protocol == htons(ETH_P_IP)) { +struct rtable *rt = (struct rtable *)skb_dst(skb); + +if (rt rt-rt_lwtstate) +return *lwt_netns_info(rt-rt_lwtstate); +} else if (skb-protocol == htons(ETH_P_IPV6)) { +struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); + +if (rt6 rt6-rt6i_lwtstate) +return *lwt_netns_info(rt6-rt6i_lwtstate); +} + +return NETNSA_NSID_NOT_ASSIGNED; +} #endif /* __NET_LWTUNNEL_H */ since these apis' don't have to be netns specific, Can they just be named lwtunnel_get_state_data and skb_lwtunnel_state ? They are specific to netns because lwtstate-data is interpreted as an u32 *. But I agree that a test is missing against lwtstate-type to ensure that data will be a nsid. and seems like they should be declared for both CONFIG_LWTUNNEL 'y' and 'n'. It is outside the #ifdef CONFIG_LWTUNNEL. I can successfully compile with and without CONFIG_LWTUNNEL. Thank you, Nicolas -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] net: via/Kconfig: GENERIC_PCI_IOMAP required if PCI not selected
2015-07-23 4:35 GMT+03:00 Antonio Borneo borneo.anto...@gmail.com: On Thu, Jul 23, 2015 at 2:08 AM, David Miller da...@davemloft.net wrote: From: Antonio Borneo borneo.anto...@gmail.com Date: Thu, 23 Jul 2015 00:34:14 +0800 - depends on (PCI || OF_IRQ) + depends on (PCI || (OF_IRQ GENERIC_PCI_IOMAP)) Having GENERIC_PCI_IOMAP withut PCI makes absolutely no sense to me. I can't see why a platform would provide GENERIC_PCI_IOMAP when it does not have PCI enabled. My understanding for GENERIC_PCI_IOMAP is to enable providing empty pci_iomap/pci_iounmap. There is also a non-empty implementation that calls to ioremap/iounmap (compiled in when PCI=y). So it's rather an option that every architecture should use if they don't have any special requirements (which seems to be true about SH, too). Maybe a name like MY_ARCH_DOESNT_NEED_ANYTHING_SPECIAL_FROM_PCI_IOMAP instead of GENERIC_PCI_IOMAP would be more reflective of its current semantics, but it doesn't look very pretty anyway :) Digging in git log, arch that used to provide such empty instances moved to a centralized implementation by using GENERIC_PCI_IOMAP. For me such empty functions should be available by default when PCI is not set, but this is not the case today. If we trust the commit message in 97a29d59fc222b36bac3ee3a8ae994f65bf7ffdf it looks like architectures that use their own PCI mapping functions would provide them unconditionally, so we shouldn't unconditionally include stubs in the generic header to avoid double definition. I think the way to fix this most consistently with what other arches do would be to move select GENERIC_PCI_IOMAP from arch/sh/Kconfig outside of config PCI (towards line 40 or so in the same file). This will ensure that all NOP stubs are applied correctly to avoid such compile-time errors. Happy to provide a 2-line patch to do the above, but I don't have any SH hardware to test. Best, Alexey -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] bridge: stp: when using userspace stp stop kernel hello and hold timers
From: Satish Ashok sas...@cumulusnetworks.com Stop the kernel STP hello and hold timers when user-space STP is being used to stop generating both packets. These should be handled only by the respective STP which is in control. Also ensure that when the bridge is up these timers are started only when running with kernel STP. The kernel STP should function as before. Test done using user-space RSTP. Before patch: 14:55:35.043194 52:54:00:28:9d:4c 01:80:c2:00:00:00, 802.3, length 52: LLC, dsap STP (0x42) Individual, ssap STP (0x42) Command, ctrl 0x03: STP 802.1d, Config, Flags [none], bridge-id 8000.52:54:00:28:9d:4c.8001, length 35 message-age 0.00s, max-age 20.00s, hello-time 2.00s, forwarding-delay 15.00s root-id 8000.52:54:00:28:9d:4c, root-pathcost 0 ^^^ Kernel STP. 14:55:35.333807 52:54:00:28:9d:4c 01:80:c2:00:00:00, 802.3, length 53: LLC, dsap STP (0x42) Individual, ssap STP (0x42) Command, ctrl 0x03: STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.52:54:00:28:9d:4c.8001, length 36 message-age 0.00s, max-age 20.00s, hello-time 3.00s, forwarding-delay 15.00s root-id 8000.52:54:00:28:9d:4c, root-pathcost 0, port-role Designated ^^^ User-space STP (rstpd, configured with 3s hello-time) After patch: 15:02:31.821511 52:54:00:28:9d:4c 01:80:c2:00:00:00, 802.3, length 52: LLC, dsap STP (0x42) Individual, ssap STP (0x42) Command, ctrl 0x03: STP 802.1d, Config, Flags [Topology change], bridge-id 8000.52:54:00:28:9d:4c.8002, length 35 message-age 0.00s, max-age 20.00s, hello-time 3.00s, forwarding-delay 15.00s root-id 8000.52:54:00:28:9d:4c, root-pathcost 0 15:02:34.821819 52:54:00:28:9d:4c 01:80:c2:00:00:00, 802.3, length 52: LLC, dsap STP (0x42) Individual, ssap STP (0x42) Command, ctrl 0x03: STP 802.1d, Config, Flags [Topology change], bridge-id 8000.52:54:00:28:9d:4c.8002, length 35 message-age 0.00s, max-age 20.00s, hello-time 3.00s, forwarding-delay 15.00s root-id 8000.52:54:00:28:9d:4c, root-pathcost 0 ^ Only user-space STP. Signed-off-by: Satish Ashok sas...@cumulusnetworks.com Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com --- net/bridge/br_stp.c | 5 +++-- net/bridge/br_stp_if.c| 15 ++- net/bridge/br_stp_timer.c | 4 +++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index b4b6dab9c285..ed74ffaa851f 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c @@ -209,8 +209,9 @@ void br_transmit_config(struct net_bridge_port *p) br_send_config_bpdu(p, bpdu); p-topology_change_ack = 0; p-config_pending = 0; - mod_timer(p-hold_timer, - round_jiffies(jiffies + BR_HOLD_TIME)); + if (p-br-stp_enabled == BR_KERNEL_STP) + mod_timer(p-hold_timer, + round_jiffies(jiffies + BR_HOLD_TIME)); } } diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index a2730e7196cd..962a149b117a 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c @@ -48,7 +48,8 @@ void br_stp_enable_bridge(struct net_bridge *br) struct net_bridge_port *p; spin_lock_bh(br-lock); - mod_timer(br-hello_timer, jiffies + br-hello_time); + if (br-stp_enabled == BR_KERNEL_STP) + mod_timer(br-hello_timer, jiffies + br-hello_time); mod_timer(br-gc_timer, jiffies + HZ/10); br_config_bpdu_generation(br); @@ -127,6 +128,7 @@ static void br_stp_start(struct net_bridge *br) int r; char *argv[] = { BR_STP_PROG, br-dev-name, start, NULL }; char *envp[] = { NULL }; + struct net_bridge_port *p; r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC); @@ -140,6 +142,12 @@ static void br_stp_start(struct net_bridge *br) if (r == 0) { br-stp_enabled = BR_USER_STP; br_debug(br, userspace STP started\n); + /* Stop hello and hold timer */ + spin_lock_bh(br-lock); + del_timer(br-hello_timer); + list_for_each_entry(p, br-port_list, list) + del_timer(p-hold_timer); + spin_unlock_bh(br-lock); } else { br-stp_enabled = BR_KERNEL_STP; br_debug(br, using kernel STP\n); @@ -156,12 +164,17 @@ static void br_stp_stop(struct net_bridge *br) int r; char *argv[] = { BR_STP_PROG, br-dev-name, stop, NULL }; char *envp[] = { NULL }; + struct net_bridge_port *p; if (br-stp_enabled == BR_USER_STP) { r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC); br_info(br, userspace STP stopped, return code %d\n, r); /* To start timers on any ports left in blocking */ + mod_timer(br-hello_timer, jiffies + br-hello_time); +
pull request: bluetooth 2015-07-23
Hi Dave, Here's another one-patch pull request for 4.2 which targets a potential NULL pointer dereference in the LE Security Manager code that can be triggered by using older user space tools. The issue has been there since 4.0 so there's the appropriate Cc: stable in place. Let me know if there are any issues pulling. Thanks. Johan --- The following changes since commit c5dfd654d0ec0a28fe81e7bd4d4fd984a9855e09: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2015-07-22 14:45:25 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git for-upstream for you to fetch changes up to 25ba265390c09b0a2b2f3fd9ba82e37248b7a371: Bluetooth: Fix NULL pointer dereference in smp_conn_security (2015-07-23 16:41:24 +0200) Johan Hedberg (1): Bluetooth: Fix NULL pointer dereference in smp_conn_security net/bluetooth/smp.c | 4 1 file changed, 4 insertions(+) pgpzubXBpONK9.pgp Description: PGP signature
[patch net-next 4/4] mlxsw: Introduce Mellanox SwitchX-2 ASIC support
From: Jiri Pirko j...@mellanox.com Benefit from the previously introduced Mellanox Switch infrastructure and add driver for SwitchX-2 ASIC. Note that this driver is very simple now. It implements bare minimum for getting device to work on slow-path. Fast-path offload functionality is going to be added soon. Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- drivers/net/ethernet/mellanox/mlxsw/Kconfig| 11 + drivers/net/ethernet/mellanox/mlxsw/Makefile |2 + drivers/net/ethernet/mellanox/mlxsw/core.h |2 + drivers/net/ethernet/mellanox/mlxsw/pci.c |3 + drivers/net/ethernet/mellanox/mlxsw/pci.h |1 + drivers/net/ethernet/mellanox/mlxsw/port.h |4 + drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 1541 drivers/net/ethernet/mellanox/mlxsw/txheader.h | 80 ++ 8 files changed, 1644 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/switchx2.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/txheader.h diff --git a/drivers/net/ethernet/mellanox/mlxsw/Kconfig b/drivers/net/ethernet/mellanox/mlxsw/Kconfig index 1385f2c..8d1080d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/Kconfig +++ b/drivers/net/ethernet/mellanox/mlxsw/Kconfig @@ -19,3 +19,14 @@ config MLXSW_PCI To compile this driver as a module, choose M here: the module will be called mlxsw_pci. + +config MLXSW_SWITCHX2 + tristate Mellanox Technologies SwitchX-2 support + depends on MLXSW_CORE NET_SWITCHDEV + default m + ---help--- + This driver supports Mellanox Technologies SwitchX-2 Ethernet + Switch ASICs. + + To compile this driver as a module, choose M here: the + module will be called mlxsw_switchx2. diff --git a/drivers/net/ethernet/mellanox/mlxsw/Makefile b/drivers/net/ethernet/mellanox/mlxsw/Makefile index 94841c3..0a05f65 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/Makefile +++ b/drivers/net/ethernet/mellanox/mlxsw/Makefile @@ -2,3 +2,5 @@ obj-$(CONFIG_MLXSW_CORE)+= mlxsw_core.o mlxsw_core-objs:= core.o obj-$(CONFIG_MLXSW_PCI)+= mlxsw_pci.o mlxsw_pci-objs := pci.o +obj-$(CONFIG_MLXSW_SWITCHX2) += mlxsw_switchx2.o +mlxsw_switchx2-objs:= switchx2.o diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index b6c11d2..fbc94da 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -53,6 +53,8 @@ #define MODULE_MLXSW_DRIVER_ALIAS(kind)\ MODULE_ALIAS(MLXSW_MODULE_ALIAS_PREFIX kind) +#define MLXSW_DEVICE_KIND_SWITCHX2 switchx2 + struct mlxsw_core; struct mlxsw_driver; struct mlxsw_bus; diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index 8371e08..de8ff32 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -55,6 +55,7 @@ static const char mlxsw_pci_driver_name[] = mlxsw_pci; static const struct pci_device_id mlxsw_pci_id_table[] = { + {PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_SWITCHX2), 0}, {0, } }; @@ -63,6 +64,8 @@ static struct dentry *mlxsw_pci_dbg_root; static const char *mlxsw_pci_device_kind_get(const struct pci_device_id *id) { switch (id-device) { + case PCI_DEVICE_ID_MELLANOX_SWITCHX2: + return MLXSW_DEVICE_KIND_SWITCHX2; default: BUG(); } diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.h b/drivers/net/ethernet/mellanox/mlxsw/pci.h index 6176a93..887af84 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.h +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.h @@ -39,6 +39,7 @@ #include item.h +#define PCI_DEVICE_ID_MELLANOX_SWITCHX20xc738 #define MLXSW_PCI_BAR0_SIZE(1024 * 1024) /* 1MB */ #define MLXSW_PCI_PAGE_SIZE4096 diff --git a/drivers/net/ethernet/mellanox/mlxsw/port.h b/drivers/net/ethernet/mellanox/mlxsw/port.h index e626231..795b21c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/port.h +++ b/drivers/net/ethernet/mellanox/mlxsw/port.h @@ -51,6 +51,10 @@ #define MLXSW_PORT_MAX_PHY_PORTS 0x40 #define MLXSW_PORT_MAX_PORTS MLXSW_PORT_MAX_PHY_PORTS +#define MLXSW_PORT_DEVID_BITS_OFFSET 10 +#define MLXSW_PORT_PHY_BITS_OFFSET 4 +#define MLXSW_PORT_PHY_BITS_MASK (MLXSW_PORT_MAX_PHY_PORTS - 1) + #define MLXSW_PORT_CPU_PORT0x0 enum mlxsw_port_admin_status { diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c new file mode 100644 index 000..15dc53b --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c @@ -0,0 +1,1541 @@ +/* + * drivers/net/ethernet/mellanox/mlxsw/switchx2.c + * Copyright (c) 2015 Mellanox
[patch net-next 2/4] mlxsw: Add PCI bus implementation
From: Jiri Pirko j...@mellanox.com Add PCI bus implementation for Mellanox Technologies Switch ASICs. This includes firmware initialization, async queues manipulation and command interface implementation. Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 10 + drivers/net/ethernet/mellanox/mlxsw/Makefile |2 + drivers/net/ethernet/mellanox/mlxsw/pci.c| 1786 ++ drivers/net/ethernet/mellanox/mlxsw/pci.h| 220 4 files changed, 2018 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/pci.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/pci.h diff --git a/drivers/net/ethernet/mellanox/mlxsw/Kconfig b/drivers/net/ethernet/mellanox/mlxsw/Kconfig index 46268f2..1385f2c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/Kconfig +++ b/drivers/net/ethernet/mellanox/mlxsw/Kconfig @@ -9,3 +9,13 @@ config MLXSW_CORE To compile this driver as a module, choose M here: the module will be called mlxsw_core. + +config MLXSW_PCI + tristate PCI bus implementation for Mellanox Technologies Switch ASICs + depends on PCI MLXSW_CORE + default m + ---help--- + This is PCI bus implementation for Mellanox Technologies Switch ASICs. + + To compile this driver as a module, choose M here: the + module will be called mlxsw_pci. diff --git a/drivers/net/ethernet/mellanox/mlxsw/Makefile b/drivers/net/ethernet/mellanox/mlxsw/Makefile index 271de28..94841c3 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/Makefile +++ b/drivers/net/ethernet/mellanox/mlxsw/Makefile @@ -1,2 +1,4 @@ obj-$(CONFIG_MLXSW_CORE) += mlxsw_core.o mlxsw_core-objs:= core.o +obj-$(CONFIG_MLXSW_PCI)+= mlxsw_pci.o +mlxsw_pci-objs := pci.o diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c new file mode 100644 index 000..8371e08 --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -0,0 +1,1786 @@ +/* + * drivers/net/ethernet/mellanox/mlxsw/pci.c + * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015 Jiri Pirko j...@mellanox.com + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + *contributors may be used to endorse or promote products derived from + *this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License (GPL) version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/export.h +#include linux/err.h +#include linux/device.h +#include linux/pci.h +#include linux/interrupt.h +#include linux/wait.h +#include linux/types.h +#include linux/skbuff.h +#include linux/if_vlan.h +#include linux/log2.h +#include linux/debugfs.h +#include linux/seq_file.h + +#include pci.h +#include core.h +#include cmd.h +#include port.h + +static const char mlxsw_pci_driver_name[] = mlxsw_pci; + +static const struct pci_device_id mlxsw_pci_id_table[] = { + {0, } +}; + +static struct dentry *mlxsw_pci_dbg_root; + +static const char *mlxsw_pci_device_kind_get(const struct pci_device_id *id) +{ + switch (id-device) { + default: + BUG(); + } +} + +#define mlxsw_pci_write32(mlxsw_pci, reg, val) \ + iowrite32be(val, (mlxsw_pci)-hw_addr + (MLXSW_PCI_ ## reg)) +#define mlxsw_pci_read32(mlxsw_pci, reg) \ +
[patch net-next 1/4] mlxsw: Introduce Mellanox switch driver core
From: Jiri Pirko j...@mellanox.com Add core components of Mellanox switch driver infrastructure. Core infrastructure is designed so that it can be used by multiple bus drivers (PCI now, I2C and SGMII are planned to be implemented in the future). Multiple switch kind drivers can be registered as well. This core serves as a glue between buses and drivers. Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- MAINTAINERS |9 + drivers/net/ethernet/mellanox/Kconfig|1 + drivers/net/ethernet/mellanox/Makefile |1 + drivers/net/ethernet/mellanox/mlxsw/Kconfig | 11 + drivers/net/ethernet/mellanox/mlxsw/Makefile |2 + drivers/net/ethernet/mellanox/mlxsw/cmd.h| 1090 ++ drivers/net/ethernet/mellanox/mlxsw/core.c | 551 + drivers/net/ethernet/mellanox/mlxsw/core.h | 180 + drivers/net/ethernet/mellanox/mlxsw/item.h | 405 ++ drivers/net/ethernet/mellanox/mlxsw/port.h | 50 ++ drivers/net/ethernet/mellanox/mlxsw/trap.h | 68 ++ 11 files changed, 2368 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/Kconfig create mode 100644 drivers/net/ethernet/mellanox/mlxsw/Makefile create mode 100644 drivers/net/ethernet/mellanox/mlxsw/cmd.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/core.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/core.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/item.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/port.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/trap.h diff --git a/MAINTAINERS b/MAINTAINERS index a226416..da41267 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6645,6 +6645,15 @@ W: http://www.mellanox.com Q: http://patchwork.ozlabs.org/project/netdev/list/ F: drivers/net/ethernet/mellanox/mlx4/en_* +MELLANOX ETHERNET SWITCH DRIVERS +M: Jiri Pirko j...@mellanox.com +M: Ido Schimmel ido...@mellanox.com +L: netdev@vger.kernel.org +S: Supported +W: http://www.mellanox.com +Q: http://patchwork.ozlabs.org/project/netdev/list/ +F: drivers/net/ethernet/mellanox/mlxsw/ + MEMORY MANAGEMENT L: linux...@kvack.org W: http://www.linux-mm.org diff --git a/drivers/net/ethernet/mellanox/Kconfig b/drivers/net/ethernet/mellanox/Kconfig index 52a6665..d547010 100644 --- a/drivers/net/ethernet/mellanox/Kconfig +++ b/drivers/net/ethernet/mellanox/Kconfig @@ -18,5 +18,6 @@ if NET_VENDOR_MELLANOX source drivers/net/ethernet/mellanox/mlx4/Kconfig source drivers/net/ethernet/mellanox/mlx5/core/Kconfig +source drivers/net/ethernet/mellanox/mlxsw/Kconfig endif # NET_VENDOR_MELLANOX diff --git a/drivers/net/ethernet/mellanox/Makefile b/drivers/net/ethernet/mellanox/Makefile index 38fe32ef..2e2a5ec 100644 --- a/drivers/net/ethernet/mellanox/Makefile +++ b/drivers/net/ethernet/mellanox/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_MLX4_CORE) += mlx4/ obj-$(CONFIG_MLX5_CORE) += mlx5/core/ +obj-$(CONFIG_MLXSW_CORE) += mlxsw/ diff --git a/drivers/net/ethernet/mellanox/mlxsw/Kconfig b/drivers/net/ethernet/mellanox/mlxsw/Kconfig new file mode 100644 index 000..46268f2 --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/Kconfig @@ -0,0 +1,11 @@ +# +# Mellanox switch drivers configuration +# + +config MLXSW_CORE + tristate Mellanox Technologies Switch ASICs support + ---help--- + This driver supports Mellanox Technologies Switch ASICs family. + + To compile this driver as a module, choose M here: the + module will be called mlxsw_core. diff --git a/drivers/net/ethernet/mellanox/mlxsw/Makefile b/drivers/net/ethernet/mellanox/mlxsw/Makefile new file mode 100644 index 000..271de28 --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_MLXSW_CORE) += mlxsw_core.o +mlxsw_core-objs:= core.o diff --git a/drivers/net/ethernet/mellanox/mlxsw/cmd.h b/drivers/net/ethernet/mellanox/mlxsw/cmd.h new file mode 100644 index 000..770db17 --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/cmd.h @@ -0,0 +1,1090 @@ +/* + * drivers/net/ethernet/mellanox/mlxsw/cmd.h + * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015 Jiri Pirko j...@mellanox.com + * Copyright (c) 2015 Ido Schimmel ido...@mellanox.com + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3.
[patch net-next 0/4] Introduce Mellanox Technologies Switch ASICs switchdev drivers
This patchset introduces Mellanox Technologies Switch driver infrastructure and support for SwitchX-2 ASIC. The driver is divided into 3 logical parts: 1) Bus - implements switch bus interface. Currently only PCI bus is implemented, but more buses will be added in the future. Namely I2C and SGMII. (patch #2) 2) Driver - implemements of ASIC-specific functions. Currently SwitchX-2 ASIC is supported, but a plan exists to introduce support for Spectrum ASIC in the near future. (patch #4) 3) Core - infrastructure that glues buses and drivers together. It implements register access logic (EMADs) and takes care of RX traps and events. (patch #1 and #3) Ido Schimmel (1): mlxsw: Add interface to access registers and process events Jiri Pirko (3): mlxsw: Introduce Mellanox switch driver core mlxsw: Add PCI bus implementation mlxsw: Introduce Mellanox SwitchX-2 ASIC support MAINTAINERS|9 + drivers/net/ethernet/mellanox/Kconfig |1 + drivers/net/ethernet/mellanox/Makefile |1 + drivers/net/ethernet/mellanox/mlxsw/Kconfig| 32 + drivers/net/ethernet/mellanox/mlxsw/Makefile |6 + drivers/net/ethernet/mellanox/mlxsw/cmd.h | 1090 +++ drivers/net/ethernet/mellanox/mlxsw/core.c | 1287 + drivers/net/ethernet/mellanox/mlxsw/core.h | 203 +++ drivers/net/ethernet/mellanox/mlxsw/emad.h | 127 ++ drivers/net/ethernet/mellanox/mlxsw/item.h | 405 ++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 1789 drivers/net/ethernet/mellanox/mlxsw/pci.h | 221 +++ drivers/net/ethernet/mellanox/mlxsw/port.h | 73 + drivers/net/ethernet/mellanox/mlxsw/reg.h | 1289 + drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 1541 drivers/net/ethernet/mellanox/mlxsw/trap.h | 68 + drivers/net/ethernet/mellanox/mlxsw/txheader.h | 80 ++ 17 files changed, 8222 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/Kconfig create mode 100644 drivers/net/ethernet/mellanox/mlxsw/Makefile create mode 100644 drivers/net/ethernet/mellanox/mlxsw/cmd.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/core.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/core.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/emad.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/item.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/pci.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/pci.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/port.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/reg.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/switchx2.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/trap.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/txheader.h -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next] route: allow to route in a peer netns via lwt framework
On 7/23/15, 8:25 AM, Nicolas Dichtel wrote: Le 23/07/2015 17:01, roopa a écrit : On 7/23/15, 7:22 AM, Nicolas Dichtel wrote: [snip] +static inline u32 *lwt_netns_info(struct lwtunnel_state *lwtstate) +{ +return (u32 *)lwtstate-data; +} + +static inline int skb_lwt_netns_info(struct sk_buff *skb) +{ +if (skb-protocol == htons(ETH_P_IP)) { +struct rtable *rt = (struct rtable *)skb_dst(skb); + +if (rt rt-rt_lwtstate) +return *lwt_netns_info(rt-rt_lwtstate); +} else if (skb-protocol == htons(ETH_P_IPV6)) { +struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); + +if (rt6 rt6-rt6i_lwtstate) +return *lwt_netns_info(rt6-rt6i_lwtstate); +} + +return NETNSA_NSID_NOT_ASSIGNED; +} #endif /* __NET_LWTUNNEL_H */ since these apis' don't have to be netns specific, Can they just be named lwtunnel_get_state_data and skb_lwtunnel_state ? They are specific to netns because lwtstate-data is interpreted as an u32 *. But I agree that a test is missing against lwtstate-type to ensure that data will be a nsid. o ok..., the api's in lwtunnel.h today are not specific to an encap type. they are generic, so skb_lwtunnel_state() which returns struct lwtunnel_state could go here. the encap specific ones can go in the respective callers. Recently thomas added a similar skb_tunnel_info() for ip tunnels. I did like to have a generic version of your skb_lwt_netns_info in lwtunnel.h. I could use it in my mpls output func too. and seems like they should be declared for both CONFIG_LWTUNNEL 'y' and 'n'. It is outside the #ifdef CONFIG_LWTUNNEL. I can successfully compile with and without CONFIG_LWTUNNEL. ok, thanks, Roopa -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH net 2/3] r8152: fix remote wakeup
Oliver Neukum [mailto:oneu...@suse.com] [...] If the device does not support remote wakeup and the driver enables it, runtime power management will be switched off. That is the current state and it means that devices which don't support remote wakeup cannot do runtime power management at all. But the driver is correct. The only time a device that doesn't support remote wakeup can do runtime power managent is when no packets can be received that is while the interface is down. If you want to allow that you must not set needs_remote_wakeup in probe(), but you must set it in open() because it is necessary for runtime power management as I explained above. Sorry for the length of this mail, but I wanted to make sure I am absolutely clear this time. Thanks for you explanation. I focus on the wrong point. You mean this would cause the problem for runtime suspend. I would rethink my method and correct it. Best Regards, Hayes
RE: [v3, 2/9] fsl/fman: Add the FMan port FLIB
Regards, Igal Liberman. -Original Message- From: Stephen Hemminger [mailto:step...@networkplumber.org] Sent: Wednesday, July 22, 2015 7:56 PM To: Liberman Igal-B31950 Cc: netdev@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux- ker...@vger.kernel.org; Wood Scott-B07421; Bucur Madalin-Cristian-B32716; pebo...@tiscali.nl; joakim.tjernl...@transmode.se; p...@mindchasers.com Subject: Re: [v3, 2/9] fsl/fman: Add the FMan port FLIB On Wed, 22 Jul 2015 14:21:48 +0300 igal.liber...@freescale.com wrote: diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + Bogus blank line introduced at end of file? Why was this not in patch 1? It was added during the patch splitting. I'll fix that in the next submission, thank you for noticing. Igal. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] bridge: stp: when using userspace stp stop kernel hello and hold timers
On Thu, 23 Jul 2015 09:07:37 -0700 Nikolay Aleksandrov niko...@cumulusnetworks.com wrote: + /* Stop hello and hold timer */ + spin_lock_bh(br-lock); + del_timer(br-hello_timer); + list_for_each_entry(p, br-port_list, list) + del_timer(p-hold_timer); + spin_unlock_bh(br-lock); Wouldn't it be easier to use del_timer_sync here? -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PULL v2] virtio/vhost: fixes for 4.2
Really same as previous pull, but as a problem was found in that one, I rebased and fixed. The following changes since commit 59a5b0f7bf74f88da6670bcbf924d8cc1e75b1ee: virtio-pci: alloc only resources actually used. (2015-06-24 08:15:09 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus for you to fetch changes up to c9ce42f72fd0ba180fd35539829e4139dca31494: vhost: add max_mem_regions module parameter (2015-07-13 23:17:19 +0300) virtio/vhost: fixes for 4.2 Bugfixes and documentation fixes. Igor's patch that allows users to tweak memory table size is borderline, but it does fix known crashes, so I merged it. Signed-off-by: Michael S. Tsirkin m...@redhat.com Cornelia Huck (2): MAINTAINERS: separate section for s390 virtio drivers virtio/s390: rename drivers/s390/kvm - drivers/s390/virtio Igor Mammedov (3): vhost: use binary search instead of linear in find_region() vhost: extend memory regions allocation to vmalloc vhost: add max_mem_regions module parameter Michael S. Tsirkin (2): virtio_net: document VIRTIO_NET_CTRL_GUEST_OFFLOADS virtio: define virtio_pci_cfg_cap in header. Pierre Morel (1): 9p/trans_virtio: reset virtio device on remove Stephen Rothwell (1): virtio scsi: fix unused variable warning Thomas Huth (1): virtio: Fix typecast of pointer in vring_init() include/uapi/linux/virtio_net.h | 16 include/uapi/linux/virtio_pci.h | 6 +++ include/uapi/linux/virtio_ring.h | 5 ++- drivers/s390/{kvm = virtio}/kvm_virtio.c | 0 drivers/s390/{kvm = virtio}/virtio_ccw.c | 0 drivers/scsi/virtio_scsi.c| 4 +- drivers/vhost/vhost.c | 67 +++ net/9p/trans_virtio.c | 1 + MAINTAINERS | 10 - drivers/s390/Makefile | 2 +- drivers/s390/{kvm = virtio}/Makefile | 0 11 files changed, 91 insertions(+), 20 deletions(-) rename drivers/s390/{kvm = virtio}/kvm_virtio.c (100%) rename drivers/s390/{kvm = virtio}/virtio_ccw.c (100%) rename drivers/s390/{kvm = virtio}/Makefile (100%) -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net] bridge: stp: when using userspace stp stop kernel hello and hold timers
On Thu, 23 Jul 2015 19:05:56 +0200 Nikolay Aleksandrov niko...@cumulusnetworks.com wrote: On 07/23/2015 06:59 PM, Stephen Hemminger wrote: On Thu, 23 Jul 2015 09:07:37 -0700 Nikolay Aleksandrov niko...@cumulusnetworks.com wrote: + /* Stop hello and hold timer */ + spin_lock_bh(br-lock); + del_timer(br-hello_timer); + list_for_each_entry(p, br-port_list, list) + del_timer(p-hold_timer); + spin_unlock_bh(br-lock); Wouldn't it be easier to use del_timer_sync here? I think it should work. Also I have an error in the commit message about the kernel BPDU sending which I need to correct. I'll prepare a v2 with your suggestion and fixed commit message. The one thing to watch out for with del_timer_sync is that the timer routine and the caller can't be using the same lock otherwise timer will be spinning waiting to get lock that is held by caller who is waiting for timer. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch net-next 4/4] mlxsw: Introduce Mellanox SwitchX-2 ASIC support
On 07/23/2015 08:43 AM, Jiri Pirko wrote: From: Jiri Pirko j...@mellanox.com Benefit from the previously introduced Mellanox Switch infrastructure and add driver for SwitchX-2 ASIC. Note that this driver is very simple now. It implements bare minimum for getting device to work on slow-path. Fast-path offload functionality is going to be added soon. Signed-off-by: Jiri Pirko j...@mellanox.com Signed-off-by: Ido Schimmel ido...@mellanox.com Signed-off-by: Elad Raz el...@mellanox.com --- drivers/net/ethernet/mellanox/mlxsw/Kconfig| 11 + drivers/net/ethernet/mellanox/mlxsw/Makefile |2 + drivers/net/ethernet/mellanox/mlxsw/core.h |2 + drivers/net/ethernet/mellanox/mlxsw/pci.c |3 + drivers/net/ethernet/mellanox/mlxsw/pci.h |1 + drivers/net/ethernet/mellanox/mlxsw/port.h |4 + drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 1541 drivers/net/ethernet/mellanox/mlxsw/txheader.h | 80 ++ 8 files changed, 1644 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/switchx2.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/txheader.h snip diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c new file mode 100644 index 000..15dc53b --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c @@ -0,0 +1,1541 @@ +/* + * drivers/net/ethernet/mellanox/mlxsw/switchx2.c + * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015 Jiri Pirko j...@mellanox.com + * Copyright (c) 2015 Ido Schimmel ido...@mellanox.com + * Copyright (c) 2015 Elad Raz el...@mellanox.com + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + *contributors may be used to endorse or promote products derived from + *this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License (GPL) version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/types.h +#include linux/netdevice.h +#include linux/etherdevice.h +#include linux/slab.h +#include linux/device.h +#include linux/skbuff.h +#include linux/if_vlan.h +#include net/switchdev.h +#include generated/utsrelease.h + +#include core.h +#include reg.h +#include port.h +#include trap.h +#include txheader.h + +static const char mlxsw_sx_driver_name[] = mlxsw_switchx2; +static const char mlxsw_sx_driver_version[] = 1.0; + +struct mlxsw_sx_port; + +#define MLXSW_SW_HW_ID_LEN 6 + +struct mlxsw_sx { + struct mlxsw_sx_port **ports; + struct mlxsw_core *core; + const struct mlxsw_bus_info *bus_info; + u8 hw_id[MLXSW_SW_HW_ID_LEN]; +}; + +struct mlxsw_sx_port_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; + u32 tx_dropped; +}; + It seems like this is the second time I have seen someone have to invent a new pcpu stats to add tx_dropped. Maybe you should look at adding tx_dropped to pcpu_sw_netstats and just use that. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html