From f3078574f02e4a06e1fb8fb8468920bba431a9e7 Mon Sep 17 00:00:00 2001 From: Xiaobing Zhang Date: Sun, 23 Aug 2020 12:54:00 -0400 Subject: [PATCH] Kernel 4.1: ftgmac: Increase maximum NC-SI response payload size Summary: Increase max NC-SI response payload to 1480 in kernel for big response packets that are used in Broadcom OEM GetDebugData. Test plan: - fby2 and fbgp2 image build (pass) - Update and boot the image on YosemiteV2 and V2.5 (pass) - BMC initializes NC-SI interface with NIC (pass) - Use ncsi-util send various commands such as 0x18, 0x19 and 0x1a (pass) - Use ncsi-util to perform PLDM firmware update (pass) - Use ncsi-uitl Broadcom OEM GetDebugData command to retrieve core dump and crash dump from NIC (pass) --- drivers/net/ethernet/faraday/ftgmac100.c | 6 +----- drivers/net/ethernet/faraday/ftgmac100.h | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 4fc33d8ac828..6d1d6dbe2d07 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -59,10 +59,6 @@ #define MAX_PKT_SIZE 1518 #define RX_BUF_SIZE PAGE_SIZE /* must be smaller than 0x3fff */ -#define MAX_NCSI_DATA_PAYLOAD 1480 /* for getting the size of the nc-si control data packet */ - /* max ethernet frame size = 1518 */ - /* ethernet headr (14) + nc-si header (16) + nc-si payload (1480) + nc-si checksum (4) + 4 (FCS) = 1518*/ - #define noNCSI_DEBUG /* for debug printf messages */ /* @@ -166,7 +162,7 @@ typedef struct ncsi_nl_msg_t { } NCSI_NL_MSG_T; -#define MAX_RESPONSE_PAYLOAD 1024 /* maximum payload size*/ +#define MAX_RESPONSE_PAYLOAD MAX_NCSI_DATA_PAYLOAD /* maximum payload size*/ typedef struct ncsi_nl_response { uint8_t cmd; uint16_t payload_length; diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h index dc42cf0143d8..fc442d3f77f5 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.h +++ b/drivers/net/ethernet/faraday/ftgmac100.h @@ -294,6 +294,10 @@ typedef struct { #define GET_NCSI_STATISTICS 0x19 #define GET_NCSI_PASS_THROUGH_STATISTICS 0x1A +#define MAX_NCSI_DATA_PAYLOAD 1480 /* for getting the size of the nc-si control data packet */ + /* max ethernet frame size = 1518 */ + /* ethernet headr (14) + nc-si header (16) + nc-si payload (1480) + nc-si checksum (4) + 4 (FCS) = 1518*/ + /* NC-SI Response Packet */ typedef struct { unsigned char DA[6]; @@ -319,7 +323,7 @@ typedef struct { /* end of NC-SI header */ unsigned short Response_Code; unsigned short Reason_Code; - unsigned char Payload_Data[256]; + unsigned char Payload_Data[MAX_NCSI_DATA_PAYLOAD-4]; /* Exclude resp/reason code */ } __attribute__((packed)) NCSI_Response_Packet;