Commit 39f54262 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'eth-fbnic-support-rss-contexts-and-ntuple-filters'

Jakub Kicinski says:

====================
eth: fbnic: support RSS contexts and ntuple filters

Add support for RSS contexts and ntuple filters in fbnic.
The device has only one context, intended for use by TCP zero-copy Rx.

First two patches add a check we seem to be missing in the core,
to avoid having to copy it to all drivers.

  $ ./drivers/net/hw/rss_ctx.py
  KTAP version 1
  1..16
  ok 1 rss_ctx.test_rss_key_indir
  ok 2 rss_ctx.test_rss_queue_reconfigure
  ok 3 rss_ctx.test_rss_resize
  ok 4 rss_ctx.test_hitless_key_update
  ok 5 rss_ctx.test_rss_context
  # Failed to create context 2, trying to test what we got
  ok 6 rss_ctx.test_rss_context4 # SKIP Tested only 1 contexts, wanted 4
  # Increasing queue count 44 -> 66
  # Failed to create context 2, trying to test what we got
  ok 7 rss_ctx.test_rss_context32 # SKIP Tested only 1 contexts, wanted 32
  # Added only 1 out of 3 contexts
  ok 8 rss_ctx.test_rss_context_dump
  # Driver does not support rss + queue offset
  ok 9 rss_ctx.test_rss_context_queue_reconfigure
  ok 10 rss_ctx.test_rss_context_overlap
  ok 11 rss_ctx.test_rss_context_overlap2 # SKIP Test requires at least 2 contexts, but device only has 1
  ok 12 rss_ctx.test_rss_context_out_of_order # SKIP Test requires at least 4 contexts, but device only has 1
  # Failed to create context 2, trying to test what we got
  ok 13 rss_ctx.test_rss_context4_create_with_cfg # SKIP Tested only 1 contexts, wanted 4
  ok 14 rss_ctx.test_flow_add_context_missing
  ok 15 rss_ctx.test_delete_rss_context_busy
  ok 16 rss_ctx.test_rss_ntuple_addition # SKIP Ntuple filter with RSS and nonzero action not supported
  # Totals: pass:10 fail:0 xfail:0 xpass:0 skip:6 error:0
====================

Link: https://patch.msgid.link/20250206235334.1425329-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 34c84b39 5797d3c6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -60,6 +60,12 @@ struct fbnic_dev {
	u8 mac_addr_boundary;
	u8 tce_tcam_last;

	/* IP TCAM */
	struct fbnic_ip_addr ip_src[FBNIC_RPC_TCAM_IP_ADDR_NUM_ENTRIES];
	struct fbnic_ip_addr ip_dst[FBNIC_RPC_TCAM_IP_ADDR_NUM_ENTRIES];
	struct fbnic_ip_addr ipo_src[FBNIC_RPC_TCAM_IP_ADDR_NUM_ENTRIES];
	struct fbnic_ip_addr ipo_dst[FBNIC_RPC_TCAM_IP_ADDR_NUM_ENTRIES];

	/* Number of TCQs/RCQs available on hardware */
	u16 max_num_queues;

+6 −0
Original line number Diff line number Diff line
@@ -605,8 +605,11 @@ enum {
	FBNIC_RPC_ACT_TBL0_DEST_EI	= 4,
};

#define FBNIC_RPC_ACT_TBL0_Q_SEL		CSR_BIT(4)
#define FBNIC_RPC_ACT_TBL0_Q_ID			CSR_GENMASK(15, 8)
#define FBNIC_RPC_ACT_TBL0_DMA_HINT		CSR_GENMASK(24, 16)
#define FBNIC_RPC_ACT_TBL0_TS_ENA		CSR_BIT(28)
#define FBNIC_RPC_ACT_TBL0_ACT_TBL_IDX		CSR_BIT(29)
#define FBNIC_RPC_ACT_TBL0_RSS_CTXT_ID		CSR_BIT(30)

#define FBNIC_RPC_ACT_TBL1_DEFAULT	0x0840b		/* 0x2102c */
@@ -677,6 +680,9 @@ enum {

#define FBNIC_RPC_TCAM_OUTER_IPSRC(m, n)\
	(0x08c00 + 0x08 * (n) + (m))		/* 0x023000 + 32*n + 4*m */
#define FBNIC_RPC_TCAM_IP_ADDR_VALUE		CSR_GENMASK(15, 0)
#define FBNIC_RPC_TCAM_IP_ADDR_MASK		CSR_GENMASK(31, 16)

#define FBNIC_RPC_TCAM_OUTER_IPDST(m, n)\
	(0x08c48 + 0x08 * (n) + (m))		/* 0x023120 + 32*n + 4*m */
#define FBNIC_RPC_TCAM_IPSRC(m, n)\
+138 −0
Original line number Diff line number Diff line
@@ -44,6 +44,132 @@ static int fbnic_dbg_mac_addr_show(struct seq_file *s, void *v)
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_mac_addr);

