Skip to content

Commit 6389eaa

Browse files
Gavin Shandavem330
authored andcommitted
net/ncsi: NCSI command packet handler
The NCSI command packets are sent from MC (Management Controller) to remote end. They are used for multiple purposes: probe existing NCSI package/channel, retrieve NCSI channel's capability, configure NCSI channel etc. This defines struct to represent NCSI command packets and introduces function ncsi_xmit_cmd(), which will be used to transmit NCSI command packet according to the request. The request is represented by struct ncsi_cmd_arg. Signed-off-by: Gavin Shan <[email protected]> Acked-by: Joel Stanley <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d283bd commit 6389eaa

File tree

5 files changed

+559
-1
lines changed

5 files changed

+559
-1
lines changed

include/uapi/linux/if_ether.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
8888
#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
8989
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
90+
#define ETH_P_NCSI 0x88F8 /* NCSI protocol */
9091
#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */
9192
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
9293
#define ETH_P_TDLS 0x890D /* TDLS */

net/ncsi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#
22
# Makefile for NCSI API
33
#
4-
obj-$(CONFIG_NET_NCSI) += ncsi-manage.o
4+
obj-$(CONFIG_NET_NCSI) += ncsi-cmd.o ncsi-manage.o

net/ncsi/internal.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,21 @@ struct ncsi_dev_priv {
220220
struct list_head node; /* Form NCSI device list */
221221
};
222222

223+
struct ncsi_cmd_arg {
224+
struct ncsi_dev_priv *ndp; /* Associated NCSI device */
225+
unsigned char type; /* Command in the NCSI packet */
226+
unsigned char id; /* Request ID (sequence number) */
227+
unsigned char package; /* Destination package ID */
228+
unsigned char channel; /* Detination channel ID or 0x1f */
229+
unsigned short payload; /* Command packet payload length */
230+
bool driven; /* Drive the state machine? */
231+
union {
232+
unsigned char bytes[16]; /* Command packet specific data */
233+
unsigned short words[8];
234+
unsigned int dwords[4];
235+
};
236+
};
237+
223238
extern struct list_head ncsi_dev_list;
224239
extern spinlock_t ncsi_dev_lock;
225240

@@ -253,4 +268,8 @@ struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp, bool driven);
253268
void ncsi_free_request(struct ncsi_request *nr);
254269
struct ncsi_dev *ncsi_find_dev(struct net_device *dev);
255270

271+
/* Packet handlers */
272+
u32 ncsi_calculate_checksum(unsigned char *data, int len);
273+
int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca);
274+
256275
#endif /* __NCSI_INTERNAL_H__ */

0 commit comments

Comments
 (0)