Skip to content

Commit 63c64de

Browse files
committed
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 2017-01-08 This series contains updates to fm10k only. Ngai-Mint changes the driver to use the MAC pointer in the fm10k_mac_info structure for fm10k_get_host_state_generic(). Fixed a race condition where the mailbox interrupt request bits can be cleared before being handled causing certain mailbox messages from the PF to be untreated and the PF will enter in some inactive state. Jake removes the typecast of u8 to char, and the extra variable that was created for the typecast. Bumps the driver version. Added back the receive descriptor timestamp value so that applications built on top of the IES API can function properly. Cleaned up the debug statistics flag, since debug statistics were removed and the flag was missed in the removal. Scott limits the DMA sync for CPU to the actual length of the packet, instead of the entire buffer, since the DMA sync occurs every time a packet is received. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents dc33da5 + 0035ddf commit 63c64de

File tree

7 files changed

+33
-30
lines changed

7 files changed

+33
-30
lines changed

drivers/net/ethernet/intel/fm10k/fm10k.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ struct fm10k_intfc {
260260
#define FM10K_FLAG_RESET_REQUESTED (u32)(BIT(0))
261261
#define FM10K_FLAG_RSS_FIELD_IPV4_UDP (u32)(BIT(1))
262262
#define FM10K_FLAG_RSS_FIELD_IPV6_UDP (u32)(BIT(2))
263-
#define FM10K_FLAG_RX_TS_ENABLED (u32)(BIT(3))
264-
#define FM10K_FLAG_SWPRI_CONFIG (u32)(BIT(4))
265-
#define FM10K_FLAG_DEBUG_STATS (u32)(BIT(5))
263+
#define FM10K_FLAG_SWPRI_CONFIG (u32)(BIT(3))
266264
int xcast_mode;
267265

268266
/* Tx fast path data */

drivers/net/ethernet/intel/fm10k/fm10k_common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
506506
goto out;
507507

508508
/* if we somehow dropped the Tx enable we should reset */
509-
if (hw->mac.tx_ready && !(txdctl & FM10K_TXDCTL_ENABLE)) {
509+
if (mac->tx_ready && !(txdctl & FM10K_TXDCTL_ENABLE)) {
510510
ret_val = FM10K_ERR_RESET_REQUESTED;
511511
goto out;
512512
}
@@ -523,8 +523,8 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
523523

524524
/* interface cannot receive traffic without logical ports */
525525
if (mac->dglort_map == FM10K_DGLORTMAP_NONE) {
526-
if (hw->mac.ops.request_lport_map)
527-
ret_val = hw->mac.ops.request_lport_map(hw);
526+
if (mac->ops.request_lport_map)
527+
ret_val = mac->ops.request_lport_map(hw);
528528

529529
goto out;
530530
}

drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ enum {
148148
static const char fm10k_prv_flags[FM10K_PRV_FLAG_LEN][ETH_GSTRING_LEN] = {
149149
};
150150

151-
static void fm10k_add_stat_strings(char **p, const char *prefix,
151+
static void fm10k_add_stat_strings(u8 **p, const char *prefix,
152152
const struct fm10k_stats stats[],
153153
const unsigned int size)
154154
{
@@ -164,32 +164,31 @@ static void fm10k_add_stat_strings(char **p, const char *prefix,
164164
static void fm10k_get_stat_strings(struct net_device *dev, u8 *data)
165165
{
166166
struct fm10k_intfc *interface = netdev_priv(dev);
167-
char *p = (char *)data;
168167
unsigned int i;
169168

170-
fm10k_add_stat_strings(&p, "", fm10k_gstrings_net_stats,
169+
fm10k_add_stat_strings(&data, "", fm10k_gstrings_net_stats,
171170
FM10K_NETDEV_STATS_LEN);
172171

173-
fm10k_add_stat_strings(&p, "", fm10k_gstrings_global_stats,
172+
fm10k_add_stat_strings(&data, "", fm10k_gstrings_global_stats,
174173
FM10K_GLOBAL_STATS_LEN);
175174

176-
fm10k_add_stat_strings(&p, "", fm10k_gstrings_mbx_stats,
175+
fm10k_add_stat_strings(&data, "", fm10k_gstrings_mbx_stats,
177176
FM10K_MBX_STATS_LEN);
178177

179178
if (interface->hw.mac.type != fm10k_mac_vf)
180-
fm10k_add_stat_strings(&p, "", fm10k_gstrings_pf_stats,
179+
fm10k_add_stat_strings(&data, "", fm10k_gstrings_pf_stats,
181180
FM10K_PF_STATS_LEN);
182181

183182
for (i = 0; i < interface->hw.mac.max_queues; i++) {
184183
char prefix[ETH_GSTRING_LEN];
185184

186185
snprintf(prefix, ETH_GSTRING_LEN, "tx_queue_%u_", i);
187-
fm10k_add_stat_strings(&p, prefix,
186+
fm10k_add_stat_strings(&data, prefix,
188187
fm10k_gstrings_queue_stats,
189188
FM10K_QUEUE_STATS_LEN);
190189

191190
snprintf(prefix, ETH_GSTRING_LEN, "rx_queue_%u_", i);
192-
fm10k_add_stat_strings(&p, prefix,
191+
fm10k_add_stat_strings(&data, prefix,
193192
fm10k_gstrings_queue_stats,
194193
FM10K_QUEUE_STATS_LEN);
195194
}
@@ -198,18 +197,16 @@ static void fm10k_get_stat_strings(struct net_device *dev, u8 *data)
198197
static void fm10k_get_strings(struct net_device *dev,
199198
u32 stringset, u8 *data)
200199
{
201-
char *p = (char *)data;
202-
203200
switch (stringset) {
204201
case ETH_SS_TEST:
205-
memcpy(data, *fm10k_gstrings_test,
202+
memcpy(data, fm10k_gstrings_test,
206203
FM10K_TEST_LEN * ETH_GSTRING_LEN);
207204
break;
208205
case ETH_SS_STATS:
209206
fm10k_get_stat_strings(dev, data);
210207
break;
211208
case ETH_SS_PRIV_FLAGS:
212-
memcpy(p, fm10k_prv_flags,
209+
memcpy(data, fm10k_prv_flags,
213210
FM10K_PRV_FLAG_LEN * ETH_GSTRING_LEN);
214211
break;
215212
}

drivers/net/ethernet/intel/fm10k/fm10k_main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "fm10k.h"
3030

31-
#define DRV_VERSION "0.21.2-k"
31+
#define DRV_VERSION "0.21.7-k"
3232
#define DRV_SUMMARY "Intel(R) Ethernet Switch Host Interface Driver"
3333
const char fm10k_driver_version[] = DRV_VERSION;
3434
char fm10k_driver_name[] = "fm10k";
@@ -251,6 +251,7 @@ static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer,
251251
/**
252252
* fm10k_add_rx_frag - Add contents of Rx buffer to sk_buff
253253
* @rx_buffer: buffer containing page to add
254+
* @size: packet size from rx_desc
254255
* @rx_desc: descriptor containing length of buffer written by hardware
255256
* @skb: sk_buff to place the data into
256257
*
@@ -263,12 +264,12 @@ static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer,
263264
* true if the buffer can be reused by the interface.
264265
**/
265266
static bool fm10k_add_rx_frag(struct fm10k_rx_buffer *rx_buffer,
267+
unsigned int size,
266268
union fm10k_rx_desc *rx_desc,
267269
struct sk_buff *skb)
268270
{
269271
struct page *page = rx_buffer->page;
270272
unsigned char *va = page_address(page) + rx_buffer->page_offset;
271-
unsigned int size = le16_to_cpu(rx_desc->w.length);
272273
#if (PAGE_SIZE < 8192)
273274
unsigned int truesize = FM10K_RX_BUFSZ;
274275
#else
@@ -314,6 +315,7 @@ static struct sk_buff *fm10k_fetch_rx_buffer(struct fm10k_ring *rx_ring,
314315
union fm10k_rx_desc *rx_desc,
315316
struct sk_buff *skb)
316317
{
318+
unsigned int size = le16_to_cpu(rx_desc->w.length);
317319
struct fm10k_rx_buffer *rx_buffer;
318320
struct page *page;
319321

@@ -350,11 +352,11 @@ static struct sk_buff *fm10k_fetch_rx_buffer(struct fm10k_ring *rx_ring,
350352
dma_sync_single_range_for_cpu(rx_ring->dev,
351353
rx_buffer->dma,
352354
rx_buffer->page_offset,
353-
FM10K_RX_BUFSZ,
355+
size,
354356
DMA_FROM_DEVICE);
355357

356358
/* pull page into skb */
357-
if (fm10k_add_rx_frag(rx_buffer, rx_desc, skb)) {
359+
if (fm10k_add_rx_frag(rx_buffer, size, rx_desc, skb)) {
358360
/* hand second half of page back to the ring */
359361
fm10k_reuse_rx_page(rx_ring, rx_buffer);
360362
} else {
@@ -473,6 +475,8 @@ static unsigned int fm10k_process_skb_fields(struct fm10k_ring *rx_ring,
473475

474476
fm10k_rx_checksum(rx_ring, rx_desc, skb);
475477

478+
FM10K_CB(skb)->tstamp = rx_desc->q.timestamp;
479+
476480
FM10K_CB(skb)->fi.w.vlan = rx_desc->w.vlan;
477481

478482
skb_record_rx_queue(skb, rx_ring->queue_index);

drivers/net/ethernet/intel/fm10k/fm10k_mbx.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,9 +2011,10 @@ static void fm10k_sm_mbx_create_reply(struct fm10k_hw *hw,
20112011
* function can also be used to respond to an error as the connection
20122012
* resetting would also be a means of dealing with errors.
20132013
**/
2014-
static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
2015-
struct fm10k_mbx_info *mbx)
2014+
static s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
2015+
struct fm10k_mbx_info *mbx)
20162016
{
2017+
s32 err = 0;
20172018
const enum fm10k_mbx_state state = mbx->state;
20182019

20192020
switch (state) {
@@ -2026,6 +2027,7 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
20262027
case FM10K_STATE_OPEN:
20272028
/* flush any incomplete work */
20282029
fm10k_sm_mbx_connect_reset(mbx);
2030+
err = FM10K_ERR_RESET_REQUESTED;
20292031
break;
20302032
case FM10K_STATE_CONNECT:
20312033
/* Update remote value to match local value */
@@ -2035,6 +2037,8 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
20352037
}
20362038

20372039
fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
2040+
2041+
return err;
20382042
}
20392043

20402044
/**
@@ -2115,7 +2119,7 @@ static s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
21152119

21162120
switch (FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, SM_VER)) {
21172121
case 0:
2118-
fm10k_sm_mbx_process_reset(hw, mbx);
2122+
err = fm10k_sm_mbx_process_reset(hw, mbx);
21192123
break;
21202124
case FM10K_SM_MBX_VERSION:
21212125
err = fm10k_sm_mbx_process_version_1(hw, mbx);

drivers/net/ethernet/intel/fm10k/fm10k_pci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
11441144
struct fm10k_hw *hw = &interface->hw;
11451145
struct fm10k_mbx_info *mbx = &hw->mbx;
11461146
u32 eicr;
1147+
s32 err = 0;
11471148

11481149
/* unmask any set bits related to this interrupt */
11491150
eicr = fm10k_read_reg(hw, FM10K_EICR);
@@ -1159,12 +1160,15 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
11591160

11601161
/* service mailboxes */
11611162
if (fm10k_mbx_trylock(interface)) {
1162-
mbx->ops.process(hw, mbx);
1163+
err = mbx->ops.process(hw, mbx);
11631164
/* handle VFLRE events */
11641165
fm10k_iov_event(interface);
11651166
fm10k_mbx_unlock(interface);
11661167
}
11671168

1169+
if (err == FM10K_ERR_RESET_REQUESTED)
1170+
interface->flags |= FM10K_FLAG_RESET_REQUESTED;
1171+
11681172
/* if switch toggled state we should reset GLORTs */
11691173
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
11701174
/* force link down for at least 4 seconds */

drivers/net/ethernet/intel/fm10k/fm10k_pf.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ static s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)
7272
fm10k_write_flush(hw);
7373
udelay(FM10K_RESET_TIMEOUT);
7474

75-
/* Reset mailbox global interrupts */
76-
reg = FM10K_MBX_GLOBAL_REQ_INTERRUPT | FM10K_MBX_GLOBAL_ACK_INTERRUPT;
77-
fm10k_write_reg(hw, FM10K_GMBX, reg);
78-
7975
/* Verify we made it out of reset */
8076
reg = fm10k_read_reg(hw, FM10K_IP);
8177
if (!(reg & FM10K_IP_NOTINRESET))

0 commit comments

Comments
 (0)