Module Name: src Committed By: msaitoh Date: Thu Jun 2 01:57:27 UTC 2022
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixv.c Log Message: KNF. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.318 -r1.319 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.181 -r1.182 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.318 src/sys/dev/pci/ixgbe/ixgbe.c:1.319 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.318 Wed Jun 1 05:06:45 2022 +++ src/sys/dev/pci/ixgbe/ixgbe.c Thu Jun 2 01:57:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.318 2022/06/01 05:06:45 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.319 2022/06/02 01:57:27 msaitoh Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.318 2022/06/01 05:06:45 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.319 2022/06/02 01:57:27 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -629,12 +629,11 @@ ixgbe_initialize_receive_units(struct ad * so we do not need to clear the bit, but do it just in case * this code is moved elsewhere. */ - if (adapter->num_queues > 1 && - adapter->hw.fc.requested_mode == ixgbe_fc_none) { + if ((adapter->num_queues > 1) && + (adapter->hw.fc.requested_mode == ixgbe_fc_none)) srrctl |= IXGBE_SRRCTL_DROP_EN; - } else { + else srrctl &= ~IXGBE_SRRCTL_DROP_EN; - } IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(j), srrctl); @@ -893,7 +892,8 @@ ixgbe_attach(device_t parent, device_t d * Initialize the shared code */ if (ixgbe_init_shared_code(hw) != 0) { - aprint_error_dev(dev, "Unable to initialize the shared code\n"); + aprint_error_dev(dev, + "Unable to initialize the shared code\n"); error = ENXIO; goto err_out; } @@ -1178,7 +1178,8 @@ ixgbe_attach(device_t parent, device_t d error = ixgbe_start_hw(hw); switch (error) { case IXGBE_ERR_EEPROM_VERSION: - aprint_error_dev(dev, "This device is a pre-production adapter/" + aprint_error_dev(dev, + "This device is a pre-production adapter/" "LOM. Please be aware there may be issues associated " "with your hardware.\nIf you are experiencing problems " "please contact your Intel or hardware representative " @@ -1470,60 +1471,45 @@ ixgbe_add_media_types(struct adapter *ad ADD(IFM_NONE, 0); /* Media types with matching NetBSD media defines */ - if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) { + if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) ADD(IFM_10G_T | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T) { + if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T) ADD(IFM_1000_T | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_100BASE_TX) { + if (layer & IXGBE_PHYSICAL_LAYER_100BASE_TX) ADD(IFM_100_TX | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_10BASE_T) { + if (layer & IXGBE_PHYSICAL_LAYER_10BASE_T) ADD(IFM_10_T | IFM_FDX, 0); - } if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU || - layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA) { + layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA) ADD(IFM_10G_TWINAX | IFM_FDX, 0); - } if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LR) { ADD(IFM_10G_LR | IFM_FDX, 0); - if (hw->phy.multispeed_fiber) { + if (hw->phy.multispeed_fiber) ADD(IFM_1000_LX | IFM_FDX, 0); - } } if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR) { ADD(IFM_10G_SR | IFM_FDX, 0); - if (hw->phy.multispeed_fiber) { + if (hw->phy.multispeed_fiber) ADD(IFM_1000_SX | IFM_FDX, 0); - } - } else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) { + } else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) ADD(IFM_1000_SX | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4) { + if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4) ADD(IFM_10G_CX4 | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) { + if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) ADD(IFM_10G_KR | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) { + if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) ADD(IFM_10G_KX4 | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX) { + if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX) ADD(IFM_1000_KX | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX) { + if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX) ADD(IFM_2500_KX | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_T) { + if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_T) ADD(IFM_2500_T | IFM_FDX, 0); - } - if (layer & IXGBE_PHYSICAL_LAYER_5GBASE_T) { + if (layer & IXGBE_PHYSICAL_LAYER_5GBASE_T) ADD(IFM_5000_T | IFM_FDX, 0); - } if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX) ADD(IFM_1000_BX10 | IFM_FDX, 0); /* XXX no ifmedia_set? */ @@ -1673,13 +1659,17 @@ ixgbe_update_stats_counters(struct adapt IXGBE_EVC_REGADD(hw, stats, IXGBE_PXONTXC(i), pxontxc[i]); IXGBE_EVC_REGADD(hw, stats, IXGBE_PXOFFTXC(i), pxofftxc[i]); if (hw->mac.type >= ixgbe_mac_82599EB) { - IXGBE_EVC_REGADD(hw, stats, IXGBE_PXONRXCNT(i), pxonrxc[i]); - IXGBE_EVC_REGADD(hw, stats, IXGBE_PXOFFRXCNT(i), pxoffrxc[i]); - IXGBE_EVC_REGADD(hw, stats, IXGBE_PXON2OFFCNT(i), - pxon2offc[i]); + IXGBE_EVC_REGADD(hw, stats, + IXGBE_PXONRXCNT(i), pxonrxc[i]); + IXGBE_EVC_REGADD(hw, stats, + IXGBE_PXOFFRXCNT(i), pxoffrxc[i]); + IXGBE_EVC_REGADD(hw, stats, + IXGBE_PXON2OFFCNT(i), pxon2offc[i]); } else { - IXGBE_EVC_REGADD(hw, stats, IXGBE_PXONRXC(i), pxonrxc[i]); - IXGBE_EVC_REGADD(hw, stats, IXGBE_PXOFFRXC(i), pxoffrxc[i]); + IXGBE_EVC_REGADD(hw, stats, + IXGBE_PXONRXC(i), pxonrxc[i]); + IXGBE_EVC_REGADD(hw, stats, + IXGBE_PXOFFRXC(i), pxoffrxc[i]); } } IXGBE_EVC_ADD(&stats->mpctotal, total_missed_rx); @@ -1843,8 +1833,7 @@ ixgbe_add_hw_stats(struct adapter *adapt KASSERT(IXGBE_DCB_MAX_TRAFFIC_CLASS == 8); for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) { snprintf(adapter->tcs[i].evnamebuf, - sizeof(adapter->tcs[i].evnamebuf), "%s tc%d", - xname, i); + sizeof(adapter->tcs[i].evnamebuf), "%s tc%d", xname, i); if (i < __arraycount(stats->mpc)) { evcnt_attach_dynamic(&stats->mpc[i], EVCNT_TYPE_MISC, NULL, adapter->tcs[i].evnamebuf, @@ -1872,7 +1861,7 @@ ixgbe_add_hw_stats(struct adapter *adapt evcnt_attach_dynamic(&stats->pxon2offc[i], EVCNT_TYPE_MISC, NULL, adapter->tcs[i].evnamebuf, - "pxon2offc"); + "pxon2offc"); } } @@ -1882,13 +1871,13 @@ ixgbe_add_hw_stats(struct adapter *adapt #endif /* LRO */ snprintf(adapter->queues[i].evnamebuf, - sizeof(adapter->queues[i].evnamebuf), "%s q%d", - xname, i); + sizeof(adapter->queues[i].evnamebuf), "%s q%d", xname, i); snprintf(adapter->queues[i].namebuf, sizeof(adapter->queues[i].namebuf), "q%d", i); if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) { - aprint_error_dev(dev, "could not create sysctl root\n"); + aprint_error_dev(dev, + "could not create sysctl root\n"); break; } @@ -2678,7 +2667,9 @@ display: "PCIE Gen3 slot is required.\n"); } } else - device_printf(dev, "Unable to determine slot speed/width. The speed/width reported are that of the internal switch.\n"); + device_printf(dev, + "Unable to determine slot speed/width. The speed/width " + "reported are that of the internal switch.\n"); return; } /* ixgbe_get_slot_info */ @@ -2783,9 +2774,8 @@ ixgbe_sched_handle_que(struct adapter *a * twice workqueue_enqueue() is not required . */ workqueue_enqueue(adapter->que_wq, &que->wq_cookie, curcpu()); - } else { + } else softint_schedule(que->que_si); - } } /************************************************************************ @@ -2859,10 +2849,9 @@ ixgbe_msix_que(void *arg) * on 1G and higher. */ if ((adapter->link_speed != IXGBE_LINK_SPEED_100_FULL) - && (adapter->link_speed != IXGBE_LINK_SPEED_10_FULL)) { + && (adapter->link_speed != IXGBE_LINK_SPEED_10_FULL)) if (newitr < IXGBE_MIN_RSC_EITR_10G1G) newitr = IXGBE_MIN_RSC_EITR_10G1G; - } /* save for next interrupt */ que->eitr_setting = newitr; @@ -3287,7 +3276,6 @@ ixgbe_intr_admin_common(struct adapter * ixgbe_schedule_admin_tasklet(adapter); mutex_exit(&adapter->admin_mtx); } - } static void @@ -3918,7 +3906,6 @@ ixgbe_setup_low_power_mode(struct adapte /* Enable wakeups and power management in Wakeup Control */ IXGBE_WRITE_REG(hw, IXGBE_WUC, IXGBE_WUC_WKEN | IXGBE_WUC_PME_EN); - } IXGBE_CORE_UNLOCK(adapter); @@ -4744,7 +4731,11 @@ ixgbe_handle_recovery_mode_timer(struct if (ixgbe_fw_recovery_mode(hw)) { if (atomic_cas_uint(&adapter->recovery_mode, 0, 1) == 0) { /* Firmware error detected, entering recovery mode */ - device_printf(adapter->dev, "Firmware recovery mode detected. Limiting functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n"); + device_printf(adapter->dev, + "Firmware recovery mode detected. Limiting " + "functionality. Refer to the Intel(R) Ethernet " + "Adapters and Devices User Guide for details on " + "firmware recovery mode.\n"); if (hw->adapter_stopped == FALSE) ixgbe_stop_locked(adapter); @@ -4923,9 +4914,8 @@ ixgbe_handle_admin(struct work *wk, void ixgbe_handle_link(adapter); eims_enable |= IXGBE_EIMS_LSC; } - if ((task_requests & IXGBE_REQUEST_TASK_MOD_WOI) != 0) { + if ((task_requests & IXGBE_REQUEST_TASK_MOD_WOI) != 0) ixgbe_handle_mod(adapter, false); - } if ((task_requests & IXGBE_REQUEST_TASK_MOD) != 0) { ixgbe_handle_mod(adapter, true); if (hw->mac.type >= ixgbe_mac_X540) @@ -5318,7 +5308,6 @@ ixgbe_legacy_irq(void *arg) ixgbe_sched_handle_que(adapter, que); /* Disable queue 0 interrupt */ eims_disable |= 1UL << 0; - } else eims_enable |= eims_orig & IXGBE_EIMC_RTX_QUEUE; @@ -5574,7 +5563,8 @@ ixgbe_set_advertise(struct adapter *adap } if (advertise < 0x0 || advertise > 0x3f) { - device_printf(dev, "Invalid advertised speed; valid modes are 0x0 through 0x3f\n"); + device_printf(dev, "Invalid advertised speed; " + "valid modes are 0x0 through 0x3f\n"); return (EINVAL); } @@ -5582,7 +5572,8 @@ ixgbe_set_advertise(struct adapter *adap err = hw->mac.ops.get_link_capabilities(hw, &link_caps, &negotiate); if (err != IXGBE_SUCCESS) { - device_printf(dev, "Unable to determine supported advertise speeds\n"); + device_printf(dev, "Unable to determine supported " + "advertise speeds\n"); return (ENODEV); } } @@ -5590,42 +5581,48 @@ ixgbe_set_advertise(struct adapter *adap /* Set new value and report new advertised mode */ if (advertise & 0x1) { if (!(link_caps & IXGBE_LINK_SPEED_100_FULL)) { - device_printf(dev, "Interface does not support 100Mb advertised speed\n"); + device_printf(dev, "Interface does not support 100Mb " + "advertised speed\n"); return (EINVAL); } speed |= IXGBE_LINK_SPEED_100_FULL; } if (advertise & 0x2) { if (!(link_caps & IXGBE_LINK_SPEED_1GB_FULL)) { - device_printf(dev, "Interface does not support 1Gb advertised speed\n"); + device_printf(dev, "Interface does not support 1Gb " + "advertised speed\n"); return (EINVAL); } speed |= IXGBE_LINK_SPEED_1GB_FULL; } if (advertise & 0x4) { if (!(link_caps & IXGBE_LINK_SPEED_10GB_FULL)) { - device_printf(dev, "Interface does not support 10Gb advertised speed\n"); + device_printf(dev, "Interface does not support 10Gb " + "advertised speed\n"); return (EINVAL); } speed |= IXGBE_LINK_SPEED_10GB_FULL; } if (advertise & 0x8) { if (!(link_caps & IXGBE_LINK_SPEED_10_FULL)) { - device_printf(dev, "Interface does not support 10Mb advertised speed\n"); + device_printf(dev, "Interface does not support 10Mb " + "advertised speed\n"); return (EINVAL); } speed |= IXGBE_LINK_SPEED_10_FULL; } if (advertise & 0x10) { if (!(link_caps & IXGBE_LINK_SPEED_2_5GB_FULL)) { - device_printf(dev, "Interface does not support 2.5Gb advertised speed\n"); + device_printf(dev, "Interface does not support 2.5Gb " + "advertised speed\n"); return (EINVAL); } speed |= IXGBE_LINK_SPEED_2_5GB_FULL; } if (advertise & 0x20) { if (!(link_caps & IXGBE_LINK_SPEED_5GB_FULL)) { - device_printf(dev, "Interface does not support 5Gb advertised speed\n"); + device_printf(dev, "Interface does not support 5Gb " + "advertised speed\n"); return (EINVAL); } speed |= IXGBE_LINK_SPEED_5GB_FULL; @@ -7067,7 +7064,9 @@ ixgbe_configure_interrupts(struct adapte queues = uimin(queues, rss_getnumbuckets()); #endif if (ixgbe_num_queues > queues) { - aprint_error_dev(adapter->dev, "ixgbe_num_queues (%d) is too large, using reduced amount (%d).\n", ixgbe_num_queues, queues); + aprint_error_dev(adapter->dev, + "ixgbe_num_queues (%d) is too large, " + "using reduced amount (%d).\n", ixgbe_num_queues, queues); ixgbe_num_queues = queues; } @@ -7089,8 +7088,7 @@ ixgbe_configure_interrupts(struct adapte msgs = want; else { aprint_error_dev(dev, "MSI-X Configuration Problem, " - "%d vectors but %d queues wanted!\n", - msgs, want); + "%d vectors but %d queues wanted!\n", msgs, want); goto msi; } adapter->num_queues = queues; Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.181 src/sys/dev/pci/ixgbe/ixv.c:1.182 --- src/sys/dev/pci/ixgbe/ixv.c:1.181 Mon May 30 05:08:17 2022 +++ src/sys/dev/pci/ixgbe/ixv.c Thu Jun 2 01:57:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ixv.c,v 1.181 2022/05/30 05:08:17 msaitoh Exp $ */ +/* $NetBSD: ixv.c,v 1.182 2022/06/02 01:57:27 msaitoh Exp $ */ /****************************************************************************** @@ -35,7 +35,7 @@ /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.181 2022/05/30 05:08:17 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.182 2022/06/02 01:57:27 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1835,18 +1835,18 @@ ixv_initialize_rss_mapping(struct adapte if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_TCP; if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) - device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_IPV6_EX defined, but not supported\n", - __func__); + device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_IPV6_EX " + "defined, but not supported\n", __func__); if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6_EX) - device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_TCP_IPV6_EX defined, but not supported\n", - __func__); + device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_TCP_IPV6_EX " + "defined, but not supported\n", __func__); if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV4_UDP; if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_UDP; if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6_EX) - device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_UDP_IPV6_EX defined, but not supported\n", - __func__); + device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_UDP_IPV6_EX " + "defined, but not supported\n", __func__); IXGBE_WRITE_REG(hw, IXGBE_VFMRQC, mrqc); } /* ixv_initialize_rss_mapping */ @@ -1880,7 +1880,9 @@ ixv_initialize_receive_units(struct adap /* Tell PF our max_frame size */ if (ixgbevf_rlpml_set_vf(hw, adapter->max_frame_size) != 0) { - device_printf(adapter->dev, "There is a problem with the PF setup. It is likely the receive unit for this VF will not function correctly.\n"); + device_printf(adapter->dev, "There is a problem with the PF " + "setup. It is likely the receive unit for this VF will " + "not function correctly.\n"); } for (int i = 0; i < adapter->num_queues; i++, rxr++) { @@ -2643,13 +2645,13 @@ ixv_add_stats_sysctls(struct adapter *ad for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { snprintf(adapter->queues[i].evnamebuf, - sizeof(adapter->queues[i].evnamebuf), "%s q%d", - xname, i); + sizeof(adapter->queues[i].evnamebuf), "%s q%d", xname, i); snprintf(adapter->queues[i].namebuf, sizeof(adapter->queues[i].namebuf), "q%d", i); if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { - aprint_error_dev(dev, "could not create sysctl root\n"); + aprint_error_dev(dev, + "could not create sysctl root\n"); break; } @@ -3546,8 +3548,7 @@ ixv_configure_interrupts(struct adapter else { aprint_error_dev(dev, "MSI-X Configuration Problem, " - "%d vectors but %d queues wanted!\n", - msgs, want); + "%d vectors but %d queues wanted!\n", msgs, want); return -1; }