Skip to content

Commit 422a956

Browse files
author
Nelson Escobar
committed
enic: get max rq & wq entries supported by hw, 16K queues
JIRA: https://issues.redhat.com/browse/RHEL-84863 commit df9fd2a Author: Satish Kharat <satishkh@cisco.com> Date: Tue Mar 4 19:56:44 2025 -0500 enic: get max rq & wq entries supported by hw, 16K queues Enables reading the max rq and wq entries supported from the hw. Enables 16k rq and wq entries on hw that supports. Co-developed-by: Nelson Escobar <neescoba@cisco.com> Signed-off-by: Nelson Escobar <neescoba@cisco.com> Co-developed-by: John Daley <johndale@cisco.com> Signed-off-by: John Daley <johndale@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Link: https://patch.msgid.link/20250304-enic_cleanup_and_ext_cq-v2-8-85804263dad8@cisco.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Nelson Escobar <nescobar@redhat.com>
1 parent 96ca4b1 commit 422a956

File tree

7 files changed

+39
-24
lines changed

7 files changed

+39
-24
lines changed

drivers/net/ethernet/cisco/enic/enic_ethtool.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ static void enic_get_ringparam(struct net_device *netdev,
222222
struct enic *enic = netdev_priv(netdev);
223223
struct vnic_enet_config *c = &enic->config;
224224

225-
ring->rx_max_pending = ENIC_MAX_RQ_DESCS;
225+
ring->rx_max_pending = c->max_rq_ring;
226226
ring->rx_pending = c->rq_desc_count;
227-
ring->tx_max_pending = ENIC_MAX_WQ_DESCS;
227+
ring->tx_max_pending = c->max_wq_ring;
228228
ring->tx_pending = c->wq_desc_count;
229229
}
230230

@@ -252,18 +252,18 @@ static int enic_set_ringparam(struct net_device *netdev,
252252
}
253253
rx_pending = c->rq_desc_count;
254254
tx_pending = c->wq_desc_count;
255-
if (ring->rx_pending > ENIC_MAX_RQ_DESCS ||
255+
if (ring->rx_pending > c->max_rq_ring ||
256256
ring->rx_pending < ENIC_MIN_RQ_DESCS) {
257257
netdev_info(netdev, "rx pending (%u) not in range [%u,%u]",
258258
ring->rx_pending, ENIC_MIN_RQ_DESCS,
259-
ENIC_MAX_RQ_DESCS);
259+
c->max_rq_ring);
260260
return -EINVAL;
261261
}
262-
if (ring->tx_pending > ENIC_MAX_WQ_DESCS ||
262+
if (ring->tx_pending > c->max_wq_ring ||
263263
ring->tx_pending < ENIC_MIN_WQ_DESCS) {
264264
netdev_info(netdev, "tx pending (%u) not in range [%u,%u]",
265265
ring->tx_pending, ENIC_MIN_WQ_DESCS,
266-
ENIC_MAX_WQ_DESCS);
266+
c->max_wq_ring);
267267
return -EINVAL;
268268
}
269269
if (running)

drivers/net/ethernet/cisco/enic/enic_res.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,38 @@ int enic_get_vnic_config(struct enic *enic)
5959
GET_CONFIG(intr_timer_usec);
6060
GET_CONFIG(loop_tag);
6161
GET_CONFIG(num_arfs);
62+
GET_CONFIG(max_rq_ring);
63+
GET_CONFIG(max_wq_ring);
64+
GET_CONFIG(max_cq_ring);
65+
66+
if (!c->max_wq_ring)
67+
c->max_wq_ring = ENIC_MAX_WQ_DESCS_DEFAULT;
68+
if (!c->max_rq_ring)
69+
c->max_rq_ring = ENIC_MAX_RQ_DESCS_DEFAULT;
70+
if (!c->max_cq_ring)
71+
c->max_cq_ring = ENIC_MAX_CQ_DESCS_DEFAULT;
6272

6373
c->wq_desc_count =
64-
min_t(u32, ENIC_MAX_WQ_DESCS,
65-
max_t(u32, ENIC_MIN_WQ_DESCS,
66-
c->wq_desc_count));
74+
min_t(u32, c->max_wq_ring,
75+
max_t(u32, ENIC_MIN_WQ_DESCS, c->wq_desc_count));
6776
c->wq_desc_count &= 0xffffffe0; /* must be aligned to groups of 32 */
6877

6978
c->rq_desc_count =
70-
min_t(u32, ENIC_MAX_RQ_DESCS,
71-
max_t(u32, ENIC_MIN_RQ_DESCS,
72-
c->rq_desc_count));
79+
min_t(u32, c->max_rq_ring,
80+
max_t(u32, ENIC_MIN_RQ_DESCS, c->rq_desc_count));
7381
c->rq_desc_count &= 0xffffffe0; /* must be aligned to groups of 32 */
7482

