Skip to content

Commit

Permalink
net/ncsi: NCSI command packet handler
Browse files Browse the repository at this point in the history
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 <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gavin Shan authored and David S. Miller committed Jul 20, 2016
1 parent 2d283bd commit 6389eaa
Show file tree
Hide file tree
Showing 5 changed files with 559 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/uapi/linux/if_ether.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
#define ETH_P_NCSI 0x88F8 /* NCSI protocol */
#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
#define ETH_P_TDLS 0x890D /* TDLS */
Expand Down
2 changes: 1 addition & 1 deletion net/ncsi/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
# Makefile for NCSI API
#
obj-$(CONFIG_NET_NCSI) += ncsi-manage.o
obj-$(CONFIG_NET_NCSI) += ncsi-cmd.o ncsi-manage.o
19 changes: 19 additions & 0 deletions net/ncsi/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@ struct ncsi_dev_priv {
struct list_head node; /* Form NCSI device list */
};

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 */
unsigned char channel; /* Detination channel ID or 0x1f */
unsigned short payload; /* Command packet payload length */
bool driven; /* Drive the state machine? */
union {
unsigned char bytes[16]; /* Command packet specific data */
unsigned short words[8];
unsigned int dwords[4];
};
};

extern struct list_head ncsi_dev_list;
extern spinlock_t ncsi_dev_lock;

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

/* Packet handlers */
u32 ncsi_calculate_checksum(unsigned char *data, int len);
int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca);

#endif /* __NCSI_INTERNAL_H__ */
Loading

0 comments on commit 6389eaa

Please sign in to comment.