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