xref: /freebsd/sys/dev/dpaa/fman_keygen.h (revision 4dccd3ac8685355e97593d5e27adf14e2b0b8473)
1 /*-
2  * Copyright (c) 2026 Justin Hibbits
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  */
6 
7 #ifndef	_DEV_DPAA_FMAN_KEYGEN_H_
8 #define	_DEV_DPAA_FMAN_KEYGEN_H_
9 
10 struct fman_softc;
11 
12 /*
13  * Bring up the FMan KeyGen block once per FMan instance.  Enables error
14  * event reporting and clears all port/scheme bindings.  Called from
15  * fman_init() in fman.c.
16  */
17 int	fman_kg_init(struct fman_softc *sc);
18 void	fman_kg_fini(struct fman_softc *sc);
19 
20 /*
21  * Configure a hash-distribution scheme for @hw_port_id: RSS-style
22  * spreading over @nfqs FQs starting at @base_fqid, keyed on the IP
23  * 5-tuple.  @nfqs must be a power of two, @base_fqid must be aligned
24  * to @nfqs, and both fit in 24 bits (Linux constraint, matches the
25  * FMKG_SCM_FQB field width).  Returns 0 on success or a non-zero
26  * errno; on success the scheme is bound to the port immediately and
27  * incoming frames start hashing on the next dequeue cycle.
28  */
29 int	fman_kg_alloc_hash_scheme(struct fman_softc *sc, int hw_port_id,
30 	    uint32_t base_fqid, uint32_t nfqs);
31 
32 /*
33  * Undo fman_kg_alloc_hash_scheme() for @hw_port_id.  Unbinds the
34  * scheme from the port, disables it, and releases the scheme slot.
35  * Frames after this point fall through to the port's dflt_fqid.
36  */
37 int	fman_kg_free_hash_scheme(struct fman_softc *sc, int hw_port_id);
38 
39 #endif /* _DEV_DPAA_FMAN_KEYGEN_H_ */
40