diff options
author | Evan Lojewski <github@meklort.com> | 2020-07-04 19:43:20 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-04 19:43:20 -0600 |
commit | 5b4d0ab9a70278ab3e696f70d68a4ad0e87ce711 (patch) | |
tree | a3e986b5f7a9553640a68ad461ff54ee0a40f220 /libs | |
parent | 4061d48dbb0b1ef94b934a439d0605380d0a8c88 (diff) | |
download | bcm5719-ortega-5b4d0ab9a70278ab3e696f70d68a4ad0e87ce711.tar.gz bcm5719-ortega-5b4d0ab9a70278ab3e696f70d68a4ad0e87ce711.zip |
ncsi: Don't report an error when clearing the initial state of nonexistent channels. (#83)
The NCSI specification implies that when a channel does not exist, no response is given.
This behavior is consistent with the proprietary firmware.
When a response is given, the linux kernel spews (~30 times) "NCSI: 'bad' packet
ignored for type 0x80" on an invalid response. Disable the response to silence
these messages and make the behavior match the proprietary firmware.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/NCSI/ncsi.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/NCSI/ncsi.c b/libs/NCSI/ncsi.c index 9981102..91197a4 100644 --- a/libs/NCSI/ncsi.c +++ b/libs/NCSI/ncsi.c @@ -285,11 +285,15 @@ static void clearInitialStateHandler(NetworkFrame_t *frame) { int ch = frame->controlPacket.ChannelID & CHANNEL_ID_MASK; - gPackageState.port[ch]->shm_channel->NcsiChannelInfo.bits.Ready = true; - debug("Clear initial state: channel %x\n", ch); + // Only send a response if this channel exists. + if (ch < NUM_CHANNELS) + { + gPackageState.port[ch]->shm_channel->NcsiChannelInfo.bits.Ready = true; + debug("Clear initial state: channel %x\n", ch); - sendNCSIResponse(frame->controlPacket.InstanceID, frame->controlPacket.ChannelID, frame->controlPacket.ControlPacketType, - NCSI_RESPONSE_CODE_COMMAND_COMPLETE, NCSI_REASON_CODE_NONE); + sendNCSIResponse(frame->controlPacket.InstanceID, frame->controlPacket.ChannelID, frame->controlPacket.ControlPacketType, + NCSI_RESPONSE_CODE_COMMAND_COMPLETE, NCSI_REASON_CODE_NONE); + } } static void selectPackageHandler(NetworkFrame_t *frame) @@ -617,7 +621,7 @@ void handleNCSIFrame(NetworkFrame_t *frame) NCSI_RESPONSE_CODE_COMMAND_FAILED, NCSI_REASON_CODE_INVALID_PAYLOAD_LENGTH); } else if ((handler->packageCommand && ch == CHANNEL_ID_PACKAGE) || // Package commands are always accepted. - (handler->ignoreInit && ch < NUM_CHANNELS)) + (handler->ignoreInit)) { // Package command. Must handle. debug("[%x] packageCommand/ignore init channel: %d\n", command, ch); |