Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright(c) 2013 - 2018 Intel Corporation. */
3
4#ifndef _FM10K_PF_H_
5#define _FM10K_PF_H_
6
7#include "fm10k_type.h"
8#include "fm10k_common.h"
9
10bool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
11u16 fm10k_queues_per_pool(struct fm10k_hw *hw);
12u16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
13
14enum fm10k_pf_tlv_msg_id_v1 {
15 FM10K_PF_MSG_ID_TEST = 0x000, /* msg ID reserved */
16 FM10K_PF_MSG_ID_XCAST_MODES = 0x001,
17 FM10K_PF_MSG_ID_UPDATE_MAC_FWD_RULE = 0x002,
18 FM10K_PF_MSG_ID_LPORT_MAP = 0x100,
19 FM10K_PF_MSG_ID_LPORT_CREATE = 0x200,
20 FM10K_PF_MSG_ID_LPORT_DELETE = 0x201,
21 FM10K_PF_MSG_ID_CONFIG = 0x300,
22 FM10K_PF_MSG_ID_UPDATE_PVID = 0x400,
23 FM10K_PF_MSG_ID_CREATE_FLOW_TABLE = 0x501,
24 FM10K_PF_MSG_ID_DELETE_FLOW_TABLE = 0x502,
25 FM10K_PF_MSG_ID_UPDATE_FLOW = 0x503,
26 FM10K_PF_MSG_ID_DELETE_FLOW = 0x504,
27 FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
28};
29
30enum fm10k_pf_tlv_attr_id_v1 {
31 FM10K_PF_ATTR_ID_ERR = 0x00,
32 FM10K_PF_ATTR_ID_LPORT_MAP = 0x01,
33 FM10K_PF_ATTR_ID_XCAST_MODE = 0x02,
34 FM10K_PF_ATTR_ID_MAC_UPDATE = 0x03,
35 FM10K_PF_ATTR_ID_VLAN_UPDATE = 0x04,
36 FM10K_PF_ATTR_ID_CONFIG = 0x05,
37 FM10K_PF_ATTR_ID_CREATE_FLOW_TABLE = 0x06,
38 FM10K_PF_ATTR_ID_DELETE_FLOW_TABLE = 0x07,
39 FM10K_PF_ATTR_ID_UPDATE_FLOW = 0x08,
40 FM10K_PF_ATTR_ID_FLOW_STATE = 0x09,
41 FM10K_PF_ATTR_ID_FLOW_HANDLE = 0x0A,
42 FM10K_PF_ATTR_ID_DELETE_FLOW = 0x0B,
43 FM10K_PF_ATTR_ID_PORT = 0x0C,
44 FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
45};
46
47#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
48#define FM10K_MSG_LPORT_MAP_GLORT_SIZE 16
49#define FM10K_MSG_LPORT_MAP_MASK_SHIFT 16
50#define FM10K_MSG_LPORT_MAP_MASK_SIZE 16
51
52#define FM10K_MSG_UPDATE_PVID_GLORT_SHIFT 0
53#define FM10K_MSG_UPDATE_PVID_GLORT_SIZE 16
54#define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16
55#define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16
56
57#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED 280
58
59/* The following data structures are overlayed directly onto TLV mailbox
60 * messages, and must not break 4 byte alignment. Ensure the structures line
61 * up correctly as per their TLV definition.
62 */
63
64struct fm10k_mac_update {
65 __le32 mac_lower;
66 __le16 mac_upper;
67 __le16 vlan;
68 __le16 glort;
69 u8 flags;
70 u8 action;
71} __aligned(4) __packed;
72
73struct fm10k_global_table_data {
74 __le32 used;
75 __le32 avail;
76} __aligned(4) __packed;
77
78struct fm10k_swapi_error {
79 __le32 status;
80 struct fm10k_global_table_data mac;
81 struct fm10k_global_table_data nexthop;
82 struct fm10k_global_table_data ffu;
83} __aligned(4) __packed;
84
85s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
86extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
87#define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
88 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
89 fm10k_lport_map_msg_attr, func)
90extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
91#define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
92 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
93 fm10k_update_pvid_msg_attr, func)
94
95s32 fm10k_msg_err_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
96extern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
97#define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
98 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
99
100s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid);
101s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
102s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
103 struct fm10k_mbx_info *);
104s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
105 struct fm10k_mbx_info *);
106
107extern const struct fm10k_info fm10k_pf_info;
108#endif /* _FM10K_PF_H */
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Intel(R) Ethernet Switch Host Interface Driver
3 * Copyright(c) 2013 - 2017 Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in
15 * the file called "COPYING".
16 *
17 * Contact Information:
18 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
19 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
20 */
21
22#ifndef _FM10K_PF_H_
23#define _FM10K_PF_H_
24
25#include "fm10k_type.h"
26#include "fm10k_common.h"
27
28bool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
29u16 fm10k_queues_per_pool(struct fm10k_hw *hw);
30u16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
31
32enum fm10k_pf_tlv_msg_id_v1 {
33 FM10K_PF_MSG_ID_TEST = 0x000, /* msg ID reserved */
34 FM10K_PF_MSG_ID_XCAST_MODES = 0x001,
35 FM10K_PF_MSG_ID_UPDATE_MAC_FWD_RULE = 0x002,
36 FM10K_PF_MSG_ID_LPORT_MAP = 0x100,
37 FM10K_PF_MSG_ID_LPORT_CREATE = 0x200,
38 FM10K_PF_MSG_ID_LPORT_DELETE = 0x201,
39 FM10K_PF_MSG_ID_CONFIG = 0x300,
40 FM10K_PF_MSG_ID_UPDATE_PVID = 0x400,
41 FM10K_PF_MSG_ID_CREATE_FLOW_TABLE = 0x501,
42 FM10K_PF_MSG_ID_DELETE_FLOW_TABLE = 0x502,
43 FM10K_PF_MSG_ID_UPDATE_FLOW = 0x503,
44 FM10K_PF_MSG_ID_DELETE_FLOW = 0x504,
45 FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
46};
47
48enum fm10k_pf_tlv_attr_id_v1 {
49 FM10K_PF_ATTR_ID_ERR = 0x00,
50 FM10K_PF_ATTR_ID_LPORT_MAP = 0x01,
51 FM10K_PF_ATTR_ID_XCAST_MODE = 0x02,
52 FM10K_PF_ATTR_ID_MAC_UPDATE = 0x03,
53 FM10K_PF_ATTR_ID_VLAN_UPDATE = 0x04,
54 FM10K_PF_ATTR_ID_CONFIG = 0x05,
55 FM10K_PF_ATTR_ID_CREATE_FLOW_TABLE = 0x06,
56 FM10K_PF_ATTR_ID_DELETE_FLOW_TABLE = 0x07,
57 FM10K_PF_ATTR_ID_UPDATE_FLOW = 0x08,
58 FM10K_PF_ATTR_ID_FLOW_STATE = 0x09,
59 FM10K_PF_ATTR_ID_FLOW_HANDLE = 0x0A,
60 FM10K_PF_ATTR_ID_DELETE_FLOW = 0x0B,
61 FM10K_PF_ATTR_ID_PORT = 0x0C,
62 FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
63};
64
65#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
66#define FM10K_MSG_LPORT_MAP_GLORT_SIZE 16
67#define FM10K_MSG_LPORT_MAP_MASK_SHIFT 16
68#define FM10K_MSG_LPORT_MAP_MASK_SIZE 16
69
70#define FM10K_MSG_UPDATE_PVID_GLORT_SHIFT 0
71#define FM10K_MSG_UPDATE_PVID_GLORT_SIZE 16
72#define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16
73#define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16
74
75#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED 280
76
77/* The following data structures are overlayed directly onto TLV mailbox
78 * messages, and must not break 4 byte alignment. Ensure the structures line
79 * up correctly as per their TLV definition.
80 */
81
82struct fm10k_mac_update {
83 __le32 mac_lower;
84 __le16 mac_upper;
85 __le16 vlan;
86 __le16 glort;
87 u8 flags;
88 u8 action;
89} __aligned(4) __packed;
90
91struct fm10k_global_table_data {
92 __le32 used;
93 __le32 avail;
94} __aligned(4) __packed;
95
96struct fm10k_swapi_error {
97 __le32 status;
98 struct fm10k_global_table_data mac;
99 struct fm10k_global_table_data nexthop;
100 struct fm10k_global_table_data ffu;
101} __aligned(4) __packed;
102
103s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
104extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
105#define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
106 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
107 fm10k_lport_map_msg_attr, func)
108extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
109#define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
110 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
111 fm10k_update_pvid_msg_attr, func)
112
113s32 fm10k_msg_err_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
114extern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
115#define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
116 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
117
118s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid);
119s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
120s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
121 struct fm10k_mbx_info *);
122s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
123 struct fm10k_mbx_info *);
124
125extern const struct fm10k_info fm10k_pf_info;
126#endif /* _FM10K_PF_H */