aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe/t4_filter.c
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2021-02-19 21:47:18 +0000
committerNavdeep Parhar <np@FreeBSD.org>2021-02-19 22:23:58 +0000
commitc91dda5ad923f24ef2e538b8dc180fa98598b4db (patch)
tree02cd51cb15e0aadc64676e32e835f89eaa0d8676 /sys/dev/cxgbe/t4_filter.c
parent7ac8040a99319456c3225cd5166390f5bd172fdf (diff)
downloadsrc-c91dda5ad923f24ef2e538b8dc180fa98598b4db.tar.gz
src-c91dda5ad923f24ef2e538b8dc180fa98598b4db.zip
cxgbe(4): Add a driver ioctl to set the filter mask.
Allow the filter mask (aka the hashfilter mode when hashfilters are in use) to be set any time it is safe to do so. The requested mask must be a subset of the filter mode already. The driver will not change the mode or ingress config just to support a new mask. MFC after: 2 weeks Sponsored by: Chelsio Communications
Diffstat (limited to 'sys/dev/cxgbe/t4_filter.c')
-rw-r--r--sys/dev/cxgbe/t4_filter.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c
index 1e0269fcd5c0..3afab0d1d6b9 100644
--- a/sys/dev/cxgbe/t4_filter.c
+++ b/sys/dev/cxgbe/t4_filter.c
@@ -543,6 +543,48 @@ done:
return (rc);
}
+int
+set_filter_mask(struct adapter *sc, uint32_t mode)
+{
+ struct tp_params *tp = &sc->params.tp;
+ int rc, iconf;
+ uint16_t fmask;
+
+ iconf = mode_to_iconf(mode);
+ fmask = mode_to_fconf(mode);
+ if ((iconf == -1 || iconf == tp->vnic_mode) && fmask == tp->filter_mask)
+ return (0); /* Nothing to do */
+
+ /*
+ * We aren't going to change the global filter mode or VNIC mode here.
+ * The given filter mask must conform to them.
+ */
+ if ((fmask | tp->filter_mode) != tp->filter_mode)
+ return (EINVAL);
+ if (iconf != -1 && iconf != tp->vnic_mode)
+ return (EINVAL);
+
+ rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4sethfm");
+ if (rc)
+ return (rc);
+
+ if (sc->tids.tids_in_use > 0) { /* TOE or hashfilters active */
+ rc = EBUSY;
+ goto done;
+ }
+
+#ifdef TCP_OFFLOAD
+ if (uld_active(sc, ULD_TOM)) {
+ rc = EBUSY;
+ goto done;
+ }
+#endif
+ rc = -t4_set_filter_cfg(sc, -1, fmask, -1);
+done:
+ end_synchronized_op(sc, 0);
+ return (rc);
+}
+
static inline uint64_t
get_filter_hits(struct adapter *sc, uint32_t tid)
{