* [PATCH net 0/3] bnxt_en: Bug fixes for net.
@ 2016-04-25 6:30 Michael Chan
2016-04-25 6:30 ` [PATCH net 1/3] bnxt_en: Don't fallback to INTA on VF Michael Chan
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Michael Chan @ 2016-04-25 6:30 UTC (permalink / raw)
To: davem; +Cc: netdev
Only use MSIX on VF, and fix rx page buffers on architectures with
PAGE_SIZE >= 64K.
Michael Chan (3):
bnxt_en: Don't fallback to INTA on VF.
bnxt_en: Limit RX BD pages to be no bigger than 32K.
bnxt_en: Divide a page into 32K buffers for the aggregation ring if
necessary.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 53 +++++++++++++++++++++++--------
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 13 ++++++++
2 files changed, 52 insertions(+), 14 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net 1/3] bnxt_en: Don't fallback to INTA on VF.
2016-04-25 6:30 [PATCH net 0/3] bnxt_en: Bug fixes for net Michael Chan
@ 2016-04-25 6:30 ` Michael Chan
2016-04-25 6:30 ` [PATCH net 2/3] bnxt_en: Limit RX BD pages to be no bigger than 32K Michael Chan
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2016-04-25 6:30 UTC (permalink / raw)
To: davem; +Cc: netdev
Only MSI-X can be used on a VF. The driver should fail initialization
if it cannot successfully enable MSI-X.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 12a009d..e787deb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -4309,7 +4309,7 @@ static int bnxt_setup_int_mode(struct bnxt *bp)
if (bp->flags & BNXT_FLAG_MSIX_CAP)
rc = bnxt_setup_msix(bp);
- if (!(bp->flags & BNXT_FLAG_USING_MSIX)) {
+ if (!(bp->flags & BNXT_FLAG_USING_MSIX) && BNXT_PF(bp)) {
/* fallback to INTA */
rc = bnxt_setup_inta(bp);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net 2/3] bnxt_en: Limit RX BD pages to be no bigger than 32K.
2016-04-25 6:30 [PATCH net 0/3] bnxt_en: Bug fixes for net Michael Chan
2016-04-25 6:30 ` [PATCH net 1/3] bnxt_en: Don't fallback to INTA on VF Michael Chan
@ 2016-04-25 6:30 ` Michael Chan
2016-04-25 6:30 ` [PATCH net 3/3] bnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary Michael Chan
2016-04-27 20:19 ` [PATCH net 0/3] bnxt_en: Bug fixes for net David Miller
3 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2016-04-25 6:30 UTC (permalink / raw)
To: davem; +Cc: netdev
The RX BD length field of this device is 16-bit, so the largest buffer
size is 65535. For LRO and GRO, we allocate native CPU pages for the
aggregation ring buffers. It won't work if the native CPU page size is
64K or bigger.
We fix this by defining BNXT_RX_PAGE_SIZE to be native CPU page size
up to 32K. Replace PAGE_SIZE with BNXT_RX_PAGE_SIZE in all appropriate
places related to the rx aggregation ring logic.
The next patch will add additional logic to divide the page into 32K
chunks for aggrgation ring buffers if PAGE_SIZE is bigger than
BNXT_RX_PAGE_SIZE.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 18 +++++++++---------
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 9 +++++++++
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e787deb..28480f6 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -586,7 +586,7 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
if (!page)
return -ENOMEM;
- mapping = dma_map_page(&pdev->dev, page, 0, PAGE_SIZE,
+ mapping = dma_map_page(&pdev->dev, page, 0, BNXT_RX_PAGE_SIZE,
PCI_DMA_FROMDEVICE);
if (dma_mapping_error(&pdev->dev, mapping)) {
__free_page(page);
@@ -740,7 +740,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
return NULL;
}
- dma_unmap_page(&pdev->dev, mapping, PAGE_SIZE,
+ dma_unmap_page(&pdev->dev, mapping, BNXT_RX_PAGE_SIZE,
PCI_DMA_FROMDEVICE);
skb->data_len += frag_len;
@@ -1584,7 +1584,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
dma_unmap_page(&pdev->dev,
dma_unmap_addr(rx_agg_buf, mapping),
- PAGE_SIZE, PCI_DMA_FROMDEVICE);
+ BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE);
rx_agg_buf->page = NULL;
__clear_bit(j, rxr->rx_agg_bmap);
@@ -1973,7 +1973,7 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
if (!(bp->flags & BNXT_FLAG_AGG_RINGS))
return 0;
- type = ((u32)PAGE_SIZE << RX_BD_LEN_SHIFT) |
+ type = ((u32)BNXT_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) |
RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
bnxt_init_rxbd_pages(ring, type);
@@ -2164,7 +2164,7 @@ void bnxt_set_ring_params(struct bnxt *bp)
bp->rx_agg_nr_pages = 0;
if (bp->flags & BNXT_FLAG_TPA)
- agg_factor = 4;
+ agg_factor = min_t(u32, 4, 65536 / BNXT_RX_PAGE_SIZE);
bp->flags &= ~BNXT_FLAG_JUMBO;
if (rx_space > PAGE_SIZE) {
@@ -3020,12 +3020,12 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags)
/* Number of segs are log2 units, and first packet is not
* included as part of this units.
*/
- if (mss <= PAGE_SIZE) {
- n = PAGE_SIZE / mss;
+ if (mss <= BNXT_RX_PAGE_SIZE) {
+ n = BNXT_RX_PAGE_SIZE / mss;
nsegs = (MAX_SKB_FRAGS - 1) * n;
} else {
- n = mss / PAGE_SIZE;
- if (mss & (PAGE_SIZE - 1))
+ n = mss / BNXT_RX_PAGE_SIZE;
+ if (mss & (BNXT_RX_PAGE_SIZE - 1))
n++;
nsegs = (MAX_SKB_FRAGS - n) / n;
}
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 709b95b..0cf1e2a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -407,6 +407,15 @@ struct rx_tpa_end_cmp_ext {
#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT)
+/* The RXBD length is 16-bit so we can only support page sizes < 64K */
+#if (PAGE_SHIFT > 15)
+#define BNXT_RX_PAGE_SHIFT 15
+#else
+#define BNXT_RX_PAGE_SHIFT PAGE_SHIFT
+#endif
+
+#define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT)
+
#define BNXT_MIN_PKT_SIZE 45
#define BNXT_NUM_TESTS(bp) 0
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net 3/3] bnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary.
2016-04-25 6:30 [PATCH net 0/3] bnxt_en: Bug fixes for net Michael Chan
2016-04-25 6:30 ` [PATCH net 1/3] bnxt_en: Don't fallback to INTA on VF Michael Chan
2016-04-25 6:30 ` [PATCH net 2/3] bnxt_en: Limit RX BD pages to be no bigger than 32K Michael Chan
@ 2016-04-25 6:30 ` Michael Chan
2016-04-27 20:19 ` [PATCH net 0/3] bnxt_en: Bug fixes for net David Miller
3 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2016-04-25 6:30 UTC (permalink / raw)
To: davem; +Cc: netdev
If PAGE_SIZE is bigger than BNXT_RX_PAGE_SIZE, that means the native CPU
page is bigger than the maximum length of the RX BD. Divide the page
into multiple 32K buffers for the aggregation ring.
Add an offset field in the bnxt_sw_rx_agg_bd struct to keep track of the
page offset of each buffer. Since each page can be referenced by multiple
buffer entries, call get_page() as needed to get the proper reference
count.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 35 ++++++++++++++++++++++++++-----
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 ++++
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 28480f6..72eb29e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -581,12 +581,30 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
struct page *page;
dma_addr_t mapping;
u16 sw_prod = rxr->rx_sw_agg_prod;
+ unsigned int offset = 0;
- page = alloc_page(gfp);
- if (!page)
- return -ENOMEM;
+ if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
+ page = rxr->rx_page;
+ if (!page) {
+ page = alloc_page(gfp);
+ if (!page)
+ return -ENOMEM;
+ rxr->rx_page = page;
+ rxr->rx_page_offset = 0;
+ }
+ offset = rxr->rx_page_offset;
+ rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
+ if (rxr->rx_page_offset == PAGE_SIZE)
+ rxr->rx_page = NULL;
+ else
+ get_page(page);
+ } else {
+ page = alloc_page(gfp);
+ if (!page)
+ return -ENOMEM;
+ }
- mapping = dma_map_page(&pdev->dev, page, 0, BNXT_RX_PAGE_SIZE,
+ mapping = dma_map_page(&pdev->dev, page, offset, BNXT_RX_PAGE_SIZE,
PCI_DMA_FROMDEVICE);
if (dma_mapping_error(&pdev->dev, mapping)) {
__free_page(page);
@@ -601,6 +619,7 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod);
rx_agg_buf->page = page;
+ rx_agg_buf->offset = offset;
rx_agg_buf->mapping = mapping;
rxbd->rx_bd_haddr = cpu_to_le64(mapping);
rxbd->rx_bd_opaque = sw_prod;
@@ -642,6 +661,7 @@ static void bnxt_reuse_rx_agg_bufs(struct bnxt_napi *bnapi, u16 cp_cons,
page = cons_rx_buf->page;
cons_rx_buf->page = NULL;
prod_rx_buf->page = page;
+ prod_rx_buf->offset = cons_rx_buf->offset;
prod_rx_buf->mapping = cons_rx_buf->mapping;
@@ -709,7 +729,8 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT;
cons_rx_buf = &rxr->rx_agg_ring[cons];
- skb_fill_page_desc(skb, i, cons_rx_buf->page, 0, frag_len);
+ skb_fill_page_desc(skb, i, cons_rx_buf->page,
+ cons_rx_buf->offset, frag_len);
__clear_bit(cons, rxr->rx_agg_bmap);
/* It is possible for bnxt_alloc_rx_page() to allocate
@@ -1591,6 +1612,10 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
__free_page(page);
}
+ if (rxr->rx_page) {
+ __free_page(rxr->rx_page);
+ rxr->rx_page = NULL;
+ }
}
}
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 0cf1e2a..8b823ff 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -515,6 +515,7 @@ struct bnxt_sw_rx_bd {
struct bnxt_sw_rx_agg_bd {
struct page *page;
+ unsigned int offset;
dma_addr_t mapping;
};
@@ -595,6 +596,9 @@ struct bnxt_rx_ring_info {
unsigned long *rx_agg_bmap;
u16 rx_agg_bmap_size;
+ struct page *rx_page;
+ unsigned int rx_page_offset;
+
dma_addr_t rx_desc_mapping[MAX_RX_PAGES];
dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES];
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net 0/3] bnxt_en: Bug fixes for net.
2016-04-25 6:30 [PATCH net 0/3] bnxt_en: Bug fixes for net Michael Chan
` (2 preceding siblings ...)
2016-04-25 6:30 ` [PATCH net 3/3] bnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary Michael Chan
@ 2016-04-27 20:19 ` David Miller
3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-04-27 20:19 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
From: Michael Chan <michael.chan@broadcom.com>
Date: Mon, 25 Apr 2016 02:30:48 -0400
> Only use MSIX on VF, and fix rx page buffers on architectures with
> PAGE_SIZE >= 64K.
Series applied, thanks Michael.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net 0/3] bnxt_en: Bug fixes for net
@ 2024-06-18 21:53 Michael Chan
2024-06-20 14:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 7+ messages in thread
From: Michael Chan @ 2024-06-18 21:53 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, kuba, pabeni, pavan.chebbi, andrew.gospodarek
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
The first firmware interface update is needed by the second patch to
limit the number of TSO segments on the 5760X chips. The third patch
fixes the TX error path for PTP packets.
Michael Chan (2):
bnxt_en: Update firmware interface to 1.10.3.44
bnxt_en: Set TSO max segs on devices with limits
Pavan Chebbi (1):
bnxt_en: Restore PTP tx_avail count in case of skb_pad() error
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 311 ++++++++++--------
3 files changed, 184 insertions(+), 136 deletions(-)
--
2.30.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net 0/3] bnxt_en: Bug fixes for net
2024-06-18 21:53 Michael Chan
@ 2024-06-20 14:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-20 14:00 UTC (permalink / raw)
To: Michael Chan
Cc: davem, netdev, edumazet, kuba, pabeni, pavan.chebbi,
andrew.gospodarek
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 18 Jun 2024 14:53:10 -0700 you wrote:
> The first firmware interface update is needed by the second patch to
> limit the number of TSO segments on the 5760X chips. The third patch
> fixes the TX error path for PTP packets.
>
> Michael Chan (2):
> bnxt_en: Update firmware interface to 1.10.3.44
> bnxt_en: Set TSO max segs on devices with limits
>
> [...]
Here is the summary with links:
- [net,1/3] bnxt_en: Update firmware interface to 1.10.3.44
https://git.kernel.org/netdev/net/c/8ad04409921f
- [net,2/3] bnxt_en: Set TSO max segs on devices with limits
https://git.kernel.org/netdev/net/c/b7bfcb4c7ce4
- [net,3/3] bnxt_en: Restore PTP tx_avail count in case of skb_pad() error
https://git.kernel.org/netdev/net/c/1e7962114c10
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-06-20 14:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25 6:30 [PATCH net 0/3] bnxt_en: Bug fixes for net Michael Chan
2016-04-25 6:30 ` [PATCH net 1/3] bnxt_en: Don't fallback to INTA on VF Michael Chan
2016-04-25 6:30 ` [PATCH net 2/3] bnxt_en: Limit RX BD pages to be no bigger than 32K Michael Chan
2016-04-25 6:30 ` [PATCH net 3/3] bnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary Michael Chan
2016-04-27 20:19 ` [PATCH net 0/3] bnxt_en: Bug fixes for net David Miller
-- strict thread matches above, loose matches on Subject: below --
2024-06-18 21:53 Michael Chan
2024-06-20 14:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).