100GbE Intel Wired LAN Driver Updates 2019-08-01
Subsystems (3)
PATCH 5/11 fm10k: reduce the scope of the q_idx local variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the q_idx local variable in the fm10k_cache_ring_qos function.
This was detected by cppcheck and resolves the following style warning produced by that tool:
[fm10k_main.c:2016]: (style) The scope of the variable 'q_idx' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +5 -4
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2019 Intel Corporation. */ #include <linux/types.h> #include <linux/module.h>
@@ -17,7 +17,7 @@ const char fm10k_driver_version[] = DRV_VERSION;char fm10k_driver_name[] ="fm10k" ;static const char fm10k_driver_string[] =DRV_SUMMARY ;static const char fm10k_copyright[] = -"Copyright(c) 2013 - 2018 Intel Corporation." ; +"Copyright(c) 2013 - 2019 Intel Corporation." ;MODULE_AUTHOR ("Intel Corporation, <[email protected]>" );MODULE_DESCRIPTION (DRV_SUMMARY );
@@ -1870,7 +1870,7 @@ static int fm10k_init_msix_capability(struct fm10k_intfc *interface)static bool fm10k_cache_ring_qos (struct fm10k_intfc *interface) {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 ;u8 num_pcs =netdev_get_num_tc (dev);
@@ -1880,7 +1880,8 @@ static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface) rss_i = interface->ring_feature[RING_F_RSS ].indices;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++) { interface->tx_ring[offset + i]->reg_idx = q_idx; interface->tx_ring[offset + i]->qos_pc = pc;
Signature · 1 line
2.21.0
PATCH 6/11 fm10k: reduce the scope of the tx_buffer variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
The tx_buffer local variable in the function fm10k_clean_tx_ring is not used except inside a smaller block scope. Reduce the scope to its point of use.
This was detected by cppcheck and resolves the following style warning produced by that tool:
[fm10k_netdev.c:179]: (style) The scope of the variable 'tx_buffer' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +2 -2
@@ -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) { -struct fm10k_tx_buffer *tx_buffer;unsigned long size;u16 i;
@@ -179,7 +178,8 @@ static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring)/* Free all the Tx ring sk_buffs */ 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); }
Signature · 1 line
2.21.0
This series for fm10k, by Jake Keller, reduces the scope of local variables where possible.
The following are changes since commit a8e600e2184f45c40025cbe4d7e8893b69378a9f:
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 100GbE
Jacob Keller (11):
fm10k: reduce scope of the err variable
fm10k: reduce scope of *p local variable
fm10k: reduce the scope of qv local variable
fm10k: reduce the scope of local err variable
fm10k: reduce the scope of the q_idx local variable
fm10k: reduce the scope of the tx_buffer variable
fm10k: reduce the scope of the err variable
fm10k: reduce the scope of the local i variable
fm10k: reduce the scope of the local msg variable
fm10k: reduce the scope of the result local variable
fm10k: reduce scope of the ring variable
drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c | 6 +++--- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 9 ++++----- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 5 +++-- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +++++---- drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 6 ++++-- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 8 ++++---- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 9 +++++---- drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 3 +-- 8 files changed, 29 insertions(+), 26 deletions(-)
Signature · 1 line
2.21.0
PATCH 7/11 fm10k: reduce the scope of the err variable
From: Jacob Keller <[email protected]>
Reduce the scope of the local variable err in the fm10k_detach_subtask function.
This was detected by cppcheck and resolves the following warning produced by that tool:
[fm10k_pci.c:403]: (style) The scope of the variable 'err' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +3 -2
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2019 Intel Corporation. */ #include <linux/module.h> #include <linux/interrupt.h>
@@ -344,7 +344,6 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface)struct net_device *netdev = interface->netdev;u32 __iomem *hw_addr;u32 value; -int err;/* do nothing if netdev is still present or hw_addr is set */ if (netif_device_present (netdev) || interface->hw.hw_addr)
@@ -362,6 +361,8 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface) hw_addr =READ_ONCE (interface->uc_addr); value =readl (hw_addr);if (~value) { +int err; +/* Make sure the reset was initiated because we detached, * otherwise we might race with a different reset flow. */
Signature · 1 line
2.21.0
PATCH 2/11 fm10k: reduce scope of *p local variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the char *p local variable to only the block where it is used.
This was detected by cppcheck and resolves the following style warning produced by that tool:
[fm10k_ethtool.c:229]: (style) The scope of the variable 'p' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c +2 -3
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2019 Intel Corporation. */ #include <linux/vmalloc.h>
@@ -222,7 +222,6 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer, const unsigned int size) {unsigned int i; -char *p;if (!pointer) {/* 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, }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) {case sizeof (u64):
Signature · 1 line
2.21.0
PATCH 1/11 fm10k: reduce scope of the err variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the err local variable in the fm10k_dcbnl_ieee_setets function.
This was detected using cppcheck, and resolves the following style warning:
[fm10k_dcbnl.c:37]: (style) The scope of the variable 'err' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c +3 -3
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2019 Intel Corporation. */ #include "fm10k.h"
@@ -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) {u8 num_tc =0 ; -int i, err; +int i;/* verify type and determine num_tcs needed */ 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)/* update TC hardware mapping if necessary */ 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)return err; }
Signature · 1 line
2.21.0
PATCH 8/11 fm10k: reduce the scope of the local i variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the local loop variable in the fm10k_check_hang_subtask function.
This was detected by cppcheck and resolves the following warning produced by that tool:
[driver/fm10k_pci.c:852]: (style) The scope of the variable 'i' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +2 -2
@@ -698,8 +698,6 @@ static void fm10k_watchdog_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 (test_bit (__FM10K_DOWN, interface->state) ||test_bit (__FM10K_RESETTING, interface->state))
@@ -711,6 +709,8 @@ static void fm10k_check_hang_subtask(struct fm10k_intfc *interface) interface->next_tx_hang_check = jiffies + (2 *HZ );if (netif_carrier_ok (interface->netdev)) { +int i; +/* Force detection of hung controller */ for (i =0 ; i < interface->num_tx_queues; i++)set_check_for_tx_hang (interface->tx_ring[i]);
Signature · 1 line
2.21.0
PATCH 9/11 fm10k: reduce the scope of the local msg variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
The msg variable in the fm10k_mbx_validate_msg_size and fm10k_sm_mbx_transmit functions is only used within the do {} loop scope. Reduce its scope only to where it is used.
This was detected by cppcheck, and resolves the following warnings produced by that tool:
[fm10k_mbx.c:299]: (style) The scope of the variable 'msg' can be reduced. [fm10k_mbx.c:2004]: (style) The scope of the variable 'msg' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_mbx.c +4 -2
@@ -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;u16 total_len =0 , msg_len; -u32 *msg;/* length should include previous amounts pushed */ len += mbx->pushed;/* offset in message is based off of current message size */ do { + u32 *msg; + msg = fifo->buffer + fm10k_fifo_tail_offset(fifo, total_len); msg_len = FM10K_TLV_DWORD_LEN(*msg); total_len += msg_len;
@@ -1920,7 +1921,6 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,/* reduce length by 1 to convert to a mask */ u16 mbmem_len = mbx->mbmem_len -1 ;u16 tail_len, len =0 ; -u32 *msg;/* push head behind tail */ if (mbx->tail < head)
@@ -1930,6 +1930,8 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,/* determine msg aligned offset for end of buffer */ do { + u32 *msg; + msg = fifo->buffer + fm10k_fifo_head_offset(fifo, len); tail_len = len; len += FM10K_TLV_DWORD_LEN(*msg);
Signature · 1 line
2.21.0
PATCH 10/11 fm10k: reduce the scope of the result local variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the result local variable in the fm10k_iov_msg_lport_state_pf function.
This was detected by cppcheck and resolves the following warning produced by that tool:
[fm10k_pf.c:1435]: (style) The scope of the variable 'result' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pf.c +1 -2
@@ -1352,7 +1352,6 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results, struct fm10k_mbx_info *mbx) {struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx; -u32 *result;s32 err =0 ;u32 msg[2 ];u8 mode =0 ;
@@ -1362,7 +1361,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,return FM10K_ERR_PARAM ;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 */ err =fm10k_tlv_attr_get_u8 (result, &mode);
Signature · 1 line
2.21.0
PATCH 11/11 fm10k: reduce scope of the ring variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the ring local variable in the fm10k_assign_l2_accel function.
This was detected by cppcheck and resolves the following warning produced by that tool:
[fm10k_netdev.c:1447]: (style) The scope of the variable 'ring' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +2 -2
@@ -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,struct fm10k_l2_accel *l2_accel) { -struct fm10k_ring *ring;int 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); }
Signature · 1 line
2.21.0
PATCH 3/11 fm10k: reduce the scope of qv local variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the qv vector pointer local variable in the fm10k_set_coalesce function.
This was detected by cppcheck and resolves the following style warning produced by that tool:
[fm10k_ethtool.c:658]: (style) The scope of the variable 'qv' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c +2 -2
@@ -650,7 +650,6 @@ static int fm10k_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) {struct fm10k_intfc *interface =netdev_priv (dev); -struct fm10k_q_vector *qv;u16 tx_itr, rx_itr;int i;
@@ -676,7 +675,8 @@ static int fm10k_set_coalesce(struct net_device *dev,/* update q_vectors */ 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->rx.itr = rx_itr; }
Signature · 1 line
2.21.0
PATCH 4/11 fm10k: reduce the scope of local err variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
Reduce the scope of the local err variable in the fm10k_iov_alloc_data function.
This was detected by cppcheck and resolves the following style warning produced by that tool:
[fm10k_iov.c:426]: (style) The scope of the variable 'err' can be reduced.
--- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +3 -2
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2019 Intel Corporation. */ #include "fm10k.h" #include "fm10k_vf.h"
@@ -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_hw *hw = &interface->hw;size_t size; -int i, err; +int i;/* return error if iov_data is already populated */ if (iov_data)
@@ -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 */ for (i =0 ; i < num_vfs; i++) {struct fm10k_vf_info *vf_info = &iov_data->vf_info[i]; +int err;/* Record VF VSI value */ vf_info->vsi = i +1 ;
Signature · 1 line
2.21.0
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Thu, 1 Aug 2019 15:25:37 -0700
Quoted 7 lines
This series for fm10k, by Jake Keller, reduces the scope of local variables where possible.
The following are changes since commit
a8e600e2184f45c40025cbe4d7e8893b69378a9f:
Merge branch '100GbE' ofgit://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue100GbE
Pulled, thanks Jeff.