Skip to content

Commit 3201a39

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 2016-08-29 This series contains updates to fm10k only. Jake provides all the changes in this series starting with fixes an issue where VF devices may fail during an unbind/bind and we will never zero the reference counter for the pci_dev structure. Updated the hot path to use SW counters instead of checking for hardware Tx pending for possible transmit hangs, which will improve performance. Fixed the NAPI budget accounting so that fm10k_poll will return actual work done, capped at (budget - 1) instead of returning 0. Added a check to ensure that the device is in the normal IO state before continuing to probe, which allows us to give a more descriptive message of what is wrong in the case of uncorrectable AER error. In preparation for adding Geneve Rx offload support, refactored the current VXLAN offload flow to be a bit more generic. Added support for receive offloads on one Geneve tunnel. Ensure that other bits in the RXQCTL register do not get cleared, to make sure that bits related to queue ownership are maintained. Fixed an issue in queue ownership assignment which casued a race condition between the PF and the VF such that potentially a VF could cause FUM fault errors due to normal PF/VF driver behavior. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 6abdd5f + 325782a commit 3201a39

File tree

10 files changed

+200
-122
lines changed

10 files changed

+200
-122
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ struct fm10k_iov_data {
240240
struct fm10k_vf_info vf_info[0];
241241
};
242242