7583
if (c->mtu == 0)
7684
c->mtu = 1500;
77-
c->mtu = min_t(u16, ENIC_MAX_MTU,
78-
max_t(u16, ENIC_MIN_MTU,
79-
c->mtu));
85+
c->mtu = min_t(u16, ENIC_MAX_MTU, max_t(u16, ENIC_MIN_MTU, c->mtu));
8086

8187
c->intr_timer_usec = min_t(u32, c->intr_timer_usec,
8288
vnic_dev_get_intr_coal_timer_max(enic->vdev));
8389

8490
dev_info(enic_get_dev(enic),
85-
"vNIC MAC addr %pM wq/rq %d/%d mtu %d\n",
86-
enic->mac_addr, c->wq_desc_count, c->rq_desc_count, c->mtu);
91+
"vNIC MAC addr %pM wq/rq %d/%d max wq/rq/cq %d/%d/%d mtu %d\n",
92+
enic->mac_addr, c->wq_desc_count, c->rq_desc_count,
93+
c->max_wq_ring, c->max_rq_ring, c->max_cq_ring, c->mtu);
8794

8895
dev_info(enic_get_dev(enic), "vNIC csum tx/rx %s/%s "
8996
"tso/lro %s/%s rss %s intr mode %s type %s timer %d usec "

drivers/net/ethernet/cisco/enic/enic_res.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
#include "vnic_wq.h"
1313
#include "vnic_rq.h"
1414

15-
#define ENIC_MIN_WQ_DESCS 64
16-
#define ENIC_MAX_WQ_DESCS 4096
17-
#define ENIC_MIN_RQ_DESCS 64
18-
#define ENIC_MAX_RQ_DESCS 4096
15+
#define ENIC_MIN_WQ_DESCS 64
16+
#define ENIC_MAX_WQ_DESCS_DEFAULT 4096
17+
#define ENIC_MAX_WQ_DESCS 16384
18+
#define ENIC_MIN_RQ_DESCS 64
19+
#define ENIC_MAX_RQ_DESCS 16384
20+
#define ENIC_MAX_RQ_DESCS_DEFAULT 4096
21+
#define ENIC_MAX_CQ_DESCS_DEFAULT (64 * 1024)
1922

2023
#define ENIC_MIN_MTU ETH_MIN_MTU
2124
#define ENIC_MAX_MTU 9000

drivers/net/ethernet/cisco/enic/enic_wq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ unsigned int enic_wq_cq_service(struct enic *enic, unsigned int cq_index,
9393
u8 type, color;
9494
bool ext_wq;
9595

96-
ext_wq = cq->ring.size > ENIC_MAX_WQ_DESCS;
96+
ext_wq = cq->ring.size > ENIC_MAX_WQ_DESCS_DEFAULT;
9797

9898
cq_desc = (struct cq_desc *)vnic_cq_to_clean(cq);
9999
enic_wq_cq_desc_dec(cq_desc, ext_wq, &type, &color,

drivers/net/ethernet/cisco/enic/vnic_enet.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ struct vnic_enet_config {
2121
u16 loop_tag;
2222
u16 vf_rq_count;
2323
u16 num_arfs;
24+
u8 reserved[66];
25+
u32 max_rq_ring; // MAX RQ ring size
26+
u32 max_wq_ring; // MAX WQ ring size
27+
u32 max_cq_ring; // MAX CQ ring size
28+
u32 rdma_rsvd_lkey; // Reserved (privileged) LKey
2429
};
2530

2631
#define VENETF_TSO 0x1 /* TSO enabled */

drivers/net/ethernet/cisco/enic/vnic_rq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct vnic_rq_ctrl {
5050
(VNIC_RQ_BUF_BLK_ENTRIES(entries) * sizeof(struct vnic_rq_buf))
5151
#define VNIC_RQ_BUF_BLKS_NEEDED(entries) \
5252
DIV_ROUND_UP(entries, VNIC_RQ_BUF_BLK_ENTRIES(entries))
53-
#define VNIC_RQ_BUF_BLKS_MAX VNIC_RQ_BUF_BLKS_NEEDED(4096)
53+
#define VNIC_RQ_BUF_BLKS_MAX VNIC_RQ_BUF_BLKS_NEEDED(16384)
5454

5555
struct vnic_rq_buf {
5656
struct vnic_rq_buf *next;

drivers/net/ethernet/cisco/enic/vnic_wq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct vnic_wq_buf {
6262
(VNIC_WQ_BUF_BLK_ENTRIES(entries) * sizeof(struct vnic_wq_buf))
6363
#define VNIC_WQ_BUF_BLKS_NEEDED(entries) \
6464
DIV_ROUND_UP(entries, VNIC_WQ_BUF_BLK_ENTRIES(entries))
65-
#define VNIC_WQ_BUF_BLKS_MAX VNIC_WQ_BUF_BLKS_NEEDED(4096)
65+
#define VNIC_WQ_BUF_BLKS_MAX VNIC_WQ_BUF_BLKS_NEEDED(16384)
6666

6767
struct vnic_wq {
6868
unsigned int index;

0 commit comments

Comments
 (0)