Skip to content

Commit 3286123

Browse files
CCX-Stingraydavem330
authored andcommitted
bnxt: change receive ring space parameters
Modify ring header data split and jumbo parameters to account for the fact that the design for XDP multibuffer puts close to the first 4k of data in a page and the remaining portions of the packet go in the aggregation ring. v3: Simplified code around initial buffer size calculation Signed-off-by: Andy Gospodarek <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 31b9998 commit 3286123

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <linux/hwmon.h>
5757
#include <linux/hwmon-sysfs.h>
5858
#include <net/page_pool.h>
59+
#include <linux/align.h>
5960

6061
#include "bnxt_hsi.h"
6162
#include "bnxt.h"
@@ -1933,11 +1934,13 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
19331934
}
19341935

19351936
if (agg_bufs) {
1936-
skb = bnxt_rx_agg_pages_skb(bp, cpr, skb, cp_cons, agg_bufs, false);
1937-
if (!skb) {
1938-
cpr->sw_stats.rx.rx_oom_discards += 1;
1939-
rc = -ENOMEM;
1940-
goto next_rx;
1937+
if (!xdp_active) {
1938+
skb = bnxt_rx_agg_pages_skb(bp, cpr, skb, cp_cons, agg_bufs, false);
1939+
if (!skb) {
1940+
cpr->sw_stats.rx.rx_oom_discards += 1;
1941+
rc = -ENOMEM;
1942+
goto next_rx;
1943+
}
19411944
}
19421945
}
19431946

@@ -3854,7 +3857,7 @@ void bnxt_set_ring_params(struct bnxt *bp)
38543857
/* 8 for CRC and VLAN */
38553858
rx_size = SKB_DATA_ALIGN(bp->dev->mtu + ETH_HLEN + NET_IP_ALIGN + 8);
38563859

3857-
rx_space = rx_size + NET_SKB_PAD +
3860+
rx_space = rx_size + ALIGN(max(NET_SKB_PAD, XDP_PACKET_HEADROOM), 8) +
38583861
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
38593862

38603863
bp->rx_copy_thresh = BNXT_RX_COPY_THRESH;
@@ -3895,9 +3898,15 @@ void bnxt_set_ring_params(struct bnxt *bp)
38953898
}
38963899
bp->rx_agg_ring_size = agg_ring_size;
38973900
bp->rx_agg_ring_mask = (bp->rx_agg_nr_pages * RX_DESC_CNT) - 1;
3898-
rx_size = SKB_DATA_ALIGN(BNXT_RX_COPY_THRESH + NET_IP_ALIGN);
3899-
rx_space = rx_size + NET_SKB_PAD +
3900-
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
3901+
3902+
if (BNXT_RX_PAGE_MODE(bp)) {
3903+
rx_space = BNXT_PAGE_MODE_BUF_SIZE;
3904+
rx_size = BNXT_MAX_PAGE_MODE_MTU;
3905+
} else {
3906+
rx_size = SKB_DATA_ALIGN(BNXT_RX_COPY_THRESH + NET_IP_ALIGN);
3907+
rx_space = rx_size + NET_SKB_PAD +
3908+
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
3909+
}
39013910
}
39023911

39033912
bp->rx_buf_use_size = rx_size;
@@ -5287,12 +5296,15 @@ static int bnxt_hwrm_vnic_set_hds(struct bnxt *bp, u16 vnic_id)
52875296
if (rc)
52885297
return rc;
52895298

5290-
req->flags = cpu_to_le32(VNIC_PLCMODES_CFG_REQ_FLAGS_JUMBO_PLACEMENT |
5291-
VNIC_PLCMODES_CFG_REQ_FLAGS_HDS_IPV4 |
5292-
VNIC_PLCMODES_CFG_REQ_FLAGS_HDS_IPV6);
5293-
req->enables =
5294-
cpu_to_le32(VNIC_PLCMODES_CFG_REQ_ENABLES_JUMBO_THRESH_VALID |
5295-
VNIC_PLCMODES_CFG_REQ_ENABLES_HDS_THRESHOLD_VALID);
5299+
req->flags = cpu_to_le32(VNIC_PLCMODES_CFG_REQ_FLAGS_JUMBO_PLACEMENT);
5300+
req->enables = cpu_to_le32(VNIC_PLCMODES_CFG_REQ_ENABLES_JUMBO_THRESH_VALID);
5301+
5302+
if (BNXT_RX_PAGE_MODE(bp) && !BNXT_RX_JUMBO_MODE(bp)) {
5303+
req->flags |= cpu_to_le32(VNIC_PLCMODES_CFG_REQ_FLAGS_HDS_IPV4 |
5304+
VNIC_PLCMODES_CFG_REQ_FLAGS_HDS_IPV6);
5305+
req->enables |=
5306+
cpu_to_le32(VNIC_PLCMODES_CFG_REQ_ENABLES_HDS_THRESHOLD_VALID);
5307+
}
52965308
/* thresholds not implemented in firmware yet */
52975309
req->jumbo_thresh = cpu_to_le16(bp->rx_copy_thresh);
52985310
req->hds_threshold = cpu_to_le16(bp->rx_copy_thresh);

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,7 @@ struct bnxt {
18191819
#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \
18201820
(!((bp)->flags & BNXT_FLAG_CHIP_P5) || \
18211821
(bp)->max_tpa_v2) && !is_kdump_kernel())
1822+
#define BNXT_RX_JUMBO_MODE(bp) ((bp)->flags & BNXT_FLAG_JUMBO)
18221823

18231824
#define BNXT_CHIP_SR2(bp) \
18241825
((bp)->chip_num == CHIP_NUM_58818)

0 commit comments

Comments
 (0)