Commit 5624e80f authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Sathya Perla says:

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

Patches 1 and 2 fix sparse warnings (static declaration needed and endian
declaration needed) introduced by the earlier patch set.

Patches 3 and 4 add 20G/40G speed reporting via ethtool for the Skyhawk-R
chip.

Patches 5 to 12 fix various style issues and checkpatch warnings in the
driver such as:
	- removing unnecessary return statements in void routines
	- adding needed blank lines after a declaration block
	- deleting multiple blank lines
	- inserting a blank line after a function/struct definition
	- removing space after typecast
	- fixing multiple assignments on a single line
	- fixing alignment on a line wrap
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents cecda693 cd3307aa
This diff is collapsed.
...@@ -1005,8 +1005,8 @@ struct be_cmd_resp_link_status { ...@@ -1005,8 +1005,8 @@ struct be_cmd_resp_link_status {
/* Identifies the type of port attached to NIC */ /* Identifies the type of port attached to NIC */
struct be_cmd_req_port_type { struct be_cmd_req_port_type {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
u32 page_num; __le32 page_num;
u32 port; __le32 port;
}; };
enum { enum {
...@@ -1374,6 +1374,7 @@ enum { ...@@ -1374,6 +1374,7 @@ enum {
#define BE_SUPPORTED_SPEED_100MBPS 2 #define BE_SUPPORTED_SPEED_100MBPS 2
#define BE_SUPPORTED_SPEED_1GBPS 4 #define BE_SUPPORTED_SPEED_1GBPS 4
#define BE_SUPPORTED_SPEED_10GBPS 8 #define BE_SUPPORTED_SPEED_10GBPS 8
#define BE_SUPPORTED_SPEED_20GBPS 0x10
#define BE_SUPPORTED_SPEED_40GBPS 0x20 #define BE_SUPPORTED_SPEED_40GBPS 0x20
#define BE_AN_EN 0x2 #define BE_AN_EN 0x2
......
...@@ -130,6 +130,7 @@ static const struct be_ethtool_stat et_stats[] = { ...@@ -130,6 +130,7 @@ static const struct be_ethtool_stat et_stats[] = {
{DRVSTAT_INFO(roce_drops_payload_len)}, {DRVSTAT_INFO(roce_drops_payload_len)},
{DRVSTAT_INFO(roce_drops_crc)} {DRVSTAT_INFO(roce_drops_crc)}
}; };
#define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats) #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
/* Stats related to multi RX queues: get_stats routine assumes bytes, pkts /* Stats related to multi RX queues: get_stats routine assumes bytes, pkts
...@@ -152,6 +153,7 @@ static const struct be_ethtool_stat et_rx_stats[] = { ...@@ -152,6 +153,7 @@ static const struct be_ethtool_stat et_rx_stats[] = {
*/ */
{DRVSTAT_RX_INFO(rx_drops_no_frags)} {DRVSTAT_RX_INFO(rx_drops_no_frags)}
}; };
#define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats)) #define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
/* Stats related to multi TX queues: get_stats routine assumes compl is the /* Stats related to multi TX queues: get_stats routine assumes compl is the
...@@ -200,6 +202,7 @@ static const struct be_ethtool_stat et_tx_stats[] = { ...@@ -200,6 +202,7 @@ static const struct be_ethtool_stat et_tx_stats[] = {
/* Pkts dropped in the driver's transmit path */ /* Pkts dropped in the driver's transmit path */
{DRVSTAT_TX_INFO(tx_drv_drops)} {DRVSTAT_TX_INFO(tx_drv_drops)}
}; };
#define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats)) #define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats))
static const char et_self_tests[][ETH_GSTRING_LEN] = { static const char et_self_tests[][ETH_GSTRING_LEN] = {
...@@ -333,7 +336,6 @@ static int be_get_coalesce(struct net_device *netdev, ...@@ -333,7 +336,6 @@ static int be_get_coalesce(struct net_device *netdev,
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct be_aic_obj *aic = &adapter->aic_obj[0]; struct be_aic_obj *aic = &adapter->aic_obj[0];
et->rx_coalesce_usecs = aic->prev_eqd; et->rx_coalesce_usecs = aic->prev_eqd;
et->rx_coalesce_usecs_high = aic->max_eqd; et->rx_coalesce_usecs_high = aic->max_eqd;
et->rx_coalesce_usecs_low = aic->min_eqd; et->rx_coalesce_usecs_low = aic->min_eqd;
...@@ -534,10 +536,24 @@ static u32 convert_to_et_setting(struct be_adapter *adapter, u32 if_speeds) ...@@ -534,10 +536,24 @@ static u32 convert_to_et_setting(struct be_adapter *adapter, u32 if_speeds)
if (if_speeds & BE_SUPPORTED_SPEED_10GBPS) if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
val |= SUPPORTED_10000baseKX4_Full; val |= SUPPORTED_10000baseKX4_Full;
break; break;
case PHY_TYPE_KR2_20GB:
val |= SUPPORTED_Backplane;
if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
val |= SUPPORTED_10000baseKR_Full;
if (if_speeds & BE_SUPPORTED_SPEED_20GBPS)
val |= SUPPORTED_20000baseKR2_Full;
break;
case PHY_TYPE_KR_10GB: case PHY_TYPE_KR_10GB:
val |= SUPPORTED_Backplane | val |= SUPPORTED_Backplane |
SUPPORTED_10000baseKR_Full; SUPPORTED_10000baseKR_Full;
break; break;
case PHY_TYPE_KR4_40GB:
val |= SUPPORTED_Backplane;
if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
val |= SUPPORTED_10000baseKR_Full;
if (if_speeds & BE_SUPPORTED_SPEED_40GBPS)
val |= SUPPORTED_40000baseKR4_Full;
break;
case PHY_TYPE_QSFP: case PHY_TYPE_QSFP:
if (if_speeds & BE_SUPPORTED_SPEED_40GBPS) { if (if_speeds & BE_SUPPORTED_SPEED_40GBPS) {
switch (adapter->phy.cable_type) { switch (adapter->phy.cable_type) {
...@@ -668,8 +684,10 @@ static void be_get_ringparam(struct net_device *netdev, ...@@ -668,8 +684,10 @@ static void be_get_ringparam(struct net_device *netdev,
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
ring->rx_max_pending = ring->rx_pending = adapter->rx_obj[0].q.len; ring->rx_max_pending = adapter->rx_obj[0].q.len;
ring->tx_max_pending = ring->tx_pending = adapter->tx_obj[0].q.len; ring->rx_pending = adapter->rx_obj[0].q.len;
ring->tx_max_pending = adapter->tx_obj[0].q.len;
ring->tx_pending = adapter->tx_obj[0].q.len;
} }
static void static void
...@@ -961,8 +979,6 @@ static void be_set_msg_level(struct net_device *netdev, u32 level) ...@@ -961,8 +979,6 @@ static void be_set_msg_level(struct net_device *netdev, u32 level)
FW_LOG_LEVEL_DEFAULT : FW_LOG_LEVEL_DEFAULT :
FW_LOG_LEVEL_FATAL); FW_LOG_LEVEL_FATAL);
adapter->msg_enable = level; adapter->msg_enable = level;
return;
} }
static u64 be_get_rss_hash_opts(struct be_adapter *adapter, u64 flow_type) static u64 be_get_rss_hash_opts(struct be_adapter *adapter, u64 flow_type)
...@@ -1181,6 +1197,7 @@ static int be_set_rxfh(struct net_device *netdev, const u32 *indir, ...@@ -1181,6 +1197,7 @@ static int be_set_rxfh(struct net_device *netdev, const u32 *indir,
if (indir) { if (indir) {
struct be_rx_obj *rxo; struct be_rx_obj *rxo;
for (i = 0; i < RSS_INDIR_TABLE_LEN; i++) { for (i = 0; i < RSS_INDIR_TABLE_LEN; i++) {
j = indir[i]; j = indir[i];
rxo = &adapter->rx_obj[j]; rxo = &adapter->rx_obj[j];
......
...@@ -86,6 +86,7 @@ static const char * const ue_status_low_desc[] = { ...@@ -86,6 +86,7 @@ static const char * const ue_status_low_desc[] = {
"JTAG ", "JTAG ",
"MPU_INTPEND " "MPU_INTPEND "
}; };
/* UE Status High CSR */ /* UE Status High CSR */
static const char * const ue_status_hi_desc[] = { static const char * const ue_status_hi_desc[] = {
"LPCMEMHOST", "LPCMEMHOST",
...@@ -122,10 +123,10 @@ static const char * const ue_status_hi_desc[] = { ...@@ -122,10 +123,10 @@ static const char * const ue_status_hi_desc[] = {
"Unknown" "Unknown"
}; };
static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q) static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q)
{ {
struct be_dma_mem *mem = &q->dma_mem; struct be_dma_mem *mem = &q->dma_mem;
if (mem->va) { if (mem->va) {
dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va, dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
mem->dma); mem->dma);
...@@ -187,6 +188,7 @@ static void be_intr_set(struct be_adapter *adapter, bool enable) ...@@ -187,6 +188,7 @@ static void be_intr_set(struct be_adapter *adapter, bool enable)
static void be_rxq_notify(struct be_adapter *adapter, u16 qid, u16 posted) static void be_rxq_notify(struct be_adapter *adapter, u16 qid, u16 posted)
{ {
u32 val = 0; u32 val = 0;
val |= qid & DB_RQ_RING_ID_MASK; val |= qid & DB_RQ_RING_ID_MASK;
val |= posted << DB_RQ_NUM_POSTED_SHIFT; val |= posted << DB_RQ_NUM_POSTED_SHIFT;
...@@ -198,6 +200,7 @@ static void be_txq_notify(struct be_adapter *adapter, struct be_tx_obj *txo, ...@@ -198,6 +200,7 @@ static void be_txq_notify(struct be_adapter *adapter, struct be_tx_obj *txo,
u16 posted) u16 posted)
{ {
u32 val = 0; u32 val = 0;
val |= txo->q.id & DB_TXULP_RING_ID_MASK; val |= txo->q.id & DB_TXULP_RING_ID_MASK;
val |= (posted & DB_TXULP_NUM_POSTED_MASK) << DB_TXULP_NUM_POSTED_SHIFT; val |= (posted & DB_TXULP_NUM_POSTED_MASK) << DB_TXULP_NUM_POSTED_SHIFT;
...@@ -209,6 +212,7 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid, ...@@ -209,6 +212,7 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid,
bool arm, bool clear_int, u16 num_popped) bool arm, bool clear_int, u16 num_popped)
{ {
u32 val = 0; u32 val = 0;
val |= qid & DB_EQ_RING_ID_MASK; val |= qid & DB_EQ_RING_ID_MASK;
val |= ((qid & DB_EQ_RING_ID_EXT_MASK) << DB_EQ_RING_ID_EXT_MASK_SHIFT); val |= ((qid & DB_EQ_RING_ID_EXT_MASK) << DB_EQ_RING_ID_EXT_MASK_SHIFT);
...@@ -227,6 +231,7 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid, ...@@ -227,6 +231,7 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid,
void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped) void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped)
{ {
u32 val = 0; u32 val = 0;
val |= qid & DB_CQ_RING_ID_MASK; val |= qid & DB_CQ_RING_ID_MASK;
val |= ((qid & DB_CQ_RING_ID_EXT_MASK) << val |= ((qid & DB_CQ_RING_ID_EXT_MASK) <<
DB_CQ_RING_ID_EXT_MASK_SHIFT); DB_CQ_RING_ID_EXT_MASK_SHIFT);
...@@ -488,7 +493,6 @@ static void populate_be_v2_stats(struct be_adapter *adapter) ...@@ -488,7 +493,6 @@ static void populate_be_v2_stats(struct be_adapter *adapter)
static void populate_lancer_stats(struct be_adapter *adapter) static void populate_lancer_stats(struct be_adapter *adapter)
{ {
struct be_drv_stats *drvs = &adapter->drv_stats; struct be_drv_stats *drvs = &adapter->drv_stats;
struct lancer_pport_stats *pport_stats = pport_stats_from_cmd(adapter); struct lancer_pport_stats *pport_stats = pport_stats_from_cmd(adapter);
...@@ -588,6 +592,7 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev, ...@@ -588,6 +592,7 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
for_all_rx_queues(adapter, rxo, i) { for_all_rx_queues(adapter, rxo, i) {
const struct be_rx_stats *rx_stats = rx_stats(rxo); const struct be_rx_stats *rx_stats = rx_stats(rxo);
do { do {
start = u64_stats_fetch_begin_irq(&rx_stats->sync); start = u64_stats_fetch_begin_irq(&rx_stats->sync);
pkts = rx_stats(rxo)->rx_pkts; pkts = rx_stats(rxo)->rx_pkts;
...@@ -602,6 +607,7 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev, ...@@ -602,6 +607,7 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
for_all_tx_queues(adapter, txo, i) { for_all_tx_queues(adapter, txo, i) {
const struct be_tx_stats *tx_stats = tx_stats(txo); const struct be_tx_stats *tx_stats = tx_stats(txo);
do { do {
start = u64_stats_fetch_begin_irq(&tx_stats->sync); start = u64_stats_fetch_begin_irq(&tx_stats->sync);
pkts = tx_stats(txo)->tx_pkts; pkts = tx_stats(txo)->tx_pkts;
...@@ -807,6 +813,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, ...@@ -807,6 +813,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq,
if (skb->len > skb->data_len) { if (skb->len > skb->data_len) {
int len = skb_headlen(skb); int len = skb_headlen(skb);
busaddr = dma_map_single(dev, skb->data, len, DMA_TO_DEVICE); busaddr = dma_map_single(dev, skb->data, len, DMA_TO_DEVICE);
if (dma_mapping_error(dev, busaddr)) if (dma_mapping_error(dev, busaddr))
goto dma_err; goto dma_err;
...@@ -820,6 +827,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, ...@@ -820,6 +827,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq,
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
busaddr = skb_frag_dma_map(dev, frag, 0, busaddr = skb_frag_dma_map(dev, frag, 0,
skb_frag_size(frag), DMA_TO_DEVICE); skb_frag_size(frag), DMA_TO_DEVICE);
if (dma_mapping_error(dev, busaddr)) if (dma_mapping_error(dev, busaddr))
...@@ -910,7 +918,7 @@ static bool be_ipv6_exthdr_check(struct sk_buff *skb) ...@@ -910,7 +918,7 @@ static bool be_ipv6_exthdr_check(struct sk_buff *skb)
if (ip6h->nexthdr != NEXTHDR_TCP && if (ip6h->nexthdr != NEXTHDR_TCP &&
ip6h->nexthdr != NEXTHDR_UDP) { ip6h->nexthdr != NEXTHDR_UDP) {
struct ipv6_opt_hdr *ehdr = struct ipv6_opt_hdr *ehdr =
(struct ipv6_opt_hdr *) (skb->data + offset); (struct ipv6_opt_hdr *)(skb->data + offset);
/* offending pkt: 2nd byte following IPv6 hdr is 0xff */ /* offending pkt: 2nd byte following IPv6 hdr is 0xff */
if (ehdr->hdrlen == 0xff) if (ehdr->hdrlen == 0xff)
...@@ -1416,6 +1424,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, int vf, ...@@ -1416,6 +1424,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, int vf,
max_tx_rate, vf); max_tx_rate, vf);
return be_cmd_status(status); return be_cmd_status(status);
} }
static int be_set_vf_link_state(struct net_device *netdev, int vf, static int be_set_vf_link_state(struct net_device *netdev, int vf,
int link_state) int link_state)
{ {
...@@ -1481,7 +1490,6 @@ static void be_eqd_update(struct be_adapter *adapter) ...@@ -1481,7 +1490,6 @@ static void be_eqd_update(struct be_adapter *adapter)
tx_pkts = txo->stats.tx_reqs; tx_pkts = txo->stats.tx_reqs;
} while (u64_stats_fetch_retry_irq(&txo->stats.sync, start)); } while (u64_stats_fetch_retry_irq(&txo->stats.sync, start));
/* Skip, if wrapped around or first calculation */ /* Skip, if wrapped around or first calculation */
now = jiffies; now = jiffies;
if (!aic->jiffies || time_before(now, aic->jiffies) || if (!aic->jiffies || time_before(now, aic->jiffies) ||
...@@ -2053,7 +2061,8 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo) ...@@ -2053,7 +2061,8 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo)
memset(page_info, 0, sizeof(*page_info)); memset(page_info, 0, sizeof(*page_info));
} }
BUG_ON(atomic_read(&rxq->used)); BUG_ON(atomic_read(&rxq->used));
rxq->tail = rxq->head = 0; rxq->tail = 0;
rxq->head = 0;
} }
static void be_tx_compl_clean(struct be_adapter *adapter) static void be_tx_compl_clean(struct be_adapter *adapter)
...@@ -3716,8 +3725,6 @@ static void be_netpoll(struct net_device *netdev) ...@@ -3716,8 +3725,6 @@ static void be_netpoll(struct net_device *netdev)
be_eq_notify(eqo->adapter, eqo->q.id, false, true, 0); be_eq_notify(eqo->adapter, eqo->q.id, false, true, 0);
napi_schedule(&eqo->napi); napi_schedule(&eqo->napi);
} }
return;
} }
#endif #endif
...@@ -4395,7 +4402,6 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, ...@@ -4395,7 +4402,6 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family,
return; return;
err: err:
be_disable_vxlan_offloads(adapter); be_disable_vxlan_offloads(adapter);
return;
} }
static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family,
...@@ -4735,7 +4741,6 @@ static void be_func_recovery_task(struct work_struct *work) ...@@ -4735,7 +4741,6 @@ static void be_func_recovery_task(struct work_struct *work)
be_detect_error(adapter); be_detect_error(adapter);
if (adapter->hw_error && lancer_chip(adapter)) { if (adapter->hw_error && lancer_chip(adapter)) {
rtnl_lock(); rtnl_lock();
netif_device_detach(adapter->netdev); netif_device_detach(adapter->netdev);
rtnl_unlock(); rtnl_unlock();
...@@ -4919,7 +4924,8 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) ...@@ -4919,7 +4924,8 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
INIT_DELAYED_WORK(&adapter->work, be_worker); INIT_DELAYED_WORK(&adapter->work, be_worker);
INIT_DELAYED_WORK(&adapter->func_recovery_work, be_func_recovery_task); INIT_DELAYED_WORK(&adapter->func_recovery_work, be_func_recovery_task);
adapter->rx_fc = adapter->tx_fc = true; adapter->rx_fc = true;
adapter->tx_fc = true;
status = be_setup(adapter); status = be_setup(adapter);
if (status) if (status)
......
...@@ -174,6 +174,7 @@ int be_roce_register_driver(struct ocrdma_driver *drv) ...@@ -174,6 +174,7 @@ int be_roce_register_driver(struct ocrdma_driver *drv)
ocrdma_drv = drv; ocrdma_drv = drv;
list_for_each_entry(dev, &be_adapter_list, entry) { list_for_each_entry(dev, &be_adapter_list, entry) {
struct net_device *netdev; struct net_device *netdev;
_be_roce_dev_add(dev); _be_roce_dev_add(dev);
netdev = dev->netdev; netdev = dev->netdev;
if (netif_running(netdev) && netif_oper_up(netdev)) if (netif_running(netdev) && netif_oper_up(netdev))
......
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