ixgbe: this patch adds support for DCB to the kernel and ixgbe driver
Subsystems (2)
PATCH 1/6 ixgbe: this patch adds support for DCB to the kernel and ixgbe driver
From: Alexander Duyck <[email protected]>
Signed-off-by Alexander Duyck <[email protected]>
Signed-off-by Jeff Kirsher <[email protected]>
---
drivers/net/ixgbe/Makefile | 3 drivers/net/ixgbe/ixgbe.h | 26 + drivers/net/ixgbe/ixgbe_dcb.c | 332 +++++++++++++++++ drivers/net/ixgbe/ixgbe_dcb.h | 158 ++++++++ drivers/net/ixgbe/ixgbe_dcb_82598.c | 398 ++++++++++++++++++++ drivers/net/ixgbe/ixgbe_dcb_82598.h | 94 +++++ drivers/net/ixgbe/ixgbe_dcb_nl.c | 352 ++++++++++++++++++ drivers/net/ixgbe/ixgbe_ethtool.c | 37 ++ drivers/net/ixgbe/ixgbe_main.c | 189 +++++++++- include/linux/dcbnl.h | 230 ++++++++++++ include/linux/netdevice.h | 8 include/linux/rtnetlink.h | 5 include/net/dcbnl.h | 44 ++ net/Kconfig | 1 net/Makefile | 3 net/dcb/Kconfig | 12 + net/dcb/Makefile | 1 net/dcb/dcbnl.c | 682 +++++++++++++++++++++++++++++++++++ 18 files changed, 2555 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ixgbe/ixgbe_dcb.c create mode 100644 drivers/net/ixgbe/ixgbe_dcb.h create mode 100644 drivers/net/ixgbe/ixgbe_dcb_82598.c create mode 100644 drivers/net/ixgbe/ixgbe_dcb_82598.h create mode 100644 drivers/net/ixgbe/ixgbe_dcb_nl.c create mode 100644 include/linux/dcbnl.h create mode 100644 include/net/dcbnl.h create mode 100644 net/dcb/Kconfig create mode 100644 net/dcb/Makefile create mode 100644 net/dcb/dcbnl.c
drivers/net/ixgbe/Makefile +2 -1
@@ -33,4 +33,5 @@ obj-$(CONFIG_IXGBE) += ixgbe.o ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \ - ixgbe_82598.o ixgbe_phy.o + ixgbe_82598.o ixgbe_phy.o ixgbe_dcb.o ixgbe_dcb_82598.o \ + ixgbe_dcb_nl.o
drivers/net/ixgbe/ixgbe.h +24 -2
@@ -35,6 +35,7 @@#include "ixgbe_type.h" #include "ixgbe_common.h" +#include "ixgbe_dcb.h" #if defined(CONFIG_DCA ) || defined(CONFIG_DCA_MODULE )#include <linux/dca.h>
@@ -84,6 +85,7 @@#define IXGBE_TX_FLAGS_TSO (u32)(1 << 2)#define IXGBE_TX_FLAGS_IPV4 (u32)(1 << 3)#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000 +#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000#define IXGBE_TX_FLAGS_VLAN_SHIFT 16#define IXGBE_MAX_LRO_DESCRIPTORS 8
@@ -134,7 +136,7 @@ struct ixgbe_ring {u16 reg_idx;/* holds the special value that gets the hardware register * offset associated with this ring, which is different -* for DCE and RSS modes */ +* for DCB and RSS modes */ #if defined(CONFIG_DCA ) || defined(CONFIG_DCA_MODULE )/* cpu for tx queue */
@@ -152,8 +154,10 @@ struct ixgbe_ring {u16 rx_buf_len; }; +#define RING_F_DCB 0#define RING_F_VMDQ 1#define RING_F_RSS 2 +#define IXGBE_MAX_DCB_INDICES 8#define IXGBE_MAX_RSS_INDICES 16#define IXGBE_MAX_VMDQ_INDICES 16struct ixgbe_ring_feature {
@@ -164,6 +168,10 @@ struct ixgbe_ring_feature {#define MAX_RX_QUEUES 64#define MAX_TX_QUEUES 32 +#define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \ + ? 8 : 1) +#define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS +/* MAX_MSIX_Q_VECTORS of these are allocated, * but we only use one per queue-specific vector. */
@@ -215,6 +223,9 @@ struct ixgbe_adapter {struct work_struct reset_task;struct ixgbe_q_vector q_vector[MAX_MSIX_Q_VECTORS ];char name[MAX_MSIX_COUNT ][IFNAMSIZ +5 ]; +struct ixgbe_dcb_config dcb_cfg; +struct ixgbe_dcb_config temp_dcb_cfg; +u8 dcb_set_bitmap;/* Interrupt Throttle Rate */ u32 itr_setting;
@@ -269,6 +280,7 @@ struct ixgbe_adapter {#define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19)#define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22)#define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1 << 23) +#define IXGBE_FLAG_DCB_ENABLED (u32)(1 << 24)/* default to trying for four seconds */ #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ)
@@ -312,6 +324,13 @@ enum ixgbe_boards { };extern struct ixgbe_info ixgbe_82598_info; +#ifdef CONFIG_DCBNL +extern struct dcbnl_rtnl_ops dcbnl_ops; +extern int ixgbe_copy_dcb_cfg (struct ixgbe_dcb_config *src_dcb_cfg, +struct ixgbe_dcb_config *dst_dcb_cfg,int tc_max); +#endif + +extern char ixgbe_driver_name[];extern const char ixgbe_driver_version[];
@@ -326,5 +345,8 @@ extern int ixgbe_setup_tx_resources(struct ixgbe_adapter *, struct ixgbe_ring *)extern void ixgbe_free_rx_resources (struct ixgbe_adapter *,struct ixgbe_ring *);extern void ixgbe_free_tx_resources (struct ixgbe_adapter *,struct ixgbe_ring *);extern void ixgbe_update_stats (struct ixgbe_adapter *adapter); - +extern void ixgbe_reset_interrupt_capability (struct ixgbe_adapter *adapter); +extern int ixgbe_init_interrupt_scheme (struct ixgbe_adapter *adapter); +void ixgbe_napi_add_all (struct ixgbe_adapter *adapter); +void ixgbe_napi_del_all (struct ixgbe_adapter *adapter);#endif /* _IXGBE_H_ */
drivers/net/ixgbe/ixgbe_dcb.c new file +332 -0
332 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_dcb.h new file +158 -0
158 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_dcb_82598.c new file +398 -0
398 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_dcb_82598.h new file +94 -0
94 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_dcb_nl.c new file +352 -0
352 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethtool.c +35 -2
@@ -97,9 +97,18 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = { ((((struct ixgbe_adapter *)netdev->priv)->num_tx_queues + \ ((struct ixgbe_adapter *)netdev->priv)->num_rx_queues) * \ (sizeof(struct ixgbe_queue_stats) / sizeof(u64))) -#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN)#define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats) -#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN) +#define IXGBE_PB_STATS_LEN ( \ + (((struct ixgbe_adapter *)netdev->priv)->flags & \ + IXGBE_FLAG_DCB_ENABLED) ? \ + (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \ + sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \ + sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \ + sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \ + / sizeof(u64) : 0) +#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + \ + IXGBE_PB_STATS_LEN + \ + IXGBE_QUEUE_STATS_LEN)static int ixgbe_get_settings (struct net_device *netdev,struct ethtool_cmd *ecmd)
@@ -804,6 +813,16 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, data[i + k] = queue_stat[k]; i += k; } +if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { +for (j =0 ; j <MAX_TX_PACKET_BUFFERS ; j++) { + data[i++] = adapter->stats.pxontxc[j]; + data[i++] = adapter->stats.pxofftxc[j]; + } +for (j =0 ; j <MAX_RX_PACKET_BUFFERS ; j++) { + data[i++] = adapter->stats.pxonrxc[j]; + data[i++] = adapter->stats.pxoffrxc[j]; + } + } } static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
@@ -832,6 +851,20 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,sprintf (p,"rx_queue_%u_bytes" , i); p +=ETH_GSTRING_LEN ; } +if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { +for (i =0 ; i <MAX_TX_PACKET_BUFFERS ; i++) { +sprintf (p,"tx_pb_%u_pxon" , i); + p +=ETH_GSTRING_LEN ; +sprintf (p,"tx_pb_%u_pxoff" , i); + p +=ETH_GSTRING_LEN ; + } +for (i =0 ; i <MAX_RX_PACKET_BUFFERS ; i++) { +sprintf (p,"rx_pb_%u_pxon" , i); + p +=ETH_GSTRING_LEN ; +sprintf (p,"rx_pb_%u_pxoff" , i); + p +=ETH_GSTRING_LEN ; + } + }/* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ break ; }
drivers/net/ixgbe/ixgbe_main.c +174 -15
361 lines not on this page · raw message
include/linux/dcbnl.h new file +230 -0
230 lines not on this page · raw message
include/linux/netdevice.h +8 -0
@@ -42,6 +42,9 @@#include <linux/workqueue.h> #include <net/net_namespace.h> +#ifdef CONFIG_DCBNL +#include <net/dcbnl.h> +#endif struct vlan_group ;struct ethtool_ops ;
@@ -751,6 +754,11 @@ struct net_device/* for setting kernel sock attribute on TCP connection setup */ #define GSO_MAX_SIZE 65536unsigned int gso_max_size; + +#ifdef CONFIG_DCBNL +/* Data Center Bridging netlink ops */ +struct dcbnl_rtnl_ops *dcbnl_ops; +#endif };#define to_net_dev (d) container_of(d, struct net_device, dev)
include/linux/rtnetlink.h +5 -0
@@ -107,6 +107,11 @@ enum { RTM_GETADDRLABEL,#define RTM_GETADDRLABEL RTM_GETADDRLABEL + RTM_GETDCB = 78, +#define RTM_GETDCB RTM_GETDCB + RTM_SETDCB, +#define RTM_SETDCB RTM_SETDCB + __RTM_MAX,#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) };
include/net/dcbnl.h new file +44 -0
44 lines not on this page · raw message
net/Kconfig +1 -0
@@ -190,6 +190,7 @@ source "net/lapb/Kconfig" source "net/econet/Kconfig" source "net/wanrouter/Kconfig" source "net/sched/Kconfig" +source "net/dcb/Kconfig" menu "Network testing"
net/Makefile +3 -0
@@ -56,6 +56,9 @@ obj-$(CONFIG_NETLABEL) += netlabel/ obj-$(CONFIG_IUCV) += iucv/ obj-$(CONFIG_RFKILL) += rfkill/ obj-$(CONFIG_NET_9P) += 9p/ +ifeq ($(CONFIG_DCBNL),y) +obj-$(CONFIG_DCB) += dcb/ +endif ifeq ($(CONFIG_NET),y) obj-$(CONFIG_SYSCTL) += sysctl_net.o
net/dcb/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +config DCB + tristate "Data Center Bridging support" + +config DCBNL + bool "Data Center Bridging netlink interface support" + depends on DCB + default n + ---help--- + This option turns on the netlink interface + (dcbnl) for Data Center Bridging capable devices. + + If unsure, say N.
net/dcb/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_DCB) += dcbnl.o
net/dcb/dcbnl.c new file +682 -0
682 lines not on this page · raw message