Commit 856a2723 authored by David S. Miller's avatar David S. Miller

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2019-08-01

This series for fm10k, by Jake Keller, reduces the scope of local variables
where possible.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4de97b0c df87b8fc
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */ /* Copyright(c) 2013 - 2019 Intel Corporation. */
#include "fm10k.h" #include "fm10k.h"
...@@ -36,7 +36,7 @@ static int fm10k_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets) ...@@ -36,7 +36,7 @@ static int fm10k_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets)
static int fm10k_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets) static int fm10k_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
{ {
u8 num_tc = 0; u8 num_tc = 0;
int i, err; int i;
/* verify type and determine num_tcs needed */ /* verify type and determine num_tcs needed */
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
...@@ -57,7 +57,7 @@ static int fm10k_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets) ...@@ -57,7 +57,7 @@ static int fm10k_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
/* update TC hardware mapping if necessary */ /* update TC hardware mapping if necessary */
if (num_tc != netdev_get_num_tc(dev)) { if (num_tc != netdev_get_num_tc(dev)) {
err = fm10k_setup_tc(dev, num_tc); int err = fm10k_setup_tc(dev, num_tc);
if (err) if (err)
return err; return err;
} }
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */ /* Copyright(c) 2013 - 2019 Intel Corporation. */
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
...@@ -222,7 +222,6 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer, ...@@ -222,7 +222,6 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer,
const unsigned int size) const unsigned int size)
{ {
unsigned int i; unsigned int i;
char *p;
if (!pointer) { if (!pointer) {
/* memory is not zero allocated so we have to clear it */ /* memory is not zero allocated so we have to clear it */
...@@ -232,7 +231,7 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer, ...@@ -232,7 +231,7 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer,
} }
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
p = (char *)pointer + stats[i].stat_offset; char *p = (char *)pointer + stats[i].stat_offset;
switch (stats[i].sizeof_stat) { switch (stats[i].sizeof_stat) {
case sizeof(u64): case sizeof(u64):
...@@ -651,7 +650,6 @@ static int fm10k_set_coalesce(struct net_device *dev, ...@@ -651,7 +650,6 @@ static int fm10k_set_coalesce(struct net_device *dev,
struct ethtool_coalesce *ec) struct ethtool_coalesce *ec)
{ {
struct fm10k_intfc *interface = netdev_priv(dev); struct fm10k_intfc *interface = netdev_priv(dev);
struct fm10k_q_vector *qv;
u16 tx_itr, rx_itr; u16 tx_itr, rx_itr;
int i; int i;
...@@ -677,7 +675,8 @@ static int fm10k_set_coalesce(struct net_device *dev, ...@@ -677,7 +675,8 @@ static int fm10k_set_coalesce(struct net_device *dev,
/* update q_vectors */ /* update q_vectors */
for (i = 0; i < interface->num_q_vectors; i++) { for (i = 0; i < interface->num_q_vectors; i++) {
qv = interface->q_vector[i]; struct fm10k_q_vector *qv = interface->q_vector[i];
qv->tx.itr = tx_itr; qv->tx.itr = tx_itr;
qv->rx.itr = rx_itr; qv->rx.itr = rx_itr;
} }
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */ /* Copyright(c) 2013 - 2019 Intel Corporation. */
#include "fm10k.h" #include "fm10k.h"
#include "fm10k_vf.h" #include "fm10k_vf.h"
...@@ -426,7 +426,7 @@ static s32 fm10k_iov_alloc_data(struct pci_dev *pdev, int num_vfs) ...@@ -426,7 +426,7 @@ static s32 fm10k_iov_alloc_data(struct pci_dev *pdev, int num_vfs)
struct fm10k_iov_data *iov_data = interface->iov_data; struct fm10k_iov_data *iov_data = interface->iov_data;
struct fm10k_hw *hw = &interface->hw; struct fm10k_hw *hw = &interface->hw;
size_t size; size_t size;
int i, err; int i;
/* return error if iov_data is already populated */ /* return error if iov_data is already populated */
if (iov_data) if (iov_data)
...@@ -452,6 +452,7 @@ static s32 fm10k_iov_alloc_data(struct pci_dev *pdev, int num_vfs) ...@@ -452,6 +452,7 @@ static s32 fm10k_iov_alloc_data(struct pci_dev *pdev, int num_vfs)
/* loop through vf_info structures initializing each entry */ /* loop through vf_info structures initializing each entry */
for (i = 0; i < num_vfs; i++) { for (i = 0; i < num_vfs; i++) {
struct fm10k_vf_info *vf_info = &iov_data->vf_info[i]; struct fm10k_vf_info *vf_info = &iov_data->vf_info[i];
int err;
/* Record VF VSI value */ /* Record VF VSI value */
vf_info->vsi = i + 1; vf_info->vsi = i + 1;
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */ /* Copyright(c) 2013 - 2019 Intel Corporation. */
#include <linux/types.h> #include <linux/types.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -17,7 +17,7 @@ const char fm10k_driver_version[] = DRV_VERSION; ...@@ -17,7 +17,7 @@ const char fm10k_driver_version[] = DRV_VERSION;
char fm10k_driver_name[] = "fm10k"; char fm10k_driver_name[] = "fm10k";
static const char fm10k_driver_string[] = DRV_SUMMARY; static const char fm10k_driver_string[] = DRV_SUMMARY;
static const char fm10k_copyright[] = static const char fm10k_copyright[] =
"Copyright(c) 2013 - 2018 Intel Corporation."; "Copyright(c) 2013 - 2019 Intel Corporation.";
MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
MODULE_DESCRIPTION(DRV_SUMMARY); MODULE_DESCRIPTION(DRV_SUMMARY);
...@@ -1870,7 +1870,7 @@ static int fm10k_init_msix_capability(struct fm10k_intfc *interface) ...@@ -1870,7 +1870,7 @@ static int fm10k_init_msix_capability(struct fm10k_intfc *interface)
static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface) static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface)
{ {
struct net_device *dev = interface->netdev; struct net_device *dev = interface->netdev;
int pc, offset, rss_i, i, q_idx; int pc, offset, rss_i, i;
u16 pc_stride = interface->ring_feature[RING_F_QOS].mask + 1; u16 pc_stride = interface->ring_feature[RING_F_QOS].mask + 1;
u8 num_pcs = netdev_get_num_tc(dev); u8 num_pcs = netdev_get_num_tc(dev);
...@@ -1880,7 +1880,8 @@ static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface) ...@@ -1880,7 +1880,8 @@ static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface)
rss_i = interface->ring_feature[RING_F_RSS].indices; rss_i = interface->ring_feature[RING_F_RSS].indices;
for (pc = 0, offset = 0; pc < num_pcs; pc++, offset += rss_i) { for (pc = 0, offset = 0; pc < num_pcs; pc++, offset += rss_i) {
q_idx = pc; int q_idx = pc;
for (i = 0; i < rss_i; i++) { for (i = 0; i < rss_i; i++) {
interface->tx_ring[offset + i]->reg_idx = q_idx; interface->tx_ring[offset + i]->reg_idx = q_idx;
interface->tx_ring[offset + i]->qos_pc = pc; interface->tx_ring[offset + i]->qos_pc = pc;
......
...@@ -297,13 +297,14 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len) ...@@ -297,13 +297,14 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
{ {
struct fm10k_mbx_fifo *fifo = &mbx->rx; struct fm10k_mbx_fifo *fifo = &mbx->rx;
u16 total_len = 0, msg_len; u16 total_len = 0, msg_len;
u32 *msg;
/* length should include previous amounts pushed */ /* length should include previous amounts pushed */
len += mbx->pushed; len += mbx->pushed;
/* offset in message is based off of current message size */ /* offset in message is based off of current message size */
do { do {
u32 *msg;
msg = fifo->buffer + fm10k_fifo_tail_offset(fifo, total_len); msg = fifo->buffer + fm10k_fifo_tail_offset(fifo, total_len);
msg_len = FM10K_TLV_DWORD_LEN(*msg); msg_len = FM10K_TLV_DWORD_LEN(*msg);
total_len += msg_len; total_len += msg_len;
...@@ -1920,7 +1921,6 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw, ...@@ -1920,7 +1921,6 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
/* reduce length by 1 to convert to a mask */ /* reduce length by 1 to convert to a mask */
u16 mbmem_len = mbx->mbmem_len - 1; u16 mbmem_len = mbx->mbmem_len - 1;
u16 tail_len, len = 0; u16 tail_len, len = 0;
u32 *msg;
/* push head behind tail */ /* push head behind tail */
if (mbx->tail < head) if (mbx->tail < head)
...@@ -1930,6 +1930,8 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw, ...@@ -1930,6 +1930,8 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
/* determine msg aligned offset for end of buffer */ /* determine msg aligned offset for end of buffer */
do { do {
u32 *msg;
msg = fifo->buffer + fm10k_fifo_head_offset(fifo, len); msg = fifo->buffer + fm10k_fifo_head_offset(fifo, len);
tail_len = len; tail_len = len;
len += FM10K_TLV_DWORD_LEN(*msg); len += FM10K_TLV_DWORD_LEN(*msg);
......
...@@ -169,7 +169,6 @@ void fm10k_unmap_and_free_tx_resource(struct fm10k_ring *ring, ...@@ -169,7 +169,6 @@ void fm10k_unmap_and_free_tx_resource(struct fm10k_ring *ring,
**/ **/
static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring) static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring)
{ {
struct fm10k_tx_buffer *tx_buffer;
unsigned long size; unsigned long size;
u16 i; u16 i;
...@@ -179,7 +178,8 @@ static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring) ...@@ -179,7 +178,8 @@ static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring)
/* Free all the Tx ring sk_buffs */ /* Free all the Tx ring sk_buffs */
for (i = 0; i < tx_ring->count; i++) { for (i = 0; i < tx_ring->count; i++) {
tx_buffer = &tx_ring->tx_buffer[i]; struct fm10k_tx_buffer *tx_buffer = &tx_ring->tx_buffer[i];
fm10k_unmap_and_free_tx_resource(tx_ring, tx_buffer); fm10k_unmap_and_free_tx_resource(tx_ring, tx_buffer);
} }
...@@ -1444,11 +1444,11 @@ static int __fm10k_setup_tc(struct net_device *dev, enum tc_setup_type type, ...@@ -1444,11 +1444,11 @@ static int __fm10k_setup_tc(struct net_device *dev, enum tc_setup_type type,
static void fm10k_assign_l2_accel(struct fm10k_intfc *interface, static void fm10k_assign_l2_accel(struct fm10k_intfc *interface,
struct fm10k_l2_accel *l2_accel) struct fm10k_l2_accel *l2_accel)
{ {
struct fm10k_ring *ring;
int i; int i;
for (i = 0; i < interface->num_rx_queues; i++) { for (i = 0; i < interface->num_rx_queues; i++) {
ring = interface->rx_ring[i]; struct fm10k_ring *ring = interface->rx_ring[i];
rcu_assign_pointer(ring->l2_accel, l2_accel); rcu_assign_pointer(ring->l2_accel, l2_accel);
} }
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */ /* Copyright(c) 2013 - 2019 Intel Corporation. */
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -344,7 +344,6 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface) ...@@ -344,7 +344,6 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface)
struct net_device *netdev = interface->netdev; struct net_device *netdev = interface->netdev;
u32 __iomem *hw_addr; u32 __iomem *hw_addr;
u32 value; u32 value;
int err;
/* do nothing if netdev is still present or hw_addr is set */ /* do nothing if netdev is still present or hw_addr is set */
if (netif_device_present(netdev) || interface->hw.hw_addr) if (netif_device_present(netdev) || interface->hw.hw_addr)
...@@ -362,6 +361,8 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface) ...@@ -362,6 +361,8 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface)
hw_addr = READ_ONCE(interface->uc_addr); hw_addr = READ_ONCE(interface->uc_addr);
value = readl(hw_addr); value = readl(hw_addr);
if (~value) { if (~value) {
int err;
/* Make sure the reset was initiated because we detached, /* Make sure the reset was initiated because we detached,
* otherwise we might race with a different reset flow. * otherwise we might race with a different reset flow.
*/ */
...@@ -697,8 +698,6 @@ static void fm10k_watchdog_subtask(struct fm10k_intfc *interface) ...@@ -697,8 +698,6 @@ static void fm10k_watchdog_subtask(struct fm10k_intfc *interface)
*/ */
static void fm10k_check_hang_subtask(struct fm10k_intfc *interface) static void fm10k_check_hang_subtask(struct fm10k_intfc *interface)
{ {
int i;
/* If we're down or resetting, just bail */ /* If we're down or resetting, just bail */
if (test_bit(__FM10K_DOWN, interface->state) || if (test_bit(__FM10K_DOWN, interface->state) ||
test_bit(__FM10K_RESETTING, interface->state)) test_bit(__FM10K_RESETTING, interface->state))
...@@ -710,6 +709,8 @@ static void fm10k_check_hang_subtask(struct fm10k_intfc *interface) ...@@ -710,6 +709,8 @@ static void fm10k_check_hang_subtask(struct fm10k_intfc *interface)
interface->next_tx_hang_check = jiffies + (2 * HZ); interface->next_tx_hang_check = jiffies + (2 * HZ);
if (netif_carrier_ok(interface->netdev)) { if (netif_carrier_ok(interface->netdev)) {
int i;
/* Force detection of hung controller */ /* Force detection of hung controller */
for (i = 0; i < interface->num_tx_queues; i++) for (i = 0; i < interface->num_tx_queues; i++)
set_check_for_tx_hang(interface->tx_ring[i]); set_check_for_tx_hang(interface->tx_ring[i]);
......
...@@ -1352,7 +1352,6 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results, ...@@ -1352,7 +1352,6 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
struct fm10k_mbx_info *mbx) struct fm10k_mbx_info *mbx)
{ {
struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx; struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
u32 *result;
s32 err = 0; s32 err = 0;
u32 msg[2]; u32 msg[2];
u8 mode = 0; u8 mode = 0;
...@@ -1362,7 +1361,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results, ...@@ -1362,7 +1361,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
return FM10K_ERR_PARAM; return FM10K_ERR_PARAM;
if (!!results[FM10K_LPORT_STATE_MSG_XCAST_MODE]) { if (!!results[FM10K_LPORT_STATE_MSG_XCAST_MODE]) {
result = results[FM10K_LPORT_STATE_MSG_XCAST_MODE]; u32 *result = results[FM10K_LPORT_STATE_MSG_XCAST_MODE];
/* XCAST mode update requested */ /* XCAST mode update requested */
err = fm10k_tlv_attr_get_u8(result, &mode); err = fm10k_tlv_attr_get_u8(result, &mode);
......
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