Skip to content

Commit 3668bb8

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2017-10-10 This series contains updates to i40e only. Stefano Brivio fixes the grammar in a function header comment. Alex fixes a memory leak where we were not correctly placing the pages from buffers that had been used to return a filter programming status back on the ring. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 365ff9d + 2b9478f commit 3668bb8

File tree

2 files changed

+37
-28
lines changed

2 files changed

+37
-28
lines changed

drivers/net/ethernet/intel/i40e/i40e_nvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static i40e_status i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset,
298298
}
299299

300300
/**
301-
* __i40e_read_nvm_word - Reads nvm word, assumes called does the locking
301+
* __i40e_read_nvm_word - Reads nvm word, assumes caller does the locking
302302
* @hw: pointer to the HW structure
303303
* @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
304304
* @data: word read from the Shadow RAM

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,32 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)
10371037
return false;
10381038
}
10391039

1040+
/**
1041+
* i40e_reuse_rx_page - page flip buffer and store it back on the ring
1042+
* @rx_ring: rx descriptor ring to store buffers on
1043+
* @old_buff: donor buffer to have page reused
1044+
*
1045+
* Synchronizes page for reuse by the adapter
1046+
**/
1047+
static void i40e_reuse_rx_page(struct i40e_ring *rx_ring,
1048+
struct i40e_rx_buffer *old_buff)
1049+
{
1050+
struct i40e_rx_buffer *new_buff;
1051+
u16 nta = rx_ring->next_to_alloc;
1052+
1053+
new_buff = &rx_ring->rx_bi[nta];
1054+
1055+
/* update, and store next to alloc */
1056+
nta++;
1057+
rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
1058+
1059+
/* transfer page from old buffer to new buffer */
1060+
new_buff->dma = old_buff->dma;
1061+
new_buff->page = old_buff->page;
1062+
new_buff->page_offset = old_buff->page_offset;
1063+
new_buff->pagecnt_bias = old_buff->pagecnt_bias;
1064+
}
1065+
10401066
/**
10411067
* i40e_rx_is_programming_status - check for programming status descriptor
10421068
* @qw: qword representing status_error_len in CPU ordering
@@ -1071,15 +1097,24 @@ static void i40e_clean_programming_status(struct i40e_ring *rx_ring,
10711097
union i40e_rx_desc *rx_desc,
10721098
u64 qw)
10731099
{
1074-
u32 ntc = rx_ring->next_to_clean + 1;
1100+
struct i40e_rx_buffer *rx_buffer;
1101+
u32 ntc = rx_ring->next_to_clean;
10751102
u8 id;
10761103

10771104
/* fetch, update, and store next to clean */
1105+
rx_buffer = &rx_ring->rx_bi[ntc++];
10781106
ntc = (ntc < rx_ring->count) ? ntc : 0;
10791107
rx_ring->next_to_clean = ntc;
10801108

10811109
prefetch(I40E_RX_DESC(rx_ring, ntc));
10821110

1111+
/* place unused page back on the ring */
1112+
i40e_reuse_rx_page(rx_ring, rx_buffer);
1113+
rx_ring->rx_stats.page_reuse_count++;
1114+
1115+
/* clear contents of buffer_info */
1116+
rx_buffer->page = NULL;
1117+
10831118
id = (qw & I40E_RX_PROG_STATUS_DESC_QW1_PROGID_MASK) >>
10841119
I40E_RX_PROG_STATUS_DESC_QW1_PROGID_SHIFT;
10851120

@@ -1638,32 +1673,6 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb,
16381673
return false;
16391674
}
16401675

1641-
/**
1642-
* i40e_reuse_rx_page - page flip buffer and store it back on the ring
1643-
* @rx_ring: rx descriptor ring to store buffers on
1644-
* @old_buff: donor buffer to have page reused
1645-
*
1646-
* Synchronizes page for reuse by the adapter
1647-
**/
1648-
static void i40e_reuse_rx_page(struct i40e_ring *rx_ring,
1649-
struct i40e_rx_buffer *old_buff)
1650-
{
1651-
struct i40e_rx_buffer *new_buff;
1652-
u16 nta = rx_ring->next_to_alloc;
1653-
1654-
new_buff = &rx_ring->rx_bi[nta];
1655-
1656-
/* update, and store next to alloc */
1657-
nta++;
1658-
rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
1659-
1660-
/* transfer page from old buffer to new buffer */
1661-
new_buff->dma = old_buff->dma;
1662-
new_buff->page = old_buff->page;
1663-
new_buff->page_offset = old_buff->page_offset;
1664-
new_buff->pagecnt_bias = old_buff->pagecnt_bias;
1665-
}
1666-
16671676
/**
16681677
* i40e_page_is_reusable - check if any reuse is possible
16691678
* @page: page struct to check

0 commit comments

Comments
 (0)