Skip to content

Commit 598e74f

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says: ==================== This series contains updates to ixgbe only. Only change to this series is I dropped the "ixgbe: Add support for pipeline reset" due to change requested by Martin Josefsson. Alexander Duyck (7): ixgbe: Add support for IPv6 and UDP to ixgbe_get_headlen ixgbe: Add support for tracking the default user priority to SR-IOV ixgbe: Add support for GET_QUEUES message to get DCB configuration ixgbe: Enable support for VF API version 1.1 in the PF. ixgbevf: Add VF DCB + SR-IOV support ixgbe: Drop unnecessary addition from ixgbe_set_rx_buffer_len ixgbe: Fix possible memory leak in ixgbe_set_ringparam Don Skidmore (1): ixgbe: Add function ixgbe_reset_pipeline_82599 Emil Tantilov (1): ixgbe: add WOL support for new subdevice id Jacob Keller (1): ixgbe: (PTP) refactor init, cyclecounter and reset Tushar Dave (1): ixgbe: Correcting small packet padding Wei Yongjun (1): ixgbe: using is_zero_ether_addr() to simplify the code ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 9f651ca + 1f4702a commit 598e74f

File tree

16 files changed

+539
-167
lines changed

16 files changed

+539
-167
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ struct ixgbe_adapter {
483483
#define IXGBE_FLAG2_FDIR_REQUIRES_REINIT (u32)(1 << 7)
484484
#define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP (u32)(1 << 8)
485485
#define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP (u32)(1 << 9)
486-
#define IXGBE_FLAG2_OVERFLOW_CHECK_ENABLED (u32)(1 << 10)
486+
#define IXGBE_FLAG2_PTP_ENABLED (u32)(1 << 10)
487487
#define IXGBE_FLAG2_PTP_PPS_ENABLED (u32)(1 << 11)
488488

489489
/* Tx fast path data */
@@ -581,7 +581,6 @@ struct ixgbe_adapter {
581581
struct timecounter tc;
582582
int rx_hwtstamp_filter;
583583
u32 base_incval;
584-
u32 cycle_speed;
585584
#endif /* CONFIG_IXGBE_PTP */
586585

587586
/* SR-IOV */
@@ -601,6 +600,8 @@ struct ixgbe_adapter {
601600
#ifdef CONFIG_DEBUG_FS
602601
struct dentry *ixgbe_dbg_adapter;
603602
#endif /*CONFIG_DEBUG_FS*/
603+
604+
u8 default_up;
604605
};
605606

606607
struct ixgbe_fdir_filter {
@@ -752,6 +753,7 @@ extern void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
752753
extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
753754
struct ifreq *ifr, int cmd);
754755
extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter);
756+
extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter);
755757
extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr);
756758
#endif /* CONFIG_IXGBE_PTP */
757759

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,50 @@ static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw,
20802080
return ret_val;
20812081
}
20822082

2083+
/**
2084+
* ixgbe_reset_pipeline_82599 - perform pipeline reset
2085+
*
2086+
* @hw: pointer to hardware structure
2087+
*
2088+
* Reset pipeline by asserting Restart_AN together with LMS change to ensure
2089+
* full pipeline reset. Note - We must hold the SW/FW semaphore before writing
2090+
* to AUTOC, so this function assumes the semaphore is held.
2091+
**/
2092+
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
2093+
{
2094+
s32 i, autoc_reg, ret_val;
2095+
s32 anlp1_reg = 0;
2096+
2097+
autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2098+
autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2099+
2100+
/* Write AUTOC register with toggled LMS[2] bit and Restart_AN */
2101+
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg ^ IXGBE_AUTOC_LMS_1G_AN);
2102+
2103+
/* Wait for AN to leave state 0 */
2104+
for (i = 0; i < 10; i++) {
2105+
usleep_range(4000, 8000);
2106+
anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1);
2107+
if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)
2108+
break;
2109+
}
2110+
2111+
if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) {
2112+
hw_dbg(hw, "auto negotiation not completed\n");
2113+
ret_val = IXGBE_ERR_RESET_FAILED;
2114+
goto reset_pipeline_out;
2115+
}
2116+
2117+
ret_val = 0;
2118+
2119+
reset_pipeline_out:
2120+
/* Write AUTOC register with original LMS field and Restart_AN */
2121+
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2122+
IXGBE_WRITE_FLUSH(hw);
2123+
2124+
return ret_val;
2125+
}
2126+
20832127
static struct ixgbe_mac_operations mac_ops_82599 = {
20842128
.init_hw = &ixgbe_init_hw_generic,
20852129
.reset_hw = &ixgbe_reset_hw_82599,

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,8 +1778,7 @@ s32 ixgbe_validate_mac_addr(u8 *mac_addr)
17781778
else if (IXGBE_IS_BROADCAST(mac_addr))
17791779
status = IXGBE_ERR_INVALID_MAC_ADDR;
17801780
/* Reject the zero address */
1781-
else if (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 &&
1782-
mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0)
1781+
else if (is_zero_ether_addr(mac_addr))
17831782
status = IXGBE_ERR_INVALID_MAC_ADDR;
17841783

17851784
return status;

drivers/net/ethernet/intel/ixgbe/ixgbe_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
107107

108108
void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb,
109109
u32 headroom, int strategy);
110+
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
110111

