-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds the defines and structures necessary to support both Tx and Rx descriptor rings. Signed-off-by: Sasha Neftin <sasha.neftin@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
- Loading branch information
Sasha Neftin
authored and
Jeff Kirsher
committed
Oct 17, 2018
1 parent
3df25e4
commit 13b5b7f
Showing
8 changed files
with
1,172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
|
||
obj-$(CONFIG_IGC) += igc.o | ||
|
||
igc-objs := igc_main.o igc_mac.o | ||
igc-objs := igc_main.o igc_mac.o igc_base.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2018 Intel Corporation */ | ||
|
||
#include <linux/delay.h> | ||
|
||
#include "igc_hw.h" | ||
#include "igc_i225.h" | ||
|
||
/** | ||
* igc_rx_fifo_flush_base - Clean rx fifo after Rx enable | ||
* @hw: pointer to the HW structure | ||
* | ||
* After Rx enable, if manageability is enabled then there is likely some | ||
* bad data at the start of the fifo and possibly in the DMA fifo. This | ||
* function clears the fifos and flushes any packets that came in as rx was | ||
* being enabled. | ||
*/ | ||
void igc_rx_fifo_flush_base(struct igc_hw *hw) | ||
{ | ||
u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; | ||
int i, ms_wait; | ||
|
||
/* disable IPv6 options as per hardware errata */ | ||
rfctl = rd32(IGC_RFCTL); | ||
rfctl |= IGC_RFCTL_IPV6_EX_DIS; | ||
wr32(IGC_RFCTL, rfctl); | ||
|
||
if (!(rd32(IGC_MANC) & IGC_MANC_RCV_TCO_EN)) | ||
return; | ||
|
||
/* Disable all Rx queues */ | ||
for (i = 0; i < 4; i++) { | ||
rxdctl[i] = rd32(IGC_RXDCTL(i)); | ||
wr32(IGC_RXDCTL(i), | ||
rxdctl[i] & ~IGC_RXDCTL_QUEUE_ENABLE); | ||
} | ||
/* Poll all queues to verify they have shut down */ | ||
for (ms_wait = 0; ms_wait < 10; ms_wait++) { | ||
usleep_range(1000, 2000); | ||
rx_enabled = 0; | ||
for (i = 0; i < 4; i++) | ||
rx_enabled |= rd32(IGC_RXDCTL(i)); | ||
if (!(rx_enabled & IGC_RXDCTL_QUEUE_ENABLE)) | ||
break; | ||
} | ||
|
||
if (ms_wait == 10) | ||
pr_debug("Queue disable timed out after 10ms\n"); | ||
|
||
/* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all | ||
* incoming packets are rejected. Set enable and wait 2ms so that | ||
* any packet that was coming in as RCTL.EN was set is flushed | ||
*/ | ||
wr32(IGC_RFCTL, rfctl & ~IGC_RFCTL_LEF); | ||
|
||
rlpml = rd32(IGC_RLPML); | ||
wr32(IGC_RLPML, 0); | ||
|
||
rctl = rd32(IGC_RCTL); | ||
temp_rctl = rctl & ~(IGC_RCTL_EN | IGC_RCTL_SBP); | ||
temp_rctl |= IGC_RCTL_LPE; | ||
|
||
wr32(IGC_RCTL, temp_rctl); | ||
wr32(IGC_RCTL, temp_rctl | IGC_RCTL_EN); | ||
wrfl(); | ||
usleep_range(2000, 3000); | ||
|
||
/* Enable Rx queues that were previously enabled and restore our | ||
* previous state | ||
*/ | ||
for (i = 0; i < 4; i++) | ||
wr32(IGC_RXDCTL(i), rxdctl[i]); | ||
wr32(IGC_RCTL, rctl); | ||
wrfl(); | ||
|
||
wr32(IGC_RLPML, rlpml); | ||
wr32(IGC_RFCTL, rfctl); | ||
|
||
/* Flush receive errors generated by workaround */ | ||
rd32(IGC_ROC); | ||
rd32(IGC_RNBC); | ||
rd32(IGC_MPC); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright (c) 2018 Intel Corporation */ | ||
|
||
#ifndef _IGC_BASE_H | ||
#define _IGC_BASE_H | ||
|
||
/* forward declaration */ | ||
void igc_rx_fifo_flush_base(struct igc_hw *hw); | ||
|
||
/* Transmit Descriptor - Advanced */ | ||
union igc_adv_tx_desc { | ||
struct { | ||
__le64 buffer_addr; /* Address of descriptor's data buf */ | ||
__le32 cmd_type_len; | ||
__le32 olinfo_status; | ||
} read; | ||
struct { | ||
__le64 rsvd; /* Reserved */ | ||
__le32 nxtseq_seed; | ||
__le32 status; | ||
} wb; | ||
}; | ||
|
||
struct igc_adv_data_desc { | ||
__le64 buffer_addr; /* Address of the descriptor's data buffer */ | ||
union { | ||
u32 data; | ||
struct { | ||
u32 datalen:16; /* Data buffer length */ | ||
u32 rsvd:4; | ||
u32 dtyp:4; /* Descriptor type */ | ||
u32 dcmd:8; /* Descriptor command */ | ||
} config; | ||
} lower; | ||
union { | ||
u32 data; | ||
struct { | ||
u32 status:4; /* Descriptor status */ | ||
u32 idx:4; | ||
u32 popts:6; /* Packet Options */ | ||
u32 paylen:18; /* Payload length */ | ||
} options; | ||
} upper; | ||
}; | ||
|
||
/* Receive Descriptor - Advanced */ | ||
union igc_adv_rx_desc { | ||
struct { | ||
__le64 pkt_addr; /* Packet buffer address */ | ||
__le64 hdr_addr; /* Header buffer address */ | ||
} read; | ||
struct { | ||
struct { | ||
union { | ||
__le32 data; | ||
struct { | ||
__le16 pkt_info; /*RSS type, Pkt type*/ | ||
/* Split Header, header buffer len */ | ||
__le16 hdr_info; | ||
} hs_rss; | ||
} lo_dword; | ||
union { | ||
__le32 rss; /* RSS Hash */ | ||
struct { | ||
__le16 ip_id; /* IP id */ | ||
__le16 csum; /* Packet Checksum */ | ||
} csum_ip; | ||
} hi_dword; | ||
} lower; | ||
struct { | ||
__le32 status_error; /* ext status/error */ | ||
__le16 length; /* Packet length */ | ||
__le16 vlan; /* VLAN tag */ | ||
} upper; | ||
} wb; /* writeback */ | ||
}; | ||
|
||
/* Additional Transmit Descriptor Control definitions */ | ||
#define IGC_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */ | ||
|
||
/* Additional Receive Descriptor Control definitions */ | ||
#define IGC_RXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Rx Queue */ | ||
|
||
/* SRRCTL bit definitions */ | ||
#define IGC_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ | ||
#define IGC_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ | ||
#define IGC_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 | ||
|
||
#endif /* _IGC_BASE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.