243-
#define fm10k_vxlan_port_for_each(vp, intfc) \
244-
list_for_each_entry(vp, &(intfc)->vxlan_port, list)
245-
struct fm10k_vxlan_port {
243+
struct fm10k_udp_port {
246244
struct list_head list;
247245
sa_family_t sa_family;
248246
__be16 port;
@@ -335,8 +333,9 @@ struct fm10k_intfc {
335333
u32 reta[FM10K_RETA_SIZE];
336334
u32 rssrk[FM10K_RSSRK_SIZE];
337335

338-
/* VXLAN port tracking information */
336+
/* UDP encapsulation port tracking information */
339337
struct list_head vxlan_port;
338+
struct list_head geneve_port;
340339

341340
#ifdef CONFIG_DEBUG_FS
342341
struct dentry *dbg_intfc;
@@ -458,7 +457,7 @@ __be16 fm10k_tx_encap_offload(struct sk_buff *skb);
458457
netdev_tx_t fm10k_xmit_frame_ring(struct sk_buff *skb,
459458
struct fm10k_ring *tx_ring);
460459
void fm10k_tx_timeout_reset(struct fm10k_intfc *interface);
461-
u64 fm10k_get_tx_pending(struct fm10k_ring *ring);
460+
u64 fm10k_get_tx_pending(struct fm10k_ring *ring, bool in_sw);
462461
bool fm10k_check_tx_hang(struct fm10k_ring *tx_ring);
463462
void fm10k_alloc_rx_buffers(struct fm10k_ring *rx_ring, u16 cleaned_count);
464463

@@ -496,7 +495,6 @@ int fm10k_close(struct net_device *netdev);
496495

497496
/* Ethtool */
498497
void fm10k_set_ethtool_ops(struct net_device *dev);
499-
u32 fm10k_get_reta_size(struct net_device *netdev);
500498
void fm10k_write_reta(struct fm10k_intfc *interface, const u32 *indir);
501499

502500
/* IOV */

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt)
207207
/* clear tx_ready to prevent any false hits for reset */
208208
hw->mac.tx_ready = false;
209209

210+
if (FM10K_REMOVED(hw->hw_addr))
211+
return 0;
212+
210213
/* clear the enable bit for all rings */
211214
for (i = 0; i < q_cnt; i++) {
212215
reg = fm10k_read_reg(hw, FM10K_TXDCTL(i));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ u32 fm10k_read_reg(struct fm10k_hw *hw, int reg);
3434
/* write operations, indexed using DWORDS */
3535
#define fm10k_write_reg(hw, reg, val) \
3636
do { \
37-
u32 __iomem *hw_addr = ACCESS_ONCE((hw)->hw_addr); \
37+
u32 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \
3838
if (!FM10K_REMOVED(hw_addr)) \
3939
writel((val), &hw_addr[(reg)]); \
4040
} while (0)
4141

4242
/* Switch register write operations, index using DWORDS */
4343
#define fm10k_write_sw_reg(hw, reg, val) \
4444
do { \
45-
u32 __iomem *sw_addr = ACCESS_ONCE((hw)->sw_addr); \
45+
u32 __iomem *sw_addr = READ_ONCE((hw)->sw_addr); \
4646
if (!FM10K_REMOVED(sw_addr)) \
4747
writel((val), &sw_addr[(reg)]); \
4848
} while (0)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ static int fm10k_set_priv_flags(struct net_device *netdev, u32 priv_flags)
966966
return 0;
967967
}
968968

969-
u32 fm10k_get_reta_size(struct net_device __always_unused *netdev)
969+
static u32 fm10k_get_reta_size(struct net_device __always_unused *netdev)
970970
{
971971
return FM10K_RETA_SIZE * FM10K_RETA_ENTRIES_PER_REG;
972972
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ s32 fm10k_iov_event(struct fm10k_intfc *interface)
5151
int i;
5252

5353
/* if there is no iov_data then there is no mailbox to process */
54-
if (!ACCESS_ONCE(interface->iov_data))
54+
if (!READ_ONCE(interface->iov_data))
5555
return 0;
5656

5757
rcu_read_lock();
@@ -99,7 +99,7 @@ s32 fm10k_iov_mbx(struct fm10k_intfc *interface)
9999
int i;
100100

101101
/* if there is no iov_data then there is no mailbox to process */
102-
if (!ACCESS_ONCE(interface->iov_data))
102+
if (!READ_ONCE(interface->iov_data))
103103
return 0;
104104

105105
rcu_read_lock();

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static int __init fm10k_init_module(void)
5656
pr_info("%s\n", fm10k_copyright);
5757

5858
/* create driver workqueue */
59-
fm10k_workqueue = alloc_workqueue("fm10k", WQ_MEM_RECLAIM, 0);
59+
fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, fm10k_driver_name);
6060

6161
fm10k_dbg_init();
6262

@@ -651,11 +651,11 @@ static int fm10k_clean_rx_irq(struct fm10k_q_vector *q_vector,
651651
static struct ethhdr *fm10k_port_is_vxlan(struct sk_buff *skb)
652652
{
653653
struct fm10k_intfc *interface = netdev_priv(skb->dev);
654-
struct fm10k_vxlan_port *vxlan_port;
654+
struct fm10k_udp_port *vxlan_port;
655655

656656
/* we can only offload a vxlan if we recognize it as such */
657657
vxlan_port = list_first_entry_or_null(&interface->vxlan_port,
658-
struct fm10k_vxlan_port, list);
658+
struct fm10k_udp_port, list);
659659

660660
if (!vxlan_port)
661661
return NULL;
@@ -1128,13 +1128,24 @@ static u64 fm10k_get_tx_completed(struct fm10k_ring *ring)
11281128
return ring->stats.packets;
11291129
}
11301130

1131-
u64 fm10k_get_tx_pending(struct fm10k_ring *ring)
1131+
/**
1132+
* fm10k_get_tx_pending - how many Tx descriptors not processed
1133+
* @ring: the ring structure
1134+
* @in_sw: is tx_pending being checked in SW or in HW?
1135+
*/
1136+
u64 fm10k_get_tx_pending(struct fm10k_ring *ring, bool in_sw)
11321137
{
11331138
struct fm10k_intfc *interface = ring->q_vector->interface;
11341139
struct fm10k_hw *hw = &interface->hw;
1140+
u32 head, tail;
11351141

1136-
u32 head = fm10k_read_reg(hw, FM10K_TDH(ring->reg_idx));
1137-
u32 tail = fm10k_read_reg(hw, FM10K_TDT(ring->reg_idx));
1142+
if (likely(in_sw)) {
1143+
head = ring->next_to_clean;
1144+
tail = ring->next_to_use;
1145+
} else {
1146+
head = fm10k_read_reg(hw, FM10K_TDH(ring->reg_idx));
1147+
tail = fm10k_read_reg(hw, FM10K_TDT(ring->reg_idx));
1148+
}
11381149

11391150
return ((head <= tail) ? tail : tail + ring->count) - head;
11401151
}
@@ -1143,7 +1154,7 @@ bool fm10k_check_tx_hang(struct fm10k_ring *tx_ring)
11431154
{
11441155
u32 tx_done = fm10k_get_tx_completed(tx_ring);
11451156
u32 tx_done_old = tx_ring->tx_stats.tx_done_old;
1146-
u32 tx_pending = fm10k_get_tx_pending(tx_ring);
1157+
u32 tx_pending = fm10k_get_tx_pending(tx_ring, true);
11471158

11481159
clear_check_for_tx_hang(tx_ring);
11491160

@@ -1397,7 +1408,7 @@ static void fm10k_update_itr(struct fm10k_ring_container *ring_container)
13971408
* that the calculation will never get below a 1. The bit shift
13981409
* accounts for changes in the ITR due to PCIe link speed.
13991410
*/
1400-
itr_round = ACCESS_ONCE(ring_container->itr_scale) + 8;
1411+
itr_round = READ_ONCE(ring_container->itr_scale) + 8;
14011412
avg_wire_size += BIT(itr_round) - 1;
14021413
avg_wire_size >>= itr_round;
14031414

@@ -1473,7 +1484,7 @@ static int fm10k_poll(struct napi_struct *napi, int budget)
14731484
/* re-enable the q_vector */
14741485
fm10k_qv_enable(q_vector);
14751486

1476-
return 0;
1487+
return min(work_done, budget - 1);
14771488
}
14781489

14791490
/**

0 commit comments

Comments
 (0)