111112
#define IXGBE_I2C_THERMAL_SENSOR_ADDR 0xF8
112113
#define IXGBE_EMC_INTERNAL_DATA 0x00

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -887,24 +887,23 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
887887
struct ethtool_ringparam *ring)
888888
{
889889
struct ixgbe_adapter *adapter = netdev_priv(netdev);
890-
struct ixgbe_ring *temp_tx_ring, *temp_rx_ring;
890+
struct ixgbe_ring *temp_ring;
891891
int i, err = 0;
892892
u32 new_rx_count, new_tx_count;
893-
bool need_update = false;
894893

895894
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
896895
return -EINVAL;
897896

898-
new_rx_count = max_t(u32, ring->rx_pending, IXGBE_MIN_RXD);
899-
new_rx_count = min_t(u32, new_rx_count, IXGBE_MAX_RXD);
900-
new_rx_count = ALIGN(new_rx_count, IXGBE_REQ_RX_DESCRIPTOR_MULTIPLE);
901-
902-
new_tx_count = max_t(u32, ring->tx_pending, IXGBE_MIN_TXD);
903-
new_tx_count = min_t(u32, new_tx_count, IXGBE_MAX_TXD);
897+
new_tx_count = clamp_t(u32, ring->tx_pending,
898+
IXGBE_MIN_TXD, IXGBE_MAX_TXD);
904899
new_tx_count = ALIGN(new_tx_count, IXGBE_REQ_TX_DESCRIPTOR_MULTIPLE);
905900

906-
if ((new_tx_count == adapter->tx_ring[0]->count) &&
907-
(new_rx_count == adapter->rx_ring[0]->count)) {
901+
new_rx_count = clamp_t(u32, ring->rx_pending,
902+
IXGBE_MIN_RXD, IXGBE_MAX_RXD);
903+
new_rx_count = ALIGN(new_rx_count, IXGBE_REQ_RX_DESCRIPTOR_MULTIPLE);
904+
905+
if ((new_tx_count == adapter->tx_ring_count) &&
906+
(new_rx_count == adapter->rx_ring_count)) {
908907
/* nothing to do */
909908
return 0;
910909
}
@@ -922,81 +921,80 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
922921
goto clear_reset;
923922
}
924923

925-
temp_tx_ring = vmalloc(adapter->num_tx_queues * sizeof(struct ixgbe_ring));
926-
if (!temp_tx_ring) {
924+
/* allocate temporary buffer to store rings in */
925+
i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues);
926+
temp_ring = vmalloc(i * sizeof(struct ixgbe_ring));
927+
928+
if (!temp_ring) {
927929
err = -ENOMEM;
928930
goto clear_reset;
929931
}
930932

933+
ixgbe_down(adapter);
934+
935+
/*
936+
* Setup new Tx resources and free the old Tx resources in that order.
937+
* We can then assign the new resources to the rings via a memcpy.
938+
* The advantage to this approach is that we are guaranteed to still
939+
* have resources even in the case of an allocation failure.
940+
*/
931941
if (new_tx_count != adapter->tx_ring_count) {
932942
for (i = 0; i < adapter->num_tx_queues; i++) {
933-
memcpy(&temp_tx_ring[i], adapter->tx_ring[i],
943+
memcpy(&temp_ring[i], adapter->tx_ring[i],
934944
sizeof(struct ixgbe_ring));
935-
temp_tx_ring[i].count = new_tx_count;
936-
err = ixgbe_setup_tx_resources(&temp_tx_ring[i]);
945+
946+
temp_ring[i].count = new_tx_count;
947+
err = ixgbe_setup_tx_resources(&temp_ring[i]);
937948
if (err) {
938949
while (i) {
939950
i--;
940-
ixgbe_free_tx_resources(&temp_tx_ring[i]);
951+
ixgbe_free_tx_resources(&temp_ring[i]);
941952
}
942-
goto clear_reset;
953+
goto err_setup;
943954
}
944955
}
945-
need_update = true;
946-
}
947956

948-
temp_rx_ring = vmalloc(adapter->num_rx_queues * sizeof(struct ixgbe_ring));
949-
if (!temp_rx_ring) {
950-
err = -ENOMEM;
951-
goto err_setup;
957+
for (i = 0; i < adapter->num_tx_queues; i++) {
958+
ixgbe_free_tx_resources(adapter->tx_ring[i]);
959+
960+
memcpy(adapter->tx_ring[i], &temp_ring[i],
961+
sizeof(struct ixgbe_ring));
962+
}
963+
964+
adapter->tx_ring_count = new_tx_count;
952965
}
953966

967+
/* Repeat the process for the Rx rings if needed */
954968
if (new_rx_count != adapter->rx_ring_count) {
955969
for (i = 0; i < adapter->num_rx_queues; i++) {
956-
memcpy(&temp_rx_ring[i], adapter->rx_ring[i],
970+
memcpy(&temp_ring[i], adapter->rx_ring[i],
957971
sizeof(struct ixgbe_ring));
958-
temp_rx_ring[i].count = new_rx_count;
959-
err = ixgbe_setup_rx_resources(&temp_rx_ring[i]);
972+
973+
temp_ring[i].count = new_rx_count;
974+
err = ixgbe_setup_rx_resources(&temp_ring[i]);
960975
if (err) {
961976
while (i) {
962977
i--;
963-
ixgbe_free_rx_resources(&temp_rx_ring[i]);
978+
ixgbe_free_rx_resources(&temp_ring[i]);
964979
}
965980
goto err_setup;
966981
}
982+
967983
}
968-
need_update = true;
969-
}
970984

971-
/* if rings need to be updated, here's the place to do it in one shot */
972-
if (need_update) {
973-
ixgbe_down(adapter);
985+
for (i = 0; i < adapter->num_rx_queues; i++) {
986+
ixgbe_free_rx_resources(adapter->rx_ring[i]);
974987

975-
/* tx */
976-
if (new_tx_count != adapter->tx_ring_count) {
977-
for (i = 0; i < adapter->num_tx_queues; i++) {
978-
ixgbe_free_tx_resources(adapter->tx_ring[i]);
979-
memcpy(adapter->tx_ring[i], &temp_tx_ring[i],
980-
sizeof(struct ixgbe_ring));
981-
}
982-
adapter->tx_ring_count = new_tx_count;
988+
memcpy(adapter->rx_ring[i], &temp_ring[i],
989+
sizeof(struct ixgbe_ring));
983990
}
984991

985-
/* rx */
986-
if (new_rx_count != adapter->rx_ring_count) {
987-
for (i = 0; i < adapter->num_rx_queues; i++) {
988-
ixgbe_free_rx_resources(adapter->rx_ring[i]);
989-
memcpy(adapter->rx_ring[i], &temp_rx_ring[i],
990-
sizeof(struct ixgbe_ring));
991-
}
992-
adapter->rx_ring_count = new_rx_count;
993-
}
994-
ixgbe_up(adapter);
992+
adapter->rx_ring_count = new_rx_count;
995993
}
996994

997-
vfree(temp_rx_ring);
998995
err_setup:
999-
vfree(temp_tx_ring);
996+
ixgbe_up(adapter);
997+
vfree(temp_ring);
1000998
clear_reset:
1001999
clear_bit(__IXGBE_RESETTING, &adapter->state);
10021000
return err;

0 commit comments

Comments
 (0)