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 0000000..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  http://vger.kernel.org/majordomo-info.html

Reply via email to