Commit c16ead79 authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Venkat Duvvuru says:

====================
be2net: patch-set

The following patch set has one new feature addition and two fixes.

Patch 1 adds support for hwmon sysfs interface to display board temperature.
Board temperature display through ethtool statistics is removed.

Patch 2 reports "link down" in a few more error cases which are not handled
currently.

Patch 3 adds support for os2bmc. OS2BMC feature will allow the server to
communicate with the on-board BMC/idrac (Baseboard Management Controller)
over the LOM via standard Ethernet. More details are added in the commit log.

Please review.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5a99e7f2 760c295e
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/u64_stats_sync.h> #include <linux/u64_stats_sync.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include "be_hw.h" #include "be_hw.h"
#include "be_roce.h" #include "be_roce.h"
...@@ -314,7 +316,6 @@ struct be_rx_obj { ...@@ -314,7 +316,6 @@ struct be_rx_obj {
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
struct be_drv_stats { struct be_drv_stats {
u32 be_on_die_temperature;
u32 eth_red_drops; u32 eth_red_drops;
u32 dma_map_errors; u32 dma_map_errors;
u32 rx_drops_no_pbuf; u32 rx_drops_no_pbuf;
...@@ -383,6 +384,7 @@ enum vf_state { ...@@ -383,6 +384,7 @@ enum vf_state {
#define BE_FLAGS_SETUP_DONE BIT(9) #define BE_FLAGS_SETUP_DONE BIT(9)
#define BE_FLAGS_EVT_INCOMPATIBLE_SFP BIT(10) #define BE_FLAGS_EVT_INCOMPATIBLE_SFP BIT(10)
#define BE_FLAGS_ERR_DETECTION_SCHEDULED BIT(11) #define BE_FLAGS_ERR_DETECTION_SCHEDULED BIT(11)
#define BE_FLAGS_OS2BMC BIT(12)
#define BE_UC_PMAC_COUNT 30 #define BE_UC_PMAC_COUNT 30
#define BE_VF_UC_PMAC_COUNT 2 #define BE_VF_UC_PMAC_COUNT 2
...@@ -427,6 +429,8 @@ struct be_resources { ...@@ -427,6 +429,8 @@ struct be_resources {
u32 vf_if_cap_flags; /* VF if capability flags */ u32 vf_if_cap_flags; /* VF if capability flags */
}; };
#define be_is_os2bmc_enabled(adapter) (adapter->flags & BE_FLAGS_OS2BMC)
struct rss_info { struct rss_info {
u64 rss_flags; u64 rss_flags;
u8 rsstable[RSS_INDIR_TABLE_LEN]; u8 rsstable[RSS_INDIR_TABLE_LEN];
...@@ -434,6 +438,12 @@ struct rss_info { ...@@ -434,6 +438,12 @@ struct rss_info {
u8 rss_hkey[RSS_HASH_KEY_LEN]; 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. /* Macros to read/write the 'features' word of be_wrb_params structure.
*/ */
#define BE_WRB_F_BIT(name) BE_WRB_F_##name##_BIT #define BE_WRB_F_BIT(name) BE_WRB_F_##name##_BIT
...@@ -454,7 +464,8 @@ enum { ...@@ -454,7 +464,8 @@ enum {
BE_WRB_F_LSO_BIT, /* LSO */ BE_WRB_F_LSO_BIT, /* LSO */
BE_WRB_F_LSO6_BIT, /* LSO6 */ BE_WRB_F_LSO6_BIT, /* LSO6 */
BE_WRB_F_VLAN_BIT, /* VLAN */ 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 /* The structure below provides a HW-agnostic abstraction of WRB params
...@@ -515,6 +526,7 @@ struct be_adapter { ...@@ -515,6 +526,7 @@ struct be_adapter {
u16 work_counter; u16 work_counter;
struct delayed_work be_err_detection_work; struct delayed_work be_err_detection_work;
u8 err_flags;
u32 flags; u32 flags;
u32 cmd_privileges; u32 cmd_privileges;
/* Ethtool knobs and info */ /* Ethtool knobs and info */
...@@ -573,8 +585,11 @@ struct be_adapter { ...@@ -573,8 +585,11 @@ struct be_adapter {
u16 qnq_vid; u16 qnq_vid;
u32 msg_enable; u32 msg_enable;
int be_get_temp_freq; int be_get_temp_freq;
struct be_hwmon hwmon_info;
u8 pf_number; u8 pf_number;
struct rss_info rss_info; struct rss_info rss_info;
/* Filters for packets that need to be sent to BMC */
u32 bmc_filt_mask;
}; };
#define be_physfn(adapter) (!adapter->virtfn) #define be_physfn(adapter) (!adapter->virtfn)
...@@ -773,26 +788,36 @@ static inline bool is_ipv4_pkt(struct sk_buff *skb) ...@@ -773,26 +788,36 @@ static inline bool is_ipv4_pkt(struct sk_buff *skb)
return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; 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; return adapter->num_rx_qs > 1;
adapter->hw_error = false;
adapter->fw_timeout = false;
} }
void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
......
...@@ -93,7 +93,7 @@ static void be_mcc_notify(struct be_adapter *adapter) ...@@ -93,7 +93,7 @@ static void be_mcc_notify(struct be_adapter *adapter)
struct be_queue_info *mccq = &adapter->mcc_obj.q; struct be_queue_info *mccq = &adapter->mcc_obj.q;
u32 val = 0; u32 val = 0;
if (be_error(adapter)) if (be_check_error(adapter, BE_ERROR_ANY))
return; return;
val |= mccq->id & DB_MCCQ_RING_ID_MASK; val |= mccq->id & DB_MCCQ_RING_ID_MASK;
...@@ -192,10 +192,12 @@ static void be_async_cmd_process(struct be_adapter *adapter, ...@@ -192,10 +192,12 @@ static void be_async_cmd_process(struct be_adapter *adapter,
if (base_status == MCC_STATUS_SUCCESS) { if (base_status == MCC_STATUS_SUCCESS) {
struct be_cmd_resp_get_cntl_addnl_attribs *resp = struct be_cmd_resp_get_cntl_addnl_attribs *resp =
(void *)resp_hdr; (void *)resp_hdr;
adapter->drv_stats.be_on_die_temperature = adapter->hwmon_info.be_on_die_temp =
resp->on_die_temperature; resp->on_die_temperature;
} else { } else {
adapter->be_get_temp_freq = 0; adapter->be_get_temp_freq = 0;
adapter->hwmon_info.be_on_die_temp =
BE_INVALID_DIE_TEMP;
} }
return; return;
} }
...@@ -331,6 +333,21 @@ static void be_async_grp5_pvid_state_process(struct be_adapter *adapter, ...@@ -331,6 +333,21 @@ static void be_async_grp5_pvid_state_process(struct be_adapter *adapter,
} }
} }
#define MGMT_ENABLE_MASK 0x4
static void be_async_grp5_fw_control_process(struct be_adapter *adapter,
struct be_mcc_compl *compl)
{
struct be_async_fw_control *evt = (struct be_async_fw_control *)compl;
u32 evt_dw1 = le32_to_cpu(evt->event_data_word1);
if (evt_dw1 & MGMT_ENABLE_MASK) {
adapter->flags |= BE_FLAGS_OS2BMC;
adapter->bmc_filt_mask = le32_to_cpu(evt->event_data_word2);
} else {
adapter->flags &= ~BE_FLAGS_OS2BMC;
}
}
static void be_async_grp5_evt_process(struct be_adapter *adapter, static void be_async_grp5_evt_process(struct be_adapter *adapter,
struct be_mcc_compl *compl) struct be_mcc_compl *compl)
{ {
...@@ -347,6 +364,10 @@ static void be_async_grp5_evt_process(struct be_adapter *adapter, ...@@ -347,6 +364,10 @@ static void be_async_grp5_evt_process(struct be_adapter *adapter,
case ASYNC_EVENT_PVID_STATE: case ASYNC_EVENT_PVID_STATE:
be_async_grp5_pvid_state_process(adapter, compl); be_async_grp5_pvid_state_process(adapter, compl);
break; break;
/* Async event to disable/enable os2bmc and/or mac-learning */
case ASYNC_EVENT_FW_CONTROL:
be_async_grp5_fw_control_process(adapter, compl);
break;
default: default:
break; break;
} }
...@@ -487,7 +508,7 @@ static int be_mcc_wait_compl(struct be_adapter *adapter) ...@@ -487,7 +508,7 @@ static int be_mcc_wait_compl(struct be_adapter *adapter)
struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; struct be_mcc_obj *mcc_obj = &adapter->mcc_obj;
for (i = 0; i < mcc_timeout; i++) { for (i = 0; i < mcc_timeout; i++) {
if (be_error(adapter)) if (be_check_error(adapter, BE_ERROR_ANY))
return -EIO; return -EIO;
local_bh_disable(); local_bh_disable();
...@@ -500,7 +521,7 @@ static int be_mcc_wait_compl(struct be_adapter *adapter) ...@@ -500,7 +521,7 @@ static int be_mcc_wait_compl(struct be_adapter *adapter)
} }
if (i == mcc_timeout) { if (i == mcc_timeout) {
dev_err(&adapter->pdev->dev, "FW not responding\n"); dev_err(&adapter->pdev->dev, "FW not responding\n");
adapter->fw_timeout = true; be_set_error(adapter, BE_ERROR_FW);
return -EIO; return -EIO;
} }
return status; return status;
...@@ -539,7 +560,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) ...@@ -539,7 +560,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
u32 ready; u32 ready;
do { do {
if (be_error(adapter)) if (be_check_error(adapter, BE_ERROR_ANY))
return -EIO; return -EIO;
ready = ioread32(db); ready = ioread32(db);
...@@ -552,7 +573,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) ...@@ -552,7 +573,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
if (msecs > 4000) { if (msecs > 4000) {
dev_err(&adapter->pdev->dev, "FW not responding\n"); dev_err(&adapter->pdev->dev, "FW not responding\n");
adapter->fw_timeout = true; be_set_error(adapter, BE_ERROR_FW);
be_detect_error(adapter); be_detect_error(adapter);
return -1; return -1;
} }
......
...@@ -105,6 +105,7 @@ struct be_mcc_compl { ...@@ -105,6 +105,7 @@ struct be_mcc_compl {
#define ASYNC_DEBUG_EVENT_TYPE_QNQ 1 #define ASYNC_DEBUG_EVENT_TYPE_QNQ 1
#define ASYNC_EVENT_CODE_SLIPORT 0x11 #define ASYNC_EVENT_CODE_SLIPORT 0x11
#define ASYNC_EVENT_PORT_MISCONFIG 0x9 #define ASYNC_EVENT_PORT_MISCONFIG 0x9
#define ASYNC_EVENT_FW_CONTROL 0x5
enum { enum {
LINK_DOWN = 0x0, LINK_DOWN = 0x0,
...@@ -181,6 +182,22 @@ struct be_async_event_misconfig_port { ...@@ -181,6 +182,22 @@ struct be_async_event_misconfig_port {
u32 flags; u32 flags;
} __packed; } __packed;
#define BMC_FILT_BROADCAST_ARP BIT(0)
#define BMC_FILT_BROADCAST_DHCP_CLIENT BIT(1)
#define BMC_FILT_BROADCAST_DHCP_SERVER BIT(2)
#define BMC_FILT_BROADCAST_NET_BIOS BIT(3)
#define BMC_FILT_BROADCAST BIT(7)
#define BMC_FILT_MULTICAST_IPV6_NEIGH_ADVER BIT(8)
#define BMC_FILT_MULTICAST_IPV6_RA BIT(9)
#define BMC_FILT_MULTICAST_IPV6_RAS BIT(10)
#define BMC_FILT_MULTICAST BIT(15)
struct be_async_fw_control {
u32 event_data_word1;
u32 event_data_word2;
u32 evt_tag;
u32 event_data_word4;
} __packed;
struct be_mcc_mailbox { struct be_mcc_mailbox {
struct be_mcc_wrb wrb; struct be_mcc_wrb wrb;
struct be_mcc_compl compl; struct be_mcc_compl compl;
......
...@@ -123,7 +123,6 @@ static const struct be_ethtool_stat et_stats[] = { ...@@ -123,7 +123,6 @@ static const struct be_ethtool_stat et_stats[] = {
{DRVSTAT_INFO(dma_map_errors)}, {DRVSTAT_INFO(dma_map_errors)},
/* Number of packets dropped due to random early drop function */ /* Number of packets dropped due to random early drop function */
{DRVSTAT_INFO(eth_red_drops)}, {DRVSTAT_INFO(eth_red_drops)},
{DRVSTAT_INFO(be_on_die_temperature)},
{DRVSTAT_INFO(rx_roce_bytes_lsd)}, {DRVSTAT_INFO(rx_roce_bytes_lsd)},
{DRVSTAT_INFO(rx_roce_bytes_msd)}, {DRVSTAT_INFO(rx_roce_bytes_msd)},
{DRVSTAT_INFO(rx_roce_frames)}, {DRVSTAT_INFO(rx_roce_frames)},
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment