Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion vm/devices/net/netvsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5392,12 +5392,23 @@ impl<T: 'static + RingMem> NetChannel<T> {
}
PacketData::SubChannelRequest(request) if state.primary.is_some() => {
let mut subchannel_count = 0;
// The number of requested subchannels has to stay below the maximum queue limit
// because one queue is always reserved for the primary channel. In other words,
// the subchannels plus the primary channel must fit within the max_queues value,
// which means subchannels + 1 ≤ max_queues, so the subchannel count must be
// strictly less than max_queues.
let status = if request.operation == protocol::SubchannelOperation::ALLOCATE
&& request.num_sub_channels <= self.adapter.max_queues.into()
&& request.num_sub_channels < self.adapter.max_queues.into()
{
subchannel_count = request.num_sub_channels;
protocol::Status::SUCCESS
} else {
tracelimit::warn_ratelimited!(
operation = ?request.operation,
request_sub_channels = request.num_sub_channels,
max_supported_sub_channels = self.adapter.max_queues - 1,
"Subchannel request failed: either operation is not supported or requested more subchannels than supported"
);
protocol::Status::FAILURE
};

Expand Down