Skip to content

Commit c3480a6

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add cache line size setting to optimize performance.
The chip supports 64-byte and 128-byte cache line size for more optimal DMA performance when matched to the CPU cache line size. The default is 64. If the system is using 128-byte cache line size, set it to 128. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 91cdda4 commit c3480a6

File tree

1 file changed

+24
-0
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5412,6 +5412,28 @@ static int bnxt_hwrm_set_br_mode(struct bnxt *bp, u16 br_mode)
54125412
return rc;
54135413
}
54145414

5415+
static int bnxt_hwrm_set_cache_line_size(struct bnxt *bp, int size)
5416+
{
5417+
struct hwrm_func_cfg_input req = {0};
5418+
int rc;
5419+
5420+
if (BNXT_VF(bp) || bp->hwrm_spec_code < 0x10803)
5421+
return 0;
5422+
5423+
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
5424+
req.fid = cpu_to_le16(0xffff);
5425+
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_CACHE_LINESIZE);
5426+
req.cache_linesize = FUNC_QCFG_RESP_CACHE_LINESIZE_CACHE_LINESIZE_64;
5427+
if (size == 128)
5428+
req.cache_linesize =
5429+
FUNC_QCFG_RESP_CACHE_LINESIZE_CACHE_LINESIZE_128;
5430+
5431+
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
5432+
if (rc)
5433+
rc = -EIO;
5434+
return rc;
5435+
}
5436+
54155437
static int bnxt_setup_vnic(struct bnxt *bp, u16 vnic_id)
54165438
{
54175439
struct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id];
@@ -8645,6 +8667,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
86458667
else
86468668
device_set_wakeup_capable(&pdev->dev, false);
86478669

8670+
bnxt_hwrm_set_cache_line_size(bp, cache_line_size());
8671+
86488672
if (BNXT_PF(bp)) {
86498673
if (!bnxt_pf_wq) {
86508674
bnxt_pf_wq =

0 commit comments

Comments
 (0)