xref: /linux/drivers/net/ethernet/netronome/nfp/abm/ctrl.c (revision 13a370b9d275959ac75e92dc14e43eeae75804f8)
1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2 /*
3  * Copyright (C) 2018 Netronome Systems, Inc.
4  *
5  * This software is dual licensed under the GNU General License Version 2,
6  * June 1991 as shown in the file COPYING in the top-level directory of this
7  * source tree or the BSD 2-Clause License provided below.  You have the
8  * option to license this software under the complete terms of either license.
9  *
10  * The BSD 2-Clause License:
11  *
12  *     Redistribution and use in source and binary forms, with or
13  *     without modification, are permitted provided that the following
14  *     conditions are met:
15  *
16  *      1. Redistributions of source code must retain the above
17  *         copyright notice, this list of conditions and the following
18  *         disclaimer.
19  *
20  *      2. Redistributions in binary form must reproduce the above
21  *         copyright notice, this list of conditions and the following
22  *         disclaimer in the documentation and/or other materials
23  *         provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  */
34 
35 #include <linux/kernel.h>
36 
37 #include "../nfpcore/nfp_cpp.h"
38 #include "../nfp_app.h"
39 #include "../nfp_main.h"
40 #include "../nfp_net.h"
41 #include "main.h"
42 
43 void nfp_abm_ctrl_read_params(struct nfp_abm_link *alink)
44 {
45 	alink->queue_base = nn_readl(alink->vnic, NFP_NET_CFG_START_RXQ);
46 	alink->queue_base /= alink->vnic->stride_rx;
47 }
48 
49 int nfp_abm_ctrl_find_addrs(struct nfp_abm *abm)
50 {
51 	struct nfp_pf *pf = abm->app->pf;
52 	unsigned int pf_id;
53 
54 	pf_id =	nfp_cppcore_pcie_unit(pf->cpp);
55 	abm->pf_id = pf_id;
56 
57 	return 0;
58 }
59