2019-05-27 14:55:01 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
/*
|
|
|
|
* Copyright Gavin Shan, IBM Corporation 2016.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NCSI_INTERNAL_H__
|
|
|
|
#define __NCSI_INTERNAL_H__
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NCSI_CAP_BASE = 0,
|
|
|
|
NCSI_CAP_GENERIC = 0,
|
|
|
|
NCSI_CAP_BC,
|
|
|
|
NCSI_CAP_MC,
|
|
|
|
NCSI_CAP_BUFFER,
|
|
|
|
NCSI_CAP_AEN,
|
|
|
|
NCSI_CAP_VLAN,
|
|
|
|
NCSI_CAP_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NCSI_CAP_GENERIC_HWA = 0x01, /* HW arbitration */
|
|
|
|
NCSI_CAP_GENERIC_HDS = 0x02, /* HNC driver status change */
|
|
|
|
NCSI_CAP_GENERIC_FC = 0x04, /* HNC to MC flow control */
|
|
|
|
NCSI_CAP_GENERIC_FC1 = 0x08, /* MC to HNC flow control */
|
|
|
|
NCSI_CAP_GENERIC_MC = 0x10, /* Global MC filtering */
|
|
|
|
NCSI_CAP_GENERIC_HWA_UNKNOWN = 0x00, /* Unknown HW arbitration */
|
|
|
|
NCSI_CAP_GENERIC_HWA_SUPPORT = 0x20, /* Supported HW arbitration */
|
|
|
|
NCSI_CAP_GENERIC_HWA_NOT_SUPPORT = 0x40, /* No HW arbitration */
|
|
|
|
NCSI_CAP_GENERIC_HWA_RESERVED = 0x60, /* Reserved HW arbitration */
|
|
|
|
NCSI_CAP_GENERIC_HWA_MASK = 0x60, /* Mask for HW arbitration */
|
|
|
|
NCSI_CAP_GENERIC_MASK = 0x7f,
|
|
|
|
NCSI_CAP_BC_ARP = 0x01, /* ARP packet filtering */
|
|
|
|
NCSI_CAP_BC_DHCPC = 0x02, /* DHCP client filtering */
|
|
|
|
NCSI_CAP_BC_DHCPS = 0x04, /* DHCP server filtering */
|
|
|
|
NCSI_CAP_BC_NETBIOS = 0x08, /* NetBIOS packet filtering */
|
|
|
|
NCSI_CAP_BC_MASK = 0x0f,
|
|
|
|
NCSI_CAP_MC_IPV6_NEIGHBOR = 0x01, /* IPv6 neighbor filtering */
|
|
|
|
NCSI_CAP_MC_IPV6_ROUTER = 0x02, /* IPv6 router filering */
|
|
|
|
NCSI_CAP_MC_DHCPV6_RELAY = 0x04, /* DHCPv6 relay / server MC */
|
|
|
|
NCSI_CAP_MC_DHCPV6_WELL_KNOWN = 0x08, /* DHCPv6 well-known MC */
|
|
|
|
NCSI_CAP_MC_IPV6_MLD = 0x10, /* IPv6 MLD filtering */
|
|
|
|
NCSI_CAP_MC_IPV6_NEIGHBOR_S = 0x20, /* IPv6 neighbour filtering */
|
|
|
|
NCSI_CAP_MC_MASK = 0x3f,
|
|
|
|
NCSI_CAP_AEN_LSC = 0x01, /* Link status change */
|
|
|
|
NCSI_CAP_AEN_CR = 0x02, /* Configuration required */
|
|
|
|
NCSI_CAP_AEN_HDS = 0x04, /* HNC driver status */
|
|
|
|
NCSI_CAP_AEN_MASK = 0x07,
|
|
|
|
NCSI_CAP_VLAN_ONLY = 0x01, /* Filter VLAN packet only */
|
|
|
|
NCSI_CAP_VLAN_NO = 0x02, /* Filter VLAN and non-VLAN */
|
|
|
|
NCSI_CAP_VLAN_ANY = 0x04, /* Filter Any-and-non-VLAN */
|
|
|
|
NCSI_CAP_VLAN_MASK = 0x07
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NCSI_MODE_BASE = 0,
|
|
|
|
NCSI_MODE_ENABLE = 0,
|
|
|
|
NCSI_MODE_TX_ENABLE,
|
|
|
|
NCSI_MODE_LINK,
|
|
|
|
NCSI_MODE_VLAN,
|
|
|
|
NCSI_MODE_BC,
|
|
|
|
NCSI_MODE_MC,
|
|
|
|
NCSI_MODE_AEN,
|
|
|
|
NCSI_MODE_FC,
|
|
|
|
NCSI_MODE_MAX
|
|
|
|
};
|
|
|
|
|
2020-01-09 07:43:40 +08:00
|
|
|
/* Supported media status bits for Mellanox Mac affinity command.
|
|
|
|
* Bit (0-2) for different protocol support; Bit 1 for RBT support,
|
|
|
|
* bit 1 for SMBUS support and bit 2 for PCIE support. Bit (3-5)
|
|
|
|
* for different protocol availability. Bit 4 for RBT, bit 4 for
|
|
|
|
* SMBUS and bit 5 for PCIE.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
MLX_MC_RBT_SUPPORT = 0x01, /* MC supports RBT */
|
|
|
|
MLX_MC_RBT_AVL = 0x08, /* RBT medium is available */
|
|
|
|
};
|
|
|
|
|
2018-10-06 01:46:01 +08:00
|
|
|
/* OEM Vendor Manufacture ID */
|
|
|
|
#define NCSI_OEM_MFR_MLX_ID 0x8119
|
|
|
|
#define NCSI_OEM_MFR_BCM_ID 0x113d
|
2021-07-08 20:27:53 +08:00
|
|
|
#define NCSI_OEM_MFR_INTEL_ID 0x157
|
|
|
|
/* Intel specific OEM command */
|
2021-08-31 01:18:06 +08:00
|
|
|
#define NCSI_OEM_INTEL_CMD_GMA 0x06 /* CMD ID for Get MAC */
|
2021-07-08 20:27:53 +08:00
|
|
|
#define NCSI_OEM_INTEL_CMD_KEEP_PHY 0x20 /* CMD ID for Keep PHY up */
|
2018-10-17 03:13:19 +08:00
|
|
|
/* Broadcom specific OEM Command */
|
|
|
|
#define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */
|
2018-11-27 05:49:04 +08:00
|
|
|
/* Mellanox specific OEM Command */
|
|
|
|
#define NCSI_OEM_MLX_CMD_GMA 0x00 /* CMD ID for Get MAC */
|
|
|
|
#define NCSI_OEM_MLX_CMD_GMA_PARAM 0x1b /* Parameter for GMA */
|
2020-01-09 07:43:40 +08:00
|
|
|
#define NCSI_OEM_MLX_CMD_SMAF 0x01 /* CMD ID for Set MC Affinity */
|
|
|
|
#define NCSI_OEM_MLX_CMD_SMAF_PARAM 0x07 /* Parameter for SMAF */
|
2018-10-17 03:13:19 +08:00
|
|
|
/* OEM Command payload lengths*/
|
2021-08-31 01:18:06 +08:00
|
|
|
#define NCSI_OEM_INTEL_CMD_GMA_LEN 5
|
2021-07-08 20:27:53 +08:00
|
|
|
#define NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN 7
|
2018-10-17 03:13:19 +08:00
|
|
|
#define NCSI_OEM_BCM_CMD_GMA_LEN 12
|
2018-11-27 05:49:04 +08:00
|
|
|
#define NCSI_OEM_MLX_CMD_GMA_LEN 8
|
2020-01-09 07:43:40 +08:00
|
|
|
#define NCSI_OEM_MLX_CMD_SMAF_LEN 60
|
|
|
|
/* Offset in OEM request */
|
|
|
|
#define MLX_SMAF_MAC_ADDR_OFFSET 8 /* Offset for MAC in SMAF */
|
|
|
|
#define MLX_SMAF_MED_SUPPORT_OFFSET 14 /* Offset for medium in SMAF */
|
2018-10-17 03:13:19 +08:00
|
|
|
/* Mac address offset in OEM response */
|
|
|
|
#define BCM_MAC_ADDR_OFFSET 28
|
2018-11-27 05:49:04 +08:00
|
|
|
#define MLX_MAC_ADDR_OFFSET 8
|
2021-08-31 01:18:06 +08:00
|
|
|
#define INTEL_MAC_ADDR_OFFSET 1
|
2018-10-17 03:13:19 +08:00
|
|
|
|
2018-10-06 01:46:01 +08:00
|
|
|
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct ncsi_channel_version {
|
net/ncsi: Fix netlink major/minor version numbers
The netlink interface for major and minor version numbers doesn't actually
return the major and minor version numbers.
It reports a u32 that contains the (major, minor, update, alpha1)
components as the major version number, and then alpha2 as the minor
version number.
For whatever reason, the u32 byte order was reversed (ntohl): maybe it was
assumed that the encoded value was a single big-endian u32, and alpha2 was
the minor version.
The correct way to get the supported NC-SI version from the network
controller is to parse the Get Version ID response as described in 8.4.44
of the NC-SI spec[1].
Get Version ID Response Packet Format
Bits
+--------+--------+--------+--------+
Bytes | 31..24 | 23..16 | 15..8 | 7..0 |
+-------+--------+--------+--------+--------+
| 0..15 | NC-SI Header |
+-------+--------+--------+--------+--------+
| 16..19| Response code | Reason code |
+-------+--------+--------+--------+--------+
|20..23 | Major | Minor | Update | Alpha1 |
+-------+--------+--------+--------+--------+
|24..27 | reserved | Alpha2 |
+-------+--------+--------+--------+--------+
| .... other stuff .... |
The major, minor, and update fields are all binary-coded decimal (BCD)
encoded [2]. The spec provides examples below the Get Version ID response
format in section 8.4.44.1, but for practical purposes, this is an example
from a live network card:
root@bmc:~# ncsi-util 0x15
NC-SI Command Response:
cmd: GET_VERSION_ID(0x15)
Response: COMMAND_COMPLETED(0x0000) Reason: NO_ERROR(0x0000)
Payload length = 40
20: 0xf1 0xf1 0xf0 0x00 <<<<<<<<< (major, minor, update, alpha1)
24: 0x00 0x00 0x00 0x00 <<<<<<<<< (_, _, _, alpha2)
28: 0x6d 0x6c 0x78 0x30
32: 0x2e 0x31 0x00 0x00
36: 0x00 0x00 0x00 0x00
40: 0x16 0x1d 0x07 0xd2
44: 0x10 0x1d 0x15 0xb3
48: 0x00 0x17 0x15 0xb3
52: 0x00 0x00 0x81 0x19
This should be parsed as "1.1.0".
"f" in the upper-nibble means to ignore it, contributing zero.
If both nibbles are "f", I think the whole field is supposed to be ignored.
Major and minor are "required", meaning they're not supposed to be "ff",
but the update field is "optional" so I think it can be ff. I think the
simplest thing to do is just set the major and minor to zero instead of
juggling some conditional logic or something.
bcd2bin() from "include/linux/bcd.h" seems to assume both nibbles are 0-9,
so I've provided a custom BCD decoding function.
Alpha1 and alpha2 are ISO/IEC 8859-1 encoded, which just means ASCII
characters as far as I can tell, although the full encoding table for
non-alphabetic characters is slightly different (I think).
I imagine the alpha fields are just supposed to be alphabetic characters,
but I haven't seen any network cards actually report a non-zero value for
either.
If people wrote software against this netlink behavior, and were parsing
the major and minor versions themselves from the u32, then this would
definitely break their code.
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.0.0.pdf
[2] https://en.wikipedia.org/wiki/Binary-coded_decimal
[2] https://en.wikipedia.org/wiki/ISO/IEC_8859-1
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Fixes: 138635cc27c9 ("net/ncsi: NCSI response packet handler")
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-11-15 00:07:34 +08:00
|
|
|
u8 major; /* NCSI version major */
|
|
|
|
u8 minor; /* NCSI version minor */
|
|
|
|
u8 update; /* NCSI version update */
|
|
|
|
char alpha1; /* NCSI version alpha1 */
|
|
|
|
char alpha2; /* NCSI version alpha2 */
|
2021-03-27 07:12:47 +08:00
|
|
|
u8 fw_name[12]; /* Firmware name string */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
u32 fw_version; /* Firmware version */
|
|
|
|
u16 pci_ids[4]; /* PCI identification */
|
|
|
|
u32 mf_id; /* Manufacture ID */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_channel_cap {
|
|
|
|
u32 index; /* Index of channel capabilities */
|
|
|
|
u32 cap; /* NCSI channel capability */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_channel_mode {
|
|
|
|
u32 index; /* Index of channel modes */
|
|
|
|
u32 enable; /* Enabled or disabled */
|
|
|
|
u32 size; /* Valid entries in ncm_data[] */
|
|
|
|
u32 data[8]; /* Data entries */
|
|
|
|
};
|
|
|
|
|
2018-04-17 12:23:23 +08:00
|
|
|
struct ncsi_channel_mac_filter {
|
|
|
|
u8 n_uc;
|
|
|
|
u8 n_mc;
|
|
|
|
u8 n_mixed;
|
|
|
|
u64 bitmap;
|
|
|
|
unsigned char *addrs;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_channel_vlan_filter {
|
|
|
|
u8 n_vids;
|
|
|
|
u64 bitmap;
|
|
|
|
u16 *vids;
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_channel_stats {
|
|
|
|
u32 hnc_cnt_hi; /* Counter cleared */
|
|
|
|
u32 hnc_cnt_lo; /* Counter cleared */
|
|
|
|
u32 hnc_rx_bytes; /* Rx bytes */
|
|
|
|
u32 hnc_tx_bytes; /* Tx bytes */
|
|
|
|
u32 hnc_rx_uc_pkts; /* Rx UC packets */
|
|
|
|
u32 hnc_rx_mc_pkts; /* Rx MC packets */
|
|
|
|
u32 hnc_rx_bc_pkts; /* Rx BC packets */
|
|
|
|
u32 hnc_tx_uc_pkts; /* Tx UC packets */
|
|
|
|
u32 hnc_tx_mc_pkts; /* Tx MC packets */
|
|
|
|
u32 hnc_tx_bc_pkts; /* Tx BC packets */
|
|
|
|
u32 hnc_fcs_err; /* FCS errors */
|
|
|
|
u32 hnc_align_err; /* Alignment errors */
|
|
|
|
u32 hnc_false_carrier; /* False carrier detection */
|
|
|
|
u32 hnc_runt_pkts; /* Rx runt packets */
|
|
|
|
u32 hnc_jabber_pkts; /* Rx jabber packets */
|
|
|
|
u32 hnc_rx_pause_xon; /* Rx pause XON frames */
|
|
|
|
u32 hnc_rx_pause_xoff; /* Rx XOFF frames */
|
|
|
|
u32 hnc_tx_pause_xon; /* Tx XON frames */
|
|
|
|
u32 hnc_tx_pause_xoff; /* Tx XOFF frames */
|
|
|
|
u32 hnc_tx_s_collision; /* Single collision frames */
|
|
|
|
u32 hnc_tx_m_collision; /* Multiple collision frames */
|
|
|
|
u32 hnc_l_collision; /* Late collision frames */
|
|
|
|
u32 hnc_e_collision; /* Excessive collision frames */
|
|
|
|
u32 hnc_rx_ctl_frames; /* Rx control frames */
|
|
|
|
u32 hnc_rx_64_frames; /* Rx 64-bytes frames */
|
|
|
|
u32 hnc_rx_127_frames; /* Rx 65-127 bytes frames */
|
|
|
|
u32 hnc_rx_255_frames; /* Rx 128-255 bytes frames */
|
|
|
|
u32 hnc_rx_511_frames; /* Rx 256-511 bytes frames */
|
|
|
|
u32 hnc_rx_1023_frames; /* Rx 512-1023 bytes frames */
|
|
|
|
u32 hnc_rx_1522_frames; /* Rx 1024-1522 bytes frames */
|
|
|
|
u32 hnc_rx_9022_frames; /* Rx 1523-9022 bytes frames */
|
|
|
|
u32 hnc_tx_64_frames; /* Tx 64-bytes frames */
|
|
|
|
u32 hnc_tx_127_frames; /* Tx 65-127 bytes frames */
|
|
|
|
u32 hnc_tx_255_frames; /* Tx 128-255 bytes frames */
|
|
|
|
u32 hnc_tx_511_frames; /* Tx 256-511 bytes frames */
|
|
|
|
u32 hnc_tx_1023_frames; /* Tx 512-1023 bytes frames */
|
|
|
|
u32 hnc_tx_1522_frames; /* Tx 1024-1522 bytes frames */
|
|
|
|
u32 hnc_tx_9022_frames; /* Tx 1523-9022 bytes frames */
|
|
|
|
u32 hnc_rx_valid_bytes; /* Rx valid bytes */
|
|
|
|
u32 hnc_rx_runt_pkts; /* Rx error runt packets */
|
|
|
|
u32 hnc_rx_jabber_pkts; /* Rx error jabber packets */
|
|
|
|
u32 ncsi_rx_cmds; /* Rx NCSI commands */
|
|
|
|
u32 ncsi_dropped_cmds; /* Dropped commands */
|
|
|
|
u32 ncsi_cmd_type_errs; /* Command type errors */
|
|
|
|
u32 ncsi_cmd_csum_errs; /* Command checksum errors */
|
|
|
|
u32 ncsi_rx_pkts; /* Rx NCSI packets */
|
|
|
|
u32 ncsi_tx_pkts; /* Tx NCSI packets */
|
|
|
|
u32 ncsi_tx_aen_pkts; /* Tx AEN packets */
|
|
|
|
u32 pt_tx_pkts; /* Tx packets */
|
|
|
|
u32 pt_tx_dropped; /* Tx dropped packets */
|
|
|
|
u32 pt_tx_channel_err; /* Tx channel errors */
|
|
|
|
u32 pt_tx_us_err; /* Tx undersize errors */
|
|
|
|
u32 pt_rx_pkts; /* Rx packets */
|
|
|
|
u32 pt_rx_dropped; /* Rx dropped packets */
|
|
|
|
u32 pt_rx_channel_err; /* Rx channel errors */
|
|
|
|
u32 pt_rx_us_err; /* Rx undersize errors */
|
|
|
|
u32 pt_rx_os_err; /* Rx oversize errors */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_dev_priv;
|
|
|
|
struct ncsi_package;
|
|
|
|
|
|
|
|
#define NCSI_PACKAGE_SHIFT 5
|
|
|
|
#define NCSI_PACKAGE_INDEX(c) (((c) >> NCSI_PACKAGE_SHIFT) & 0x7)
|
2016-10-04 08:25:48 +08:00
|
|
|
#define NCSI_RESERVED_CHANNEL 0x1f
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
#define NCSI_CHANNEL_INDEX(c) ((c) & ((1 << NCSI_PACKAGE_SHIFT) - 1))
|
|
|
|
#define NCSI_TO_CHANNEL(p, c) (((p) << NCSI_PACKAGE_SHIFT) | (c))
|
2018-10-12 02:07:37 +08:00
|
|
|
#define NCSI_MAX_PACKAGE 8
|
|
|
|
#define NCSI_MAX_CHANNEL 32
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
|
|
|
|
struct ncsi_channel {
|
|
|
|
unsigned char id;
|
|
|
|
int state;
|
|
|
|
#define NCSI_CHANNEL_INACTIVE 1
|
|
|
|
#define NCSI_CHANNEL_ACTIVE 2
|
2016-07-19 09:54:19 +08:00
|
|
|
#define NCSI_CHANNEL_INVISIBLE 3
|
2017-08-28 14:18:42 +08:00
|
|
|
bool reconfigure_needed;
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
spinlock_t lock; /* Protect filters etc */
|
|
|
|
struct ncsi_package *package;
|
|
|
|
struct ncsi_channel_version version;
|
|
|
|
struct ncsi_channel_cap caps[NCSI_CAP_MAX];
|
|
|
|
struct ncsi_channel_mode modes[NCSI_MODE_MAX];
|
2018-04-17 12:23:23 +08:00
|
|
|
/* Filtering Settings */
|
|
|
|
struct ncsi_channel_mac_filter mac_filter;
|
|
|
|
struct ncsi_channel_vlan_filter vlan_filter;
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct ncsi_channel_stats stats;
|
2016-10-04 08:25:52 +08:00
|
|
|
struct {
|
|
|
|
struct timer_list timer;
|
|
|
|
bool enabled;
|
|
|
|
unsigned int state;
|
|
|
|
#define NCSI_CHANNEL_MONITOR_START 0
|
|
|
|
#define NCSI_CHANNEL_MONITOR_RETRY 1
|
|
|
|
#define NCSI_CHANNEL_MONITOR_WAIT 2
|
|
|
|
#define NCSI_CHANNEL_MONITOR_WAIT_MAX 5
|
|
|
|
} monitor;
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct list_head node;
|
2016-07-19 09:54:19 +08:00
|
|
|
struct list_head link;
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_package {
|
|
|
|
unsigned char id; /* NCSI 3-bits package ID */
|
|
|
|
unsigned char uuid[16]; /* UUID */
|
|
|
|
struct ncsi_dev_priv *ndp; /* NCSI device */
|
|
|
|
spinlock_t lock; /* Protect the package */
|
|
|
|
unsigned int channel_num; /* Number of channels */
|
2021-06-07 23:01:18 +08:00
|
|
|
struct list_head channels; /* List of channels */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct list_head node; /* Form list of packages */
|
2018-11-16 12:51:59 +08:00
|
|
|
|
|
|
|
bool multi_channel; /* Enable multiple channels */
|
|
|
|
u32 channel_whitelist; /* Channels to configure */
|
|
|
|
struct ncsi_channel *preferred_channel; /* Primary channel */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ncsi_request {
|
|
|
|
unsigned char id; /* Request ID - 0 to 255 */
|
|
|
|
bool used; /* Request that has been assigned */
|
2016-10-04 08:25:51 +08:00
|
|
|
unsigned int flags; /* NCSI request property */
|
|
|
|
#define NCSI_REQ_FLAG_EVENT_DRIVEN 1
|
2018-10-12 02:07:37 +08:00
|
|
|
#define NCSI_REQ_FLAG_NETLINK_DRIVEN 2
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct ncsi_dev_priv *ndp; /* Associated NCSI device */
|
|
|
|
struct sk_buff *cmd; /* Associated NCSI command packet */
|
|
|
|
struct sk_buff *rsp; /* Associated NCSI response packet */
|
|
|
|
struct timer_list timer; /* Timer on waiting for response */
|
|
|
|
bool enabled; /* Time has been enabled or not */
|
2018-10-12 02:07:37 +08:00
|
|
|
u32 snd_seq; /* netlink sending sequence number */
|
|
|
|
u32 snd_portid; /* netlink portid of sender */
|
|
|
|
struct nlmsghdr nlhdr; /* netlink message header */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
};
|
|
|
|
|
2016-07-19 09:54:19 +08:00
|
|
|
enum {
|
|
|
|
ncsi_dev_state_major = 0xff00,
|
|
|
|
ncsi_dev_state_minor = 0x00ff,
|
|
|
|
ncsi_dev_state_probe_deselect = 0x0201,
|
|
|
|
ncsi_dev_state_probe_package,
|
|
|
|
ncsi_dev_state_probe_channel,
|
2020-01-09 07:43:40 +08:00
|
|
|
ncsi_dev_state_probe_mlx_gma,
|
|
|
|
ncsi_dev_state_probe_mlx_smaf,
|
2016-07-19 09:54:19 +08:00
|
|
|
ncsi_dev_state_probe_cis,
|
2021-07-08 20:27:53 +08:00
|
|
|
ncsi_dev_state_probe_keep_phy,
|
2016-07-19 09:54:19 +08:00
|
|
|
ncsi_dev_state_probe_gvi,
|
|
|
|
ncsi_dev_state_probe_gc,
|
|
|
|
ncsi_dev_state_probe_gls,
|
|
|
|
ncsi_dev_state_probe_dp,
|
|
|
|
ncsi_dev_state_config_sp = 0x0301,
|
|
|
|
ncsi_dev_state_config_cis,
|
2018-10-17 03:13:19 +08:00
|
|
|
ncsi_dev_state_config_oem_gma,
|
2017-08-28 14:18:42 +08:00
|
|
|
ncsi_dev_state_config_clear_vids,
|
|
|
|
ncsi_dev_state_config_svf,
|
|
|
|
ncsi_dev_state_config_ev,
|
2016-07-19 09:54:19 +08:00
|
|
|
ncsi_dev_state_config_sma,
|
|
|
|
ncsi_dev_state_config_ebf,
|
2019-09-13 03:04:50 +08:00
|
|
|
ncsi_dev_state_config_dgmf,
|
2016-07-19 09:54:19 +08:00
|
|
|
ncsi_dev_state_config_ecnt,
|
|
|
|
ncsi_dev_state_config_ec,
|
|
|
|
ncsi_dev_state_config_ae,
|
|
|
|
ncsi_dev_state_config_gls,
|
|
|
|
ncsi_dev_state_config_done,
|
|
|
|
ncsi_dev_state_suspend_select = 0x0401,
|
2016-10-20 08:45:50 +08:00
|
|
|
ncsi_dev_state_suspend_gls,
|
2016-07-19 09:54:19 +08:00
|
|
|
ncsi_dev_state_suspend_dcnt,
|
|
|
|
ncsi_dev_state_suspend_dc,
|
|
|
|
ncsi_dev_state_suspend_deselect,
|
|
|
|
ncsi_dev_state_suspend_done
|
|
|
|
};
|
|
|
|
|
2017-08-28 14:18:42 +08:00
|
|
|
struct vlan_vid {
|
|
|
|
struct list_head list;
|
|
|
|
__be16 proto;
|
|
|
|
u16 vid;
|
|
|
|
};
|
|
|
|
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct ncsi_dev_priv {
|
|
|
|
struct ncsi_dev ndev; /* Associated NCSI device */
|
|
|
|
unsigned int flags; /* NCSI device flags */
|
2016-07-19 09:54:19 +08:00
|
|
|
#define NCSI_DEV_PROBED 1 /* Finalized NCSI topology */
|
|
|
|
#define NCSI_DEV_HWA 2 /* Enabled HW arbitration */
|
|
|
|
#define NCSI_DEV_RESHUFFLE 4
|
2018-11-16 12:51:58 +08:00
|
|
|
#define NCSI_DEV_RESET 8 /* Reset state of NC */
|
2018-10-17 03:13:19 +08:00
|
|
|
unsigned int gma_flag; /* OEM GMA flag */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
spinlock_t lock; /* Protect the NCSI device */
|
2018-11-16 12:51:55 +08:00
|
|
|
unsigned int package_probe_id;/* Current ID during probe */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
unsigned int package_num; /* Number of packages */
|
2024-05-29 14:58:55 +08:00
|
|
|
unsigned int channel_probe_id;/* Current cahnnel ID during probe */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct list_head packages; /* List of packages */
|
2016-10-20 08:45:51 +08:00
|
|
|
struct ncsi_channel *hot_channel; /* Channel was ever active */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct ncsi_request requests[256]; /* Request table */
|
|
|
|
unsigned int request_id; /* Last used request ID */
|
2016-10-04 08:25:50 +08:00
|
|
|
#define NCSI_REQ_START_IDX 1
|
2016-07-19 09:54:19 +08:00
|
|
|
unsigned int pending_req_num; /* Number of pending requests */
|
|
|
|
struct ncsi_package *active_package; /* Currently handled package */
|
|
|
|
struct ncsi_channel *active_channel; /* Currently handled channel */
|
|
|
|
struct list_head channel_queue; /* Config queue of channels */
|
|
|
|
struct work_struct work; /* For channel management */
|
|
|
|
struct packet_type ptype; /* NCSI packet Rx handler */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct list_head node; /* Form NCSI device list */
|
2017-10-11 13:54:27 +08:00
|
|
|
#define NCSI_MAX_VLAN_VIDS 15
|
2017-08-28 14:18:42 +08:00
|
|
|
struct list_head vlan_vids; /* List of active VLAN IDs */
|
2018-11-16 12:51:59 +08:00
|
|
|
|
|
|
|
bool multi_package; /* Enable multiple packages */
|
2020-01-09 07:43:40 +08:00
|
|
|
bool mlx_multi_host; /* Enable multi host Mellanox */
|
2018-11-16 12:51:59 +08:00
|
|
|
u32 package_whitelist; /* Packages to configure */
|
2024-05-29 14:58:55 +08:00
|
|
|
unsigned char channel_count; /* Num of channels to probe */
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
};
|
|
|
|
|
2016-07-19 09:54:17 +08:00
|
|
|
struct ncsi_cmd_arg {
|
|
|
|
struct ncsi_dev_priv *ndp; /* Associated NCSI device */
|
|
|
|
unsigned char type; /* Command in the NCSI packet */
|
|
|
|
unsigned char id; /* Request ID (sequence number) */
|
|
|
|
unsigned char package; /* Destination package ID */
|
2021-06-07 23:01:18 +08:00
|
|
|
unsigned char channel; /* Destination channel ID or 0x1f */
|
2016-07-19 09:54:17 +08:00
|
|
|
unsigned short payload; /* Command packet payload length */
|
2016-10-04 08:25:51 +08:00
|
|
|
unsigned int req_flags; /* NCSI request properties */
|
2016-07-19 09:54:17 +08:00
|
|
|
union {
|
|
|
|
unsigned char bytes[16]; /* Command packet specific data */
|
|
|
|
unsigned short words[8];
|
|
|
|
unsigned int dwords[4];
|
|
|
|
};
|
2018-10-06 01:46:01 +08:00
|
|
|
unsigned char *data; /* NCSI OEM data */
|
2018-10-12 02:07:37 +08:00
|
|
|
struct genl_info *info; /* Netlink information */
|
2016-07-19 09:54:17 +08:00
|
|
|
};
|
|
|
|
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
extern struct list_head ncsi_dev_list;
|
|
|
|
extern spinlock_t ncsi_dev_lock;
|
|
|
|
|
|
|
|
#define TO_NCSI_DEV_PRIV(nd) \
|
|
|
|
container_of(nd, struct ncsi_dev_priv, ndev)
|
|
|
|
#define NCSI_FOR_EACH_DEV(ndp) \
|
|
|
|
list_for_each_entry_rcu(ndp, &ncsi_dev_list, node)
|
|
|
|
#define NCSI_FOR_EACH_PACKAGE(ndp, np) \
|
|
|
|
list_for_each_entry_rcu(np, &ndp->packages, node)
|
|
|
|
#define NCSI_FOR_EACH_CHANNEL(np, nc) \
|
|
|
|
list_for_each_entry_rcu(nc, &np->channels, node)
|
|
|
|
|
|
|
|
/* Resources */
|
2018-11-16 12:51:58 +08:00
|
|
|
int ncsi_reset_dev(struct ncsi_dev *nd);
|
2016-07-19 09:54:19 +08:00
|
|
|
void ncsi_start_channel_monitor(struct ncsi_channel *nc);
|
|
|
|
void ncsi_stop_channel_monitor(struct ncsi_channel *nc);
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
struct ncsi_channel *ncsi_find_channel(struct ncsi_package *np,
|
|
|
|
unsigned char id);
|
|
|
|
struct ncsi_channel *ncsi_add_channel(struct ncsi_package *np,
|
|
|
|
unsigned char id);
|
|
|
|
struct ncsi_package *ncsi_find_package(struct ncsi_dev_priv *ndp,
|
|
|
|
unsigned char id);
|
|
|
|
struct ncsi_package *ncsi_add_package(struct ncsi_dev_priv *ndp,
|
|
|
|
unsigned char id);
|
|
|
|
void ncsi_remove_package(struct ncsi_package *np);
|
|
|
|
void ncsi_find_package_and_channel(struct ncsi_dev_priv *ndp,
|
|
|
|
unsigned char id,
|
|
|
|
struct ncsi_package **np,
|
|
|
|
struct ncsi_channel **nc);
|
2016-10-04 08:25:51 +08:00
|
|
|
struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp,
|
|
|
|
unsigned int req_flags);
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
void ncsi_free_request(struct ncsi_request *nr);
|
|
|
|
struct ncsi_dev *ncsi_find_dev(struct net_device *dev);
|
2016-07-19 09:54:19 +08:00
|
|
|
int ncsi_process_next_channel(struct ncsi_dev_priv *ndp);
|
2018-11-16 12:51:59 +08:00
|
|
|
bool ncsi_channel_has_link(struct ncsi_channel *channel);
|
|
|
|
bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp,
|
|
|
|
struct ncsi_channel *channel);
|
|
|
|
int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp,
|
|
|
|
struct ncsi_package *np,
|
|
|
|
struct ncsi_channel *disable,
|
|
|
|
struct ncsi_channel *enable);
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
|
2016-07-19 09:54:17 +08:00
|
|
|
/* Packet handlers */
|
|
|
|
u32 ncsi_calculate_checksum(unsigned char *data, int len);
|
|
|
|
int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca);
|
2016-07-19 09:54:18 +08:00
|
|
|
int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev,
|
|
|
|
struct packet_type *pt, struct net_device *orig_dev);
|
2016-07-19 09:54:20 +08:00
|
|
|
int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb);
|
2016-07-19 09:54:17 +08:00
|
|
|
|
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 09:54:16 +08:00
|
|
|
#endif /* __NCSI_INTERNAL_H__ */
|