These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / ethernet / emulex / benet / be.h
index 1bf1cdc..6ee78c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2014 Emulex
+ * Copyright (C) 2005 - 2015 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
 #include <linux/slab.h>
 #include <linux/u64_stats_sync.h>
 #include <linux/cpumask.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
 
 #include "be_hw.h"
 #include "be_roce.h"
 
-#define DRV_VER                        "10.6.0.1"
+#define DRV_VER                        "10.6.0.3"
 #define DRV_NAME               "be2net"
 #define BE_NAME                        "Emulex BladeEngine2"
 #define BE3_NAME               "Emulex BladeEngine3"
 
 #define MAX_VFS                        30 /* Max VFs supported by BE3 FW */
 #define FW_VER_LEN             32
+#define        CNTL_SERIAL_NUM_WORDS   8  /* Controller serial number words */
+#define        CNTL_SERIAL_NUM_WORD_SZ (sizeof(u16)) /* Byte-sz of serial num word */
 
 #define        RSS_INDIR_TABLE_LEN     128
 #define RSS_HASH_KEY_LEN       40
@@ -226,6 +230,7 @@ struct be_mcc_obj {
 struct be_tx_stats {
        u64 tx_bytes;
        u64 tx_pkts;
+       u64 tx_vxlan_offload_pkts;
        u64 tx_reqs;
        u64 tx_compl;
        ulong tx_jiffies;
@@ -273,6 +278,7 @@ struct be_rx_page_info {
 struct be_rx_stats {
        u64 rx_bytes;
        u64 rx_pkts;
+       u64 rx_vxlan_offload_pkts;
        u32 rx_drops_no_skbs;   /* skb allocation errors */
        u32 rx_drops_no_frags;  /* HW has no fetched frags */
        u32 rx_post_fail;       /* page post alloc failures */
@@ -314,7 +320,6 @@ struct be_rx_obj {
 } ____cacheline_aligned_in_smp;
 
 struct be_drv_stats {
-       u32 be_on_die_temperature;
        u32 eth_red_drops;
        u32 dma_map_errors;
        u32 rx_drops_no_pbuf;
@@ -366,6 +371,7 @@ struct be_vf_cfg {
        u32 tx_rate;
        u32 plink_tracking;
        u32 privileges;
+       bool spoofchk;
 };
 
 enum vf_state {
@@ -382,6 +388,7 @@ enum vf_state {
 #define BE_FLAGS_SETUP_DONE                    BIT(9)
 #define BE_FLAGS_EVT_INCOMPATIBLE_SFP          BIT(10)
 #define BE_FLAGS_ERR_DETECTION_SCHEDULED       BIT(11)
+#define BE_FLAGS_OS2BMC                                BIT(12)
 
 #define BE_UC_PMAC_COUNT                       30
 #define BE_VF_UC_PMAC_COUNT                    2
@@ -426,6 +433,8 @@ struct be_resources {
        u32 vf_if_cap_flags;    /* VF if capability flags */
 };
 
+#define be_is_os2bmc_enabled(adapter) (adapter->flags & BE_FLAGS_OS2BMC)
+
 struct rss_info {
        u64 rss_flags;
        u8 rsstable[RSS_INDIR_TABLE_LEN];
@@ -433,6 +442,12 @@ struct rss_info {
        u8 rss_hkey[RSS_HASH_KEY_LEN];
 };
 
+#define BE_INVALID_DIE_TEMP    0xFF
+struct be_hwmon {
+       struct device *hwmon_dev;
+       u8 be_on_die_temp;  /* Unit: millidegree Celsius */
+};
+
 /* Macros to read/write the 'features' word of be_wrb_params structure.
  */
 #define        BE_WRB_F_BIT(name)                      BE_WRB_F_##name##_BIT
@@ -453,7 +468,8 @@ enum {
        BE_WRB_F_LSO_BIT,               /* LSO */
        BE_WRB_F_LSO6_BIT,              /* LSO6 */
        BE_WRB_F_VLAN_BIT,              /* VLAN */
-       BE_WRB_F_VLAN_SKIP_HW_BIT       /* Skip VLAN tag (workaround) */
+       BE_WRB_F_VLAN_SKIP_HW_BIT,      /* Skip VLAN tag (workaround) */
+       BE_WRB_F_OS2BMC_BIT             /* Send packet to the management ring */
 };
 
 /* The structure below provides a HW-agnostic abstraction of WRB params
@@ -514,6 +530,7 @@ struct be_adapter {
        u16 work_counter;
 
        struct delayed_work be_err_detection_work;
+       u8 err_flags;
        u32 flags;
        u32 cmd_privileges;
        /* Ethtool knobs and info */
@@ -565,6 +582,7 @@ struct be_adapter {
        u16 pvid;
        __be16 vxlan_port;
        int vxlan_port_count;
+       int vxlan_port_aliases;
        struct phy_info phy;
        u8 wol_cap;
        bool wol_en;
@@ -572,8 +590,13 @@ struct be_adapter {
        u16 qnq_vid;
        u32 msg_enable;
        int be_get_temp_freq;
+       struct be_hwmon hwmon_info;
        u8 pf_number;
+       u8 pci_func_num;
        struct rss_info rss_info;
+       /* Filters for packets that need to be sent to BMC */
+       u32 bmc_filt_mask;
+       u16 serial_num[CNTL_SERIAL_NUM_WORDS];
 };
 
 #define be_physfn(adapter)             (!adapter->virtfn)
@@ -772,26 +795,36 @@ static inline bool is_ipv4_pkt(struct sk_buff *skb)
        return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4;
 }
 
-static inline bool be_multi_rxq(const struct be_adapter *adapter)
+#define BE_ERROR_EEH           1
+#define BE_ERROR_UE            BIT(1)
+#define BE_ERROR_FW            BIT(2)
+#define BE_ERROR_HW            (BE_ERROR_EEH | BE_ERROR_UE)
+#define BE_ERROR_ANY           (BE_ERROR_EEH | BE_ERROR_UE | BE_ERROR_FW)
+#define BE_CLEAR_ALL           0xFF
+
+static inline u8 be_check_error(struct be_adapter *adapter, u32 err_type)
 {
-       return adapter->num_rx_qs > 1;
+       return (adapter->err_flags & err_type);
 }
 
-static inline bool be_error(struct be_adapter *adapter)
+static inline void be_set_error(struct be_adapter *adapter, int err_type)
 {
-       return adapter->eeh_error || adapter->hw_error || adapter->fw_timeout;
+       struct net_device *netdev = adapter->netdev;
+
+       adapter->err_flags |= err_type;
+       netif_carrier_off(netdev);
+
+       dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name);
 }
 
-static inline bool be_hw_error(struct be_adapter *adapter)
+static inline void  be_clear_error(struct be_adapter *adapter, int err_type)
 {
-       return adapter->eeh_error || adapter->hw_error;
+       adapter->err_flags &= ~err_type;
 }
 
-static inline void  be_clear_all_error(struct be_adapter *adapter)
+static inline bool be_multi_rxq(const struct be_adapter *adapter)
 {
-       adapter->eeh_error = false;
-       adapter->hw_error = false;
-       adapter->fw_timeout = false;
+       return adapter->num_rx_qs > 1;
 }
 
 void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
@@ -804,6 +837,7 @@ bool be_pause_supported(struct be_adapter *adapter);
 u32 be_get_fw_log_level(struct be_adapter *adapter);
 int be_update_queues(struct be_adapter *adapter);
 int be_poll(struct napi_struct *napi, int budget);
+void be_eqd_update(struct be_adapter *adapter, bool force_update);
 
 /*
  * internal function to initialize-cleanup roce device.
@@ -814,8 +848,6 @@ void be_roce_dev_remove(struct be_adapter *);
 /*
  * internal function to open-close roce device during ifup-ifdown.
  */
-void be_roce_dev_open(struct be_adapter *);
-void be_roce_dev_close(struct be_adapter *);
 void be_roce_dev_shutdown(struct be_adapter *);
 
 #endif                         /* BE_H */