提交 c0788f74 编写于 作者: P Pavel Belous 提交者: David S. Miller

net: ethernet: aquantia: Fixed incorrect buff->len calculation.

rxd_wb->pkt_len is the total length of the packet.
If we received a large packet (with length > AQ_CFG_RX_FRAME_MAX) then we
will get multiple buffers. We need to fix the length of the last buffer.
Signed-off-by: NPavel Belous <pavel.belous@aquantia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 55629109
...@@ -659,8 +659,8 @@ static int hw_atl_a0_hw_ring_rx_receive(struct aq_hw_s *self, ...@@ -659,8 +659,8 @@ static int hw_atl_a0_hw_ring_rx_receive(struct aq_hw_s *self,
} }
if (HW_ATL_A0_RXD_WB_STAT2_EOP & rxd_wb->status) { if (HW_ATL_A0_RXD_WB_STAT2_EOP & rxd_wb->status) {
buff->len = (rxd_wb->pkt_len & buff->len = rxd_wb->pkt_len %
(AQ_CFG_RX_FRAME_MAX - 1U)); AQ_CFG_RX_FRAME_MAX;
buff->len = buff->len ? buff->len = buff->len ?
buff->len : AQ_CFG_RX_FRAME_MAX; buff->len : AQ_CFG_RX_FRAME_MAX;
buff->next = 0U; buff->next = 0U;
......
...@@ -673,8 +673,8 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, ...@@ -673,8 +673,8 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self,
} }
if (HW_ATL_B0_RXD_WB_STAT2_EOP & rxd_wb->status) { if (HW_ATL_B0_RXD_WB_STAT2_EOP & rxd_wb->status) {
buff->len = (rxd_wb->pkt_len & buff->len = rxd_wb->pkt_len %
(AQ_CFG_RX_FRAME_MAX - 1U)); AQ_CFG_RX_FRAME_MAX;
buff->len = buff->len ? buff->len = buff->len ?
buff->len : AQ_CFG_RX_FRAME_MAX; buff->len : AQ_CFG_RX_FRAME_MAX;
buff->next = 0U; buff->next = 0U;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册