static int fbnic_dbg_tce_tcam_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;
	int i, tcam_idx = 0;
	char hdr[80];

	/* Generate Header */
	snprintf(hdr, sizeof(hdr), "%3s %s %-17s %s\n",
		 "Idx", "S", "TCAM Bitmap", "Addr/Mask");
	seq_puts(s, hdr);
	fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));

	for (i = 0; i < ARRAY_SIZE(fbd->mac_addr); i++) {
		struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];

		/* Verify BMC bit is set */
		if (!test_bit(FBNIC_MAC_ADDR_T_BMC, mac_addr->act_tcam))
			continue;

		if (tcam_idx == FBNIC_TCE_TCAM_NUM_ENTRIES)
			break;

		seq_printf(s, "%02d  %d %64pb %pm\n",
			   tcam_idx, mac_addr->state, mac_addr->act_tcam,
			   mac_addr->value.addr8);
		seq_printf(s, "                        %pm\n",
			   mac_addr->mask.addr8);
		tcam_idx++;
	}

	return 0;
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_tce_tcam);

static int fbnic_dbg_act_tcam_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;
	char hdr[80];
	int i;

	/* Generate Header */
	snprintf(hdr, sizeof(hdr), "%3s %s %-55s %-4s %s\n",
		 "Idx", "S", "Value/Mask", "RSS", "Dest");
	seq_puts(s, hdr);
	fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));

	for (i = 0; i < FBNIC_RPC_TCAM_ACT_NUM_ENTRIES; i++) {
		struct fbnic_act_tcam *act_tcam = &fbd->act_tcam[i];

		seq_printf(s, "%02d  %d %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x  %04x %08x\n",
			   i, act_tcam->state,
			   act_tcam->value.tcam[10], act_tcam->value.tcam[9],
			   act_tcam->value.tcam[8], act_tcam->value.tcam[7],
			   act_tcam->value.tcam[6], act_tcam->value.tcam[5],
			   act_tcam->value.tcam[4], act_tcam->value.tcam[3],
			   act_tcam->value.tcam[2], act_tcam->value.tcam[1],
			   act_tcam->value.tcam[0], act_tcam->rss_en_mask,
			   act_tcam->dest);
		seq_printf(s, "      %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x\n",
			   act_tcam->mask.tcam[10], act_tcam->mask.tcam[9],
			   act_tcam->mask.tcam[8], act_tcam->mask.tcam[7],
			   act_tcam->mask.tcam[6], act_tcam->mask.tcam[5],
			   act_tcam->mask.tcam[4], act_tcam->mask.tcam[3],
			   act_tcam->mask.tcam[2], act_tcam->mask.tcam[1],
			   act_tcam->mask.tcam[0]);
	}

	return 0;
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_act_tcam);

static int fbnic_dbg_ip_addr_show(struct seq_file *s,
				  struct fbnic_ip_addr *ip_addr)
{
	char hdr[80];
	int i;

	/* Generate Header */
	snprintf(hdr, sizeof(hdr), "%3s %s %-17s %s %s\n",
		 "Idx", "S", "TCAM Bitmap", "V", "Addr/Mask");
	seq_puts(s, hdr);
	fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));

	for (i = 0; i < FBNIC_RPC_TCAM_IP_ADDR_NUM_ENTRIES; i++, ip_addr++) {
		seq_printf(s, "%02d  %d %64pb %d %pi6\n",
			   i, ip_addr->state, ip_addr->act_tcam,
			   ip_addr->version, &ip_addr->value);
		seq_printf(s, "                          %pi6\n",
			   &ip_addr->mask);
	}

	return 0;
}

static int fbnic_dbg_ip_src_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;

	return fbnic_dbg_ip_addr_show(s, fbd->ip_src);
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ip_src);

static int fbnic_dbg_ip_dst_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;

	return fbnic_dbg_ip_addr_show(s, fbd->ip_dst);
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ip_dst);

static int fbnic_dbg_ipo_src_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;

	return fbnic_dbg_ip_addr_show(s, fbd->ipo_src);
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ipo_src);

static int fbnic_dbg_ipo_dst_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;

	return fbnic_dbg_ip_addr_show(s, fbd->ipo_dst);
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ipo_dst);

static int fbnic_dbg_pcie_stats_show(struct seq_file *s, void *v)
{
	struct fbnic_dev *fbd = s->private;
@@ -84,6 +210,18 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
			    &fbnic_dbg_pcie_stats_fops);
	debugfs_create_file("mac_addr", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_mac_addr_fops);
	debugfs_create_file("tce_tcam", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_tce_tcam_fops);
	debugfs_create_file("act_tcam", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_act_tcam_fops);
	debugfs_create_file("ip_src", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_ip_src_fops);
	debugfs_create_file("ip_dst", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_ip_dst_fops);
	debugfs_create_file("ipo_src", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_ipo_src_fops);
	debugfs_create_file("ipo_dst", 0400, fbd->dbg_fbd, fbd,
			    &fbnic_dbg_ipo_dst_fops);
}

void fbnic_dbg_fbd_exit(struct fbnic_dev *fbd)
+705 −0

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -639,6 +639,7 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd)
	netdev->hw_features |= netdev->features;
	netdev->vlan_features |= netdev->features;
	netdev->hw_enc_features |= netdev->features;
	netdev->features |= NETIF_F_NTUPLE;

	netdev->min_mtu = IPV6_MIN_MTU;
	netdev->max_mtu = FBNIC_MAX_JUMBO_FRAME_SIZE - ETH_HLEN;
Loading