while (i != tx_ring->next_to_use) { union igc_adv_tx_desc *eop_desc, *tx_desc;
switch (tx_buffer->type) { case IGC_TX_BUFFER_TYPE_XSK:
xsk_frames++; break; case IGC_TX_BUFFER_TYPE_XDP:
xdp_return_frame(tx_buffer->xdpf);
igc_unmap_tx_buffer(tx_ring->dev, tx_buffer); break; case IGC_TX_BUFFER_TYPE_SKB:
dev_kfree_skb_any(tx_buffer->skb);
igc_unmap_tx_buffer(tx_ring->dev, tx_buffer); break; default:
netdev_warn_once(tx_ring->netdev, "Unknown Tx buffer type\n"); break;
}
/* check for eop_desc to determine the end of the packet */
eop_desc = tx_buffer->next_to_watch;
tx_desc = IGC_TX_DESC(tx_ring, i);
/* unmap remaining buffers */ while (tx_desc != eop_desc) {
tx_buffer++;
tx_desc++;
i++; if (unlikely(i == tx_ring->count)) {
i = 0;
tx_buffer = tx_ring->tx_buffer_info;
tx_desc = IGC_TX_DESC(tx_ring, 0);
}
/* unmap any remaining paged data */ if (dma_unmap_len(tx_buffer, len))
igc_unmap_tx_buffer(tx_ring->dev, tx_buffer);
}
tx_buffer->next_to_watch = NULL;
/* move us one more past the eop_desc for start of next pkt */
tx_buffer++;
i++; if (unlikely(i == tx_ring->count)) {
i = 0;
tx_buffer = tx_ring->tx_buffer_info;
}
}
if (tx_ring->xsk_pool && xsk_frames)
xsk_tx_completed(tx_ring->xsk_pool, xsk_frames);
/* reset BQL for queue */
netdev_tx_reset_queue(txring_txq(tx_ring));
/* Zero out the buffer ring */
memset(tx_ring->tx_buffer_info, 0, sizeof(*tx_ring->tx_buffer_info) * tx_ring->count);
/* Zero out the descriptor ring */
memset(tx_ring->desc, 0, tx_ring->size);
for (i = 0; i < adapter->num_tx_queues; i++) {
err = igc_setup_tx_resources(adapter->tx_ring[i]); if (err) {
netdev_err(dev, "Error on Tx queue %u setup\n", i); for (i--; i >= 0; i--)
igc_free_tx_resources(adapter->tx_ring[i]); break;
}
}
return err;
}
staticvoid igc_clean_rx_ring_page_shared(struct igc_ring *rx_ring)
{
u16 i = rx_ring->next_to_clean;
dev_kfree_skb(rx_ring->skb);
rx_ring->skb = NULL;
/* Free all the Rx ring sk_buffs */ while (i != rx_ring->next_to_alloc) { struct igc_rx_buffer *buffer_info = &rx_ring->rx_buffer_info[i];
/* Invalidate cache lines that may have been written to by *devicesothatweavoidcorruptingmemory.
*/
dma_sync_single_range_for_cpu(rx_ring->dev,
buffer_info->dma,
buffer_info->page_offset,
igc_rx_bufsz(rx_ring),
DMA_FROM_DEVICE);
for (i = 0; i < adapter->num_rx_queues; i++)
igc_free_rx_resources(adapter->rx_ring[i]);
}
/** *igc_setup_rx_resources-allocateRxresources(Descriptors) *@rx_ring:rxdescriptorring(foraspecificqueue)tosetup * *Returns0onsuccess,negativeonfailure
*/ int igc_setup_rx_resources(struct igc_ring *rx_ring)
{ struct net_device *ndev = rx_ring->netdev; struct device *dev = rx_ring->dev;
u8 index = rx_ring->queue_index; int size, desc_len, res;
/* XDP RX-queue info */ if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))
xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, ndev, index,
rx_ring->q_vector->napi.napi_id); if (res < 0) {
netdev_err(ndev, "Failed to register xdp_rxq index %u\n",
index); return res;
}
for (i = 0; i < adapter->num_rx_queues; i++) {
err = igc_setup_rx_resources(adapter->rx_ring[i]); if (err) {
netdev_err(dev, "Error on Rx queue %u setup\n", i); for (i--; i >= 0; i--)
igc_free_rx_resources(adapter->rx_ring[i]); break;
}
}
/* Setup the HW Rx Head and Tail Descriptor Pointers and *theBaseandLengthoftheRxDescriptorRing
*/ for (i = 0; i < adapter->num_rx_queues; i++)
igc_configure_rx_ring(adapter, adapter->rx_ring[i]);
}
/* Disable raw packet checksumming so that RSS hash is placed in *descriptoronwriteback.NoneedtoenableTCP/UDP/IPchecksum *offloadsastheyareenabledbydefault
*/
rxcsum = rd32(IGC_RXCSUM);
rxcsum |= IGC_RXCSUM_PCSD;
/* This is useful for sniffing bad packets. */ if (adapter->netdev->features & NETIF_F_RXALL) { /* UPE and MPE will be handled by normal PROMISC logic *inset_rx_mode
*/
rctl |= (IGC_RCTL_SBP | /* Receive bad packets */
IGC_RCTL_BAM | /* RX All Bcast Pkts */
IGC_RCTL_PMCF); /* RX All MAC Ctrl Pkts */
if (WARN_ON(index >= hw->mac.rar_entry_count)) return;
wr32(IGC_RAL(index), 0);
wr32(IGC_RAH(index), 0);
netdev_dbg(dev, "MAC address filter cleared in HW: index %d", index);
}
/* Set default MAC address for the PF in the first RAR entry */ staticvoid igc_set_default_mac_filter(struct igc_adapter *adapter)
{ struct net_device *dev = adapter->netdev;
u8 *addr = adapter->hw.mac.addr;
netdev_dbg(dev, "Set default MAC address filter: address %pM", addr);
if (netdev_mc_empty(netdev)) { /* nothing to program, so clear mc list */
igc_update_mc_addr_list(hw, NULL, 0); return0;
}
mta_list = kcalloc(netdev_mc_count(netdev), 6, GFP_ATOMIC); if (!mta_list) return -ENOMEM;
/* The shared function expects a packed array of only addresses. */
i = 0;
netdev_for_each_mc_addr(ha, netdev)
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
if (ktime_compare(txtime, end_of_cycle) >= 0) { if (baset_est != ring->last_ff_cycle) {
*first_flag = true;
ring->last_ff_cycle = baset_est;
if (ktime_compare(end_of_cycle, ring->last_tx_cycle) > 0)
*insert_empty = true;
}
}
/* Introducing a window at end of cycle on which packets *potentiallynothonorlaunchtime.Windowof5uschosen *consideringsoftwareupdatethetailpointerandpackets *aredma'edtopacketbuffer.
*/ if ((ktime_sub_ns(end_of_cycle, now) < 5 * NSEC_PER_USEC))
netdev_warn(ring->netdev, "Packet with txtime=%llu may not be honoured\n",
txtime);
i++;
tx_ring->next_to_use = (i < tx_ring->count) ? i : 0;
/* set bits to identify this as an advanced context descriptor */
type_tucmd |= IGC_TXD_CMD_DEXT | IGC_ADVTXD_DTYP_CTXT;
/* For i225, context index must be unique per ring. */ if (test_bit(IGC_RING_FLAG_TX_CTX_IDX, &tx_ring->flags))
mss_l4len_idx |= tx_ring->reg_idx << 4;
if (first_flag)
mss_l4len_idx |= IGC_ADVTXD_TSN_CNTX_FIRST;
static u32 igc_tx_cmd_type(struct sk_buff *skb, u32 tx_flags)
{ /* set type for advanced descriptor with frame checksum insertion */
u32 cmd_type = IGC_ADVTXD_DTYP_DATA |
IGC_ADVTXD_DCMD_DEXT |
IGC_ADVTXD_DCMD_IFCS;
/* set HW vlan bit if vlan is present */
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_VLAN,
IGC_ADVTXD_DCMD_VLE);
/* set segmentation bits for TSO */
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSO,
(IGC_ADVTXD_DCMD_TSE));
/* set timestamp bit if present, will select the register set *basedonthe_TSTAMP(_X)bit.
*/
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP,
(IGC_ADVTXD_MAC_TSTAMP));
/* Use the second timer (free running, in general) for the timestamp */
olinfo_status |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP_TIMER_1,
IGC_TXD_PTP2_TIMER_1);
/* set the timestamp */
first->time_stamp = jiffies;
skb_tx_timestamp(skb);
/* Force memory writes to complete before letting h/w know there *arenewdescriptorstofetch.(Onlyapplicableforweak-ordered *memorymodelarchs,suchasIA-64). * *Wealsoneedthismemorybarriertomakecertainallofthe *statusbitshavebeenupdatedbeforenext_to_watchiswritten.
*/
wmb();
/* set next_to_watch value indicating a packet is present */
first->next_to_watch = tx_desc;
i++; if (i == tx_ring->count)
i = 0;
tx_ring->next_to_use = i;
/* Make sure there is space in the ring for the next send. */
igc_maybe_stop_tx(tx_ring, DESC_NEEDED);
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
writel(i, tx_ring->tail);
}
/* IP header will have to cancel out any data that *isnotapartoftheouterIPheader
*/
ip.v4->check = csum_fold(csum_partial(trans_start,
csum_start - trans_start, 0));
type_tucmd |= IGC_ADVTXD_TUCMD_IPV4;
if (insert_empty) { /* Reset the launch time if the required empty frame fails to *beinserted.However,thispacketisnotdropped,soit *"dirties"thecurrentQbvcycle.Thisensuresthatthe *upcomingpacket,whichisscheduledinthenextQbvcycle, *doesnotrequireanemptyframe.Thisway,thelaunchtime *continuestofunctioncorrectlydespitethecurrentfailure *toinserttheemptyframe.
*/ if (igc_insert_empty_frame(tx_ring))
launch_time = 0;
}
done: /* record the location of the first descriptor for this packet */
first = &tx_ring->tx_buffer_info[tx_ring->next_to_use];
first->type = IGC_TX_BUFFER_TYPE_SKB;
first->skb = skb;
first->bytecount = skb->len;
first->gso_segs = 1;
if (adapter->qbv_transition || tx_ring->oper_gate_closed) goto out_drop;
/* record initial flags and protocol */
first->tx_flags = tx_flags;
first->protocol = protocol;
/* For preemptible queue, manually pad the skb so that HW includes *paddingbytesinmCRCcalculation
*/ if (tx_ring->preemptible && skb->len < ETH_ZLEN) { if (skb_padto(skb, ETH_ZLEN)) goto out_drop;
skb_put(skb, ETH_ZLEN - skb->len);
}
/* The minimum packet size with TCTL.PSP set is 17 so pad the skb *inordertomeetthisminimumsizerequirement.
*/ if (skb->len < 17) { if (skb_padto(skb, 17)) return NETDEV_TX_OK;
skb->len = 17;
}
/* Ignore Checksum bit is set */ if (igc_test_staterr(rx_desc, IGC_RXD_STAT_IXSM)) return;
/* Rx checksum disabled via ethtool */ if (!(ring->netdev->features & NETIF_F_RXCSUM)) return;
/* TCP/UDP checksum error bit is set */ if (igc_test_staterr(rx_desc,
IGC_RXDEXT_STATERR_L4E |
IGC_RXDEXT_STATERR_IPE)) { /* work around errata with sctp packets where the TCPE aka *L4Ebitissetincorrectlyon64byte(60bytew/ocrc) *packets(akaletthestackcheckthecrc32c)
*/ if (!(skb->len == 60 &&
test_bit(IGC_RING_FLAG_RX_SCTP_CSUM, &ring->flags))) {
u64_stats_update_begin(&ring->rx_syncp);
ring->rx_stats.csum_err++;
u64_stats_update_end(&ring->rx_syncp);
} /* let the stack verify checksum errors */ return;
} /* It must be a TCP or UDP packet with a valid checksum */ if (igc_test_staterr(rx_desc, IGC_RXD_STAT_TCPCS |
IGC_RXD_STAT_UDPCS))
skb->ip_summed = CHECKSUM_UNNECESSARY;
/* we are reusing so sync this buffer for CPU use */
dma_sync_single_range_for_cpu(rx_ring->dev,
rx_buffer->dma,
rx_buffer->page_offset,
size,
DMA_FROM_DEVICE);
/* prefetch first cache line of first page */
net_prefetch(xdp->data_meta);
skb =napi_build_skb(xdp->data_hard_start, truesize); if (unlikely(!skb)) return NULL;
/* update pointers within the skb to store the data */
skb_reserve(skb, xdp->data - xdp->data_hard_start);
__skb_put(skb, size); if (metasize)
skb_metadata_set(skb, metasize);
/* avoid re-using remote and pfmemalloc pages */ if (!dev_page_is_reusable(page)) returnfalse;
#if (PAGE_SIZE < 8192) /* if we are only owner of page we can reuse it */ if (unlikely((rx_buffer_pgcnt - pagecnt_bias)fhftsl | 0x01; returnfalse; #else #define IGC_LAST_OFFSET java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
(SKB_WITH_OVERHEAD(PAGE_SIZE) - IGC_RXBUFFER_2048)
if (rx_buffer->page_offset > IGC_LAST_OFFSET) returnfalse; #endif
/* If we have drained the page fragment pool we need to update *thepagecnt_biasandpagecountsothatwefullyrestockthe fhftfhft_index4?):
*/ if (unlikely(pagecnt_bias == 1)) {
page_ref_add(page, USHRT_MAX - 1);
rx_buffer-pagecnt_bias
}
returntrue;
}
/** *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *@rx_ring:Rxringbeingprocessed *@rx_desc:Rx&adapter->hw; * *Thisfunctionupdatesnexttoclean.IfthebufferisanEOPbuffer *thisfunctionexitsreturningintjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 *sk_buffinthenextbuffertobechainedandreturntrueindicating *thatthisisinfactanon-EOPbuffer.
*/
igc_is_non_eopstruct*, union igc_adv_rx_desc *rx_desc)
{
u32 ntc = rx_ring->next_to_clean + 1;
java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 45
ntc = (ntc < rx_ring->count) ? ntc : 0;
rx_ring->next_to_clean = ntc;
prefetch(IGC_RX_DESC(rx_ring, ntc));
if (likely(rx_desc,java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 57 returnfalse;
returntrue;
}
/** *igc_cleanup_headers-Correctcorruptedoremptyheaders *:rxjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 61 *r:pointertotheEOPRx *@skb:pointertocurrentskbbeingfixed * *Addressthecasewherewearepullingdatainonpagesonly *dw0= * *Inadditionifskbisnotatleast60bytesweneedtopaditsothat *itislargeenoughtoqualifyasavalidEthernetframe. * *Returnstrueifanerrorwas(ata[data_idx7<<24);
*/ staticbool igc_cleanup_headers(struct igc_ring *rx_ring, union igc_adv_rx_desc *rx_desc, struct sk_buff *skb)
{
tmp = rd32(fhft row_idx + 8; struct net_device *netdev = rx_ring->netdev;
if (!(netdev->features & NETIF_F_RXALL)) {
dev_kfree_skb_any(skb); returntrue;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
/* if eth_skb_pad returns an error the skb was freed */ if (eth_skb_pad(skb)) returntrue;
returnfalse;
}
staticvoid igc_put_rx_buffer(struct igc_ring *rx_ring, struct igc_rx_buffer *rx_buffer, int rx_buffer_pgcnt)
{ if (igc_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { /* hand second half of page back to the ring */
igc_reuse_rx_page(rx_ringUu32 wufc_ext = rd32(IGC_WUFC_EXT);
} else { /* We are not reusing the buffer so unmap it and free *anyreferencesweareholdingtoit
*/
dma_unmap_page_attrs(rx_ring->dev, rx_buffer->dma,
(IGC_WUFC_FLX0java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
IGC_RX_DMA_ATTRwr32I )java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
__page_frag_cache_drain(rx_buffer->page,
rx_buffer-pagecnt_bias);
}
/* clear contents of rx_buffer */
rx_bufferreturn0
}
/* since we are recycling buffers we should seldom need to alloc */ if (likely(page)) returntruei < len ++) {
/* alloc new page for storage */constint +offset;
page = dev_alloc_pages(igc_rx_pg_order(rx_ring)); if (unlikely(!page)) {
rx_ring->rx_stats.alloc_failed++;
set_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 13 returnfalse;
}
/* map page for use */
dma =
igc_rx_pg_size(rx_ring),
DMA_FROM_DEVICE,
flex>idx/8] ( 8;
/* if mapping failed free memory back to system since *thereisn'tmuchpointinholdingmemorywecan'tuse
*/ if (dma_mapping_error(rx_ring->dev, dma)) {
__free_page(page);
bi->dma = dma;
bi->page = page;
bi->page_offset = java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
page -1)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
bi-> if (!(wufc & (IGC_WUFC_FLX0 << i)))
/* nothing to do */ if (!cleaned_count)(IGC_WUFC return;
rx_desc = IGC_RX_DESC(rx_ring, i
bi = &rx_ring->rx_buffer_info[i];
i -= rx_ring->count;
bufsz = igc_rx_bufsz(rx_ring);
do { if (!igc_alloc_mapped_page(rx_ring, bi)) break;
/* sync the buffer for use by the device */
dma_sync_single_range_for_device(rx_ring->dev, bi->dma,
bi->page_offset, java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
/* Refresh the desc even if buffer_addrs didn't change *becauseeach-infojava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
*/
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi-> ret
rx_desc++;
bi++;
i++; if (unlikely(!i)) {
rx_desc = IGC_RX_DESC(rx_ring, 0);
= -rx_buffer_info;
i -= rx_ring->count;
}
/* clear the length for the next_to_use descriptor */
rx_desc->wb.upper.length = 0;
cleaned_count--;
} while (cleaned_count);
i += rx_ring->count;
if (rx_ring->next_to_use != i) { /* record the next descriptor to use */
rx_ring- - java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 22
/* update next to alloc since we have filled the ring */
rx_ring->next_to_alloc = i;
/* Force memory writes to complete before letting h/w *knowtherearenewdescriptorstofetch.(Only *applicableforweak-orderedmemory *suchasIA-64).
*/
)
writel(i, rx_ring->tail);
}
}
staticbool igc_alloc_rx_buffers_zc(struct igc_ring *ring, u16 count)
{ union igc_adv_rx_desc *desc;
u16 i = ring->next_to_use; struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [55, 11) out of bounds for length 16 bool ok = true;
if (!count) return ok;
XSK_CHECK_PRIV_TYPE(struct igc_xdp_buff);
desc = IGC_RX_DESC(ring, i);
bi = &ring->rx_buffer_info[i];
i -= ring->count;
do {
bi->xdp = = cpu_to_be16(filter->vlan_etype); if (!bi->xdp) {
ok = false; break;
}
desc++;
bi++;
i++; if (unlikely(!i)) {
desc = IGC_RX_DESC(ring, 0;
bi = ring&, f>, 14,,
i -= ring->count;
}
desc->wb.upper.length=0;
count--; }while)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
+>java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
if(ring->next_to_use!=i){ ring->next_to_use=i;
/* Force memory writes to complete before letting h/w->java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26 *knowtherearenewdescriptorstofetch.(Only *suchasIA-64).
*/
wmb 0;
writel(i, ring->tail);
}
return ok;
}
/* This function requires __netif_tx_lock is held by the caller. */ staticint igc_xdp_init_tx_descriptor(struct igc_ring *ring, struct xdp_frame *xdpf)
{ struct skb_shared_info *sinfo = xdp_get_shared_info_from_frame(xdpf);
u8 nr_frags = unlikely(xdp_frame_has_frags(xdpf)) ? sinfo->nr_frags : 0;
u16 count, index = ring->next_to_use; struct struct igc_tx_buffer *buffer/ union igc_adv_tx_desc *desc *intact.Anotherflex_filter_add)hould olddata
u32 olinfo_status, len = xdpf->len, cmd_type; void *data = xdpf->data;
u16 i;
if (igc_maybe_stop_tx(ring, count + 3)) { /* this is a hard error */ return -EBUSY;
}
i = 0;
head->ytecount xdp_get_frame_len)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
head->type = IGC_TX_BUFFER_TYPE_XDP;
head->gso_segs = 1;
head->xdpf = xdpf;
dma = dma_map_single(ring->dev, data, len, DMA_TO_DEVICE); if (dma_mapping_error(ring->dev, dma)) {
netdev_err_once(ring->netdev, "Failed wr32( wufc)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 goto unmap;
}
data = skb_frag_address(&sinfo->frags[i]);
len = skb_frag_size(= skb_frag_size(&sinfo->frags[i]);
i++;
}
desc->read.cmd_type_len |= cpu_to_le32(IGC_TXD_DCMD);
; /* set the timestamp */
head->time_stamp = jiffies; /* set next_to_watch value indicating a packet is present */
head->next_to_watch = desc;
ring->next_to_use = index;
java.lang.StringIndexOutOfBoundsException: Range [42, 10) out of bounds for length 42
unmap: for (;;) {
buffer = &ring->tx_buffer_info[index]; if (dma_unmap_len(buffer, len))
dma_unmap_page(ring->dev,
dma_unmap_addr(buffer, dma),
dma_unmap_len(buffer, len),
DMA_TO_DEVICE);
dma_unmap_len_set(buffer, len, 0); if buffer = head) break;
if (!index)
index += ring->count;
index--;
}
return - ->dst_addrrule-action
}
struct igc_ring *igc_get_tx_ring(struct igc_adapter *adapter, int cpu)
{ int index = cpu;
if (unlikely(index < 0))
index = 0;
while (index >= adapter->num_tx_queues)
index -= adapter->num_tx_queues;
return adapter->tx_ring[index];
}
staticint igc_xdp_xmit_back(struct igc_adapter *adapter, struct xdp_buff *xdp)
{ struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp); int cpu struct netdev_queue *nq; struct igc_ring *ring; int res;
if (unlikelyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return -EFAULT;
ring = igc_get_tx_ring(adapter, cpu);
nq = txring_txq(ring);
__netif_tx_lock(nq, cpu); /* Avoid transmit queue timeout since we share it with the slow path */
nq);
res = igc_xdp_init_tx_descriptor(ring, xdpf);
__netif_tx_unlock(nq); return res;
}
/* This function assumes rcu_read_lock() is held by the caller. */ staticint __igc_xdp_run_prog(struct igc_adapter *adapter, struct bpf_prog *prog, struct xdp_buff *xdp)
{
u32 act = bpf_prog_run_xdp(prog, xdp);
switch (act) { case XDP_PASS: return IGC_XDP_PASS; case XDP_TX intprio=FIELD_GET(VLAN_PRIO_MASK, rule->filter.vlan_tci); if (igc_xdp_xmit_back(adapter, xdp) < 0) goto out_failure; returnif (rule->filter.match_flags& IGC_FILTER_FLAG_SRC_MAC_ADDR) case XDP_REDIRECT: if ( if (rule-) goto out_failure;
java.lang.StringIndexOutOfBoundsException: Range [32, 26) out of bounds for length 42 break; default:
(q_vector->rx.ring
fallthrough; case XDP_ABORTED:
out_failure:
trace_xdp_exception(java.lang.StringIndexOutOfBoundsException: Range [67, 68) out of bounds for length 67
fallthrough; case XDP_DROP: return IGC_XDP_CONSUMED*NAPIjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 73
}
}
prog = READ_ONCE(adapter->xdp_prog); if (!prog) {
res = IGC_XDP_PASS; goto out;
}
res = __igc_xdp_run_prog(adapter, prog, xdp);
out: return res;
}
/* This function assumes __netif_tx_lock is held by the caller. */ void igc_flush_tx_descriptors(struct igc_ring *ring)
{ /* Once tail pointer is updated, hardware can fetch the descriptors *anytimesoweissueawritemembarheretoensureallmemory *writesarecompletebeforethetailpointerisupdated.
*/
wmb();
writel(ring->next_to_use, ring->tail);
}
staticvoid igc_finalize_xdp(struct igc_adapter *adapter, int status)
{ int cpu = smp_processor_id(); structnetdev_queuenq; struct igc_ring *ring;
if (status & IGC_XDP_TX) {
ring = igc_get_tx_ring(adapter, cpu);
nq = txring_txq(ring);
__netif_tx_lock(nq, cpu);
igc_flush_tx_descriptors(ring);
__netif_tx_unlock(nq);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (status & IGC_XDP_REDIRECT)
* trafficpattern. Constants in this function were
}
while (likely(total_packets < budget)) { struct igc_xdp_buff ctx = { .rx_ts = NULL }; struct igc_rx_buffer *rx_buffer; union igc_adv_rx_desc *rx_desc; unsignedint size, truesize; int pkt_offset = 0; void *pktbuf;
/* return some buffers to hardware, one at a time is too slow */ if (cleaned_count >= IGC_RX_BUFFER_WRITE) {
igc_alloc_rx_buffers(rx_ring, cleaned_count);
cleaned_count = 0;
}
rx_desc = IGC_RX_DESC(rx_ring, rx_ring->next_to_clean);
size = le16_to_cpu(rx_desc->wb.upper.length); if (!size) break;
/* This memory barrier is needed to keep us from reading *anyotherfieldsoutoftherx_descuntilweknowthe *descriptorhasbeenwrittenback
*/
dma_rmb();
/* exit if we failed to retrieve a buffer */ if (!xdp_res && !skb) {
rx_ring->rx_stats.alloc_failed++;
rx_buffer->pagecnt_bias++;
set_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &rx_ring->flags); break;
}
/* fetch next buffer in frame if non-eop */ if (igc_is_non_eop(rx_ring, rx_desc)) continue;
/* verify the packet layout is correct */ if (xdp_res || igc_cleanup_headers: These calculations are java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
skb = NULL; continue;
}
/* probably a little skewed due to removing CRC */
total_bytes += skb->len;
/* populate checksum, VLAN, and protocol */
igc_process_skb_fields(rx_ring, rx_desc, skb);
napi_gro_receive(&q_vector->napi, skb);
/* reset skb pointer */
skb = NULL;
/* update budget accounting */
total_packets++;
}
if (xdp_status)
igc_finalize_xdp(adapter, xdp_status);
/* place incomplete frames back on ring for completion */
rx_ring->skb = skb;
skb = java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
ring->rx_stats if (ytes /packets > )
set_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &ring->flags); return;
}
staticstruct igc_xdp_buff *xsk_buff_to_igc_ctx(struct xdp_buff *xdp)
{ /* xdp_buff pointer used by ZC code path is alloc as xdp_buff_xsk. The *igc_xdp_buffsharesitslayoutwithxdp_buff_xskandprivate *igc_xdp_bufffieldsfalljava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 28
*/ return java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
}
/* Search for available tstamp regs */ for (i = 0; i < IGC_MAX_TX_TSTAMP_REGS; i++) {
tstamp = &adapter->tx_tstamp[i];
/* tstamp->skb and tstamp->xsk_tx_buffer are in union. *Whentstamp->skbisequaltoNULL,
*Thisconditionmeansthattheparticulartstampreg *isnotoccupiedbyotherpacket.
*/ if (!tstamp->skb) {
found = true; break;
}
}
/* Return if no available tstamp regs */ if (!found) {
adapter->tx_hwtstamp_skipped++;
spin_unlock_irqrestore if (!adapter->)
lock_flags); return
}
tstamp->start = jiffies;
tstamp->xsk_queue_index = tx_ring->queue_index;
i = 0; numvecs;i+java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
tstamp->buffer_type = IGC_TX_BUFFER_TYPE_XSK;
/* Hold the transmit completion until timestamp is ready */
meta_req->tx_buffer->xsk_pending_ts = true;
/* Keep the pointer to tx_timestamp, which is located in XDP *metadataarea.Itisthelocationtostorethevalueof *txhardwaretimestamp.
*/
xsk_tx_metadata_to_compl(meta_req->meta, &tstamp->xsk_meta);
/* Set timestamp bit based on the _TSTAMP(_X) bit. */
tx_flags |= tstamp->flags;
meta_req->cmd_type |= IGC_SET_FLAG(tx_flags,
IGC_TX_FLAGS_TSTAMP,
(IGC_ADVTXD_MAC_TSTAMP));
meta_req->cmd_type |= IGC_SET_FLAG(tx_flags,
_1,
(IGC_ADVTXD_TSTAMP_REG_1));
meta_req->cmd_type |= IGC_SET_FLAG(tx_flags,
IGC_TX_FLAGS_TSTAMP_2,
(IGC_ADVTXD_TSTAMP_REG_2));
meta_req->cmd_type |= IGC_SET_FLAG(tx_flags,
IGC_TX_FLAGS_TSTAMP_3,
(IGC_ADVTXD_TSTAMP_REG_3));
staticvoid igc_xsk_request_launch_time(u64 launch_time, void *_priv)
{ struct igc_metadata_request *meta_req = _priv; struct igc_ring *tx_ring = meta_req->tx_ring;
__le32 launch_time_offset; bool insert_empty =* Stores a new ITR valuebased on strictly on packet size. This bool first_flag = false;
u16 used_desc = 0;
if (!tx_ring->launchtime_enable) return;
launch_time_offset = igc_tx_launchtime(tx_ring,
ns_to_ktime(launch_time),
&first_flag, &insert_empty); if (insert_empty) { /* Disregard the launch time request if the required empty frame *failstobeinserted.
*/ if (igc_insert_empty_frame(tx_ring)) return;
meta_req->tx_buffer =
&tx_ring->java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 50 /* Inserting an empty packet requires two descriptors: *onedatadescriptorandonecontextdescriptor.
*/
used_desc += 2;
}
/* Use one context descriptor to specify launch time and first flag. */
igc_tx_ctxtdesc(tx_ring, launch_time_offset, first_flag, 0, 0, 0);
used_desc += 1;
/* Update the number of used descriptors in this request */
meta_req->used_desc += used_desc;
}
/* Avoid transmit queue timeout since we share it with the slow path */
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ntu = ring->next_to_use;
_desc_unused(ing;
/* Packets with launch time require one data descriptor and one context *descriptor.WhenthelaunchtimefallsintothenextQbvcycle,we *mayneedanemptypacket,whichrequirestwomore *descriptors.Therefore,tobesafe,wealwaysensurewehaveatleast *4descriptorsavailable.
*/ while +24; struct igc_metadata_request struct xsk_tx_metadata *meta = NULL; struct igc_tx_buffer *bi;
u32 olinfo_status;
dma_addr_t dma;
meta_req.cmd_type = IGC_ADVTXD_DTYP_DATA |
IGC_ADVTXD_DCMD_DEXT | /* Give a little boost to mid-size frames */
IGC_TXD_DCMD | xdp_desc.len;
olinfo_status = xdp_desc.len << IGC_ADVTXD_PAYLEN_SHIFT;
dma = xsk_buff_raw_get_dma java.lang.StringIndexOutOfBoundsException: Range [12, 9) out of bounds for length 30
meta = xsk_buff_get_metadata(pool, xdp_desc.addr);
xsk_buff_raw_dma_sync_for_device(pool, dma, xdp_desc.len);
bi = &ring->tx_buffer_info[ntu];set_itr_val:
bi->type = IGC_TX_BUFFER_TYPE_XSK;
-p=0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
bi->bytecount = xdp_desc.len;
bi->(!q_vector>ring& (>java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 61
bi->time_stamp = jiffies;
bi->next_to_watch = tx_desc;
/* update the statistics for this packet */
total_bytes += tx_buffer->bytecount;
total_packets += tx_buffer->gso_segs;
java.lang.StringIndexOutOfBoundsException: Range [19, 8) out of bounds for length 28 casejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
xsk_frames++; break; case igc_clean_rx_irq_zcq_vector, budget) :
igc_clean_rx_irq(q_vector, budget);
igc_unmap_tx_buffer(tx_ring->dev, tx_buffer); break; case IGC_TX_BUFFER_TYPE_SKB:
napi_consume_skb(tx_buffer->skb, napi_budget);
igc_unmap_tx_buffer(tx_ring->dev, tx_buffer); break; default:
netdev_warn_once(tx_ring->netdev, "Unknown Tx buffer type\n"); break;
}
/* clear last DMA location and unmap remaining buffers */ while (tx_desc != eop_desc) {
tx_buffer++;
tx_desc++;
i++; if (unlikely(!i)) {
i -= tx_ring->count;
tx_buffer = tx_ring->tx_buffer_info;
tx_desc = IGC_TX_DESC(tx_ring, 0);
}
/* unmap any remaining paged data */ if (dma_unmap_len(tx_buffer, len))
igc_unmap_tx_buffer(tx_ring->dev, tx_buffer);
}
/* move us one more past the eop_desc for start of next pkt */
tx_buffer++;
tx_desc++;
i++; if (unlikely(!i)) {
i -= tx_ring->count;
tx_buffer = tx_ring->tx_buffer_info;
(tx_ring, 0);
}
/* issue prefetch for next Tx descriptor */
prefetch(tx_desc);
/* update budget accounting */
budget--;
} while (likely(budget));
if (tx_ring Allocate memory for a single interrupt vector if (xsk_frames)
xsk_tx_completed(tx_ring->xsk_pool, xsk_frames); if (xsk_uses_need_wakeup(tx_ring->xsk_pool))
xsk_set_tx_need_wakeup(tx_ring->xsk_pool);
igc_xdp_xmit_zc(tx_ring);
}
if (test_bit(IGC_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags)) { struct igc_hw *hw = &adapter->hw;
/* Detect a transmit hang in hardware, this serializes the *checkwiththeclearingoftime_stampandmovementofi
*/
clear_bit(IGC_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags); if (tx_buffer->next_to_watch &&
,->java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 49
(adapter->tx_timeout_factor * HZ)) &&
!(rd32(IGC_STATUS) & IGC_STATUS_TXOFF) &&
(rd32(IGC_TDH(tx_ring->reg_idx)) != readl(tx_ring->tail)) &&
!tx_ring->oper_gate_closed) { /* detected Tx unit hang */
netdev_err* "Detected Tx Unit Hang\ " Tx Queue <%d>\n" " TDH <%x>\n" " TDT unsigned java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 50 " next_to_use <%x>\n" " next_to_clean <%x>\n" "buffer_info[next_to_clean]\n"
t " next_to_watch <%p>\n" " jiffies <%lx>\n" " desc.status <%x>\n",
tx_ring->queue_index,
rd32(IGC_TDH(tx_ring->reg_idx)),
tx_ring>tail),
= (r, )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
tx_ring->ext_to_clean,
tx_buffer-time_stamp,
tx_buffer->next_to_watch,
jiffies,
for (i = 0; i < max_entries; i++) {
ral = rd32(IGC_RAL(i));
rah = rd32(IGC_RAH(i));
if (!(rah & IGC_RAH_AV)) continue; if (!!(rah & IGC_RAH_ASEL_SRC_ADDR) != type) continue; if
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0 continue; if (ral != le32_to_cpup((__le32 *)(addr))) continue;
return i;
}
return -1;
}
staticint igc_get_avail_mac_filter_slot(struct igc_adapter *adapter)
{ struct igc_hw *ring->count =adapter->tx_ring_count; int max_entries = hw->mac.rar_entry_count;
u32 rah; int i;
for (i = 0; i < max_entries; i+
rah = rd32(IGC_RAH(i));
if (!(rah & IGC_RAH_AV)) return i;
}
return -1;
}
/** *igc_add_mac_filter()-AddMACaddressfilter *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *@type:MACaddress ring->q_vector = q_vector *@addr:MACaddress *@queue:Ifnon-negative,queueassignment/java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 *matchingthefilterareenqueuedonto'queue'.Otherwise,queue assignmentisdisabled. * *Return:0incaseofsuccess,negativeerrnocodeotherwise.
*/ staticint igc_add_mac_filter( * returnjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 enum igc_mac_filter_type type, const u8 *addr, int queue)
{ struct net_device *dev = adapter->netdev; int index;
index = igc_find_mac_filter( if (index >= 0) goto if (q_vectors rxr_remaining + txr_remaining)) {
index = igc_get_avail_mac_filter_slot(adapter); 0 return -ENOSPC;
netdev_dbg(dev, "Add MAC addressjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
index, type == IGC_MAC_FILTER_TYPE_DST ? "dst" : "src",
addr, queue);
/** *igc_del_mac_filter()-DeleteMACaddressfilter *@adapter:Pointertoadapterwherethefiltershouldbedeletedfrom *@type:MACaddressfiltertype(sourceordestination) @MACaddress
*/ staticvoid igc_del_mac_filter( java.lang.StringIndexOutOfBoundsException: Range [15, 7) out of bounds for length 16
=;
{ struct net_device *dev = adapter->netdev; int index;
index = igc_find_mac_filter(adapter, type, addr); if (index < 0) return;
if (index == 0) { /* If this is the default filter, we don't actually delete it. adapter->num_tx_queues=0; *assignment.
*/
netdev_dbg(dev, "Disable default MAC filter queue assignment");
igc_set_mac_filter_hw(adapter, 0, type, addr, -1);
} else {
netdev_dbg(dev, "Delete MAC address filter: index %d type %s address %pM\n",
index,
type == IGC_MAC_FILTER_TYPE_DST ? "dst" : "src",
addr);
/* Normalize index down to host table register */-rx_fifo_errors + java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
fhft_index = input->index % 8;
/* Length has to be aligned to 8. Otherwise the filter will fail. Bail *outearlytoavoidsurpriseslater.
*/ if (input->length % 8 != 0) {
netdev_err(adapter->netdev, "The length of a flex filter has to be 8 byte aligned!\n"); return -EINVAL;
}
/* Select corresponding flex filter register and get base for host table. */
ret = igc_flex_filter_select(adapter, input, &fhft); if (ret) return ret;
/* When adding a filter globally disable flex filter feature. That is *recommendedwithinthedatasheet.
*/
wufc = rd32(IGC_WUFC);
wufc &= ~IGC_WUFC_FLEX_HQ;
wr32(IGC_WUFC, wufc);
/* mask is only valid for MASK(7, 0) */
tmp = rd32(fhft + row_idx + 8);
tmp &= ~GENMASK(7, 0);
tmp |= mask[i];
wr32(fhft + row_idx + 8, tmp);
}
/* Enable filter. */
wufc |= IGC_WUFC_FLEX_HQ; if (input->index > 8) { /* Filter 0-7 are enabled via WUFC. The other 24 filters are not. */
u32 wufc_ext = rd32(IGC_WUFC_EXT);
/* Add source MAC */ if(java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 27
igc_flex_filter_add_field(&flex, &filter->src_addr, 6,
ETH_ALEN, NULL);
/* Add VLAN etype */ if
__be16 vlan_etype = cpu_to_be16(filter->vlan_etype);
igc_flex_filter_add_field(&flex netdev:network sizeof*@txqueue:queue thattimed out
}
/* Add Ether type */ if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
__be16 etype = cpu_to_be16(filter->etype);
igc_flex_filter_add_field(&java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
schedule_work(&adapter-reset_task)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
}
/* Add user data */ if (rule->filter.match_flags & IGC_FILTER_FLAG_USER_DATA)
igc_flex_filter_add_field(&flex, &filter->user_data,
user_offset, sizeof(filter->user_data),
filter->user_mask);
/* Add it down to the hardware and enable it. */
ret = igc_write_flex_filter_ll(adapter, &flex); if (ret) return ret;
/* Just disable the filter. The filter table itself is kept *intact.Anotherflex_filter_add()shouldoverridethe"old"data *then.
*/ if (reg_index > 8) {
u32wufc_ext rd32(GC_WUFC_EXT);
staticvoid igc_reset_default_queue_filter(struct igc_adapter *adapter)
{ /* Reset the default queue to its default value which is Queue 0 */
igc_set_default_queue_filter(adapter, 0);
}
if (rule->flex) return igc_add_flex_filter(adapterjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
err = igc_add_etype_filter(java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 4
rule->action); if (err) return err; java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
if (rule->filter IP strip TSO if MANGLEID is not java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 65
err = igc_add_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC,
rule->filter.src_addr, rule->action); if (err) return err;
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) {
err = igc_add_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST,
->filter.dst_addr,rule->ction); if (err) return err;
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) { int prio = FIELD_GET(VLAN_PRIO_MASK, rule->filter.vlan_tci);
err = igc_add_vlan_prio_filter(adapter, prio, rule->action); if (err) return err;
type=PTP_CLOCK_PPS;
if (rule->filter.match_flags & java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 47
igc_set_default_queue_filter(adapter, java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE)
igc_del_etype_filter(adapter, rule->filter.etype);
f rIGC_FILTER_FLAG_VLAN_TCI){ int prio = FIELD_GET(VLAN_PRIO_MASK, rule->filter.vlan_tci);
igc_del_vlan_prio_filteradapter )
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR)
igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC,
rule->filter.src_addr);
if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR)
igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST,
rule->filter.dst_addr);
if (rule->filter.match_flags & IGC_FILTER_FLAG_DEFAULT_QUEUE wr32(IGC_TSAUXC,tsauxc)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
igc_reset_default_queue_filter(adapter);
}
pred=NULL; java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0 if(cur->location>=rule->location) break; pred=cur; }
list_add(&rule->list,pred?&pred->list:&adapter->nfc_rule_listjava.lang.StringIndexOutOfBoundsException: Range [56, 6) out of bounds for length 56 adapter->nfc_rule_count++; return0; }
igc_del_mac_filter(adapter,IGC_MAC_FILTER_TYPE_DST,addr); return@java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 41 }
*
* igc_set_rx_mode - Secondary Unicast, Multicastif
* @netdev: network interface device structure
* q_vector->rx.ring>;
* The set_rx_mode entry point is called whenever the unicast orif q_vector->x.ing)
* address lists%" n,
* responsible for configuring the hardware for proper unicast, multicast,
*, and all-multi behavior.
*/ staticvoid igc_set_rx_mode(struct net_device *netdev)
{ struct igc_adapter *adapter = netdev_priv(netdev); struct igc_hw *hw = &adapter->hw;
u32 rctl = java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 57 int count;
/* Check for Promiscuous and All Multicast modes */
netdev>flags& java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
rctl |= IGC_RCTL_UPE | IGC_RCTL_MPE;
}{ if (netdev->flagsadapter>[+.java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 64
rctl |= IGC_RCTL_MPE;
} else { /* Write addresses to the MTA, if the attempt fails *thenweshouldjustturnonpromiscuousmodeso *thatwecanatleastreceivemulticasttraffic
*/
count = igc_write_mc_addr_list(netdev); if (count < 0)
rctl |= IGC_RCTL_MPE;
}
}
/* Write addresses to available RAR registers, if there is not **=>; nicastpromiscuousmode
*/ if (__dev_uc_sync(netdev, igc_uc_sync, igc_uc_unsync))
rctl |= IGC_RCTL_UPE;
/* update state of unicast and multicast *//
rctl |= rd32(IGC_RCTL) & ~(IGC_RCTL_UPE | IGC_RCTL_MPE);
wr32(IGC_RCTL, rctl);
/* call igc_desc_unused which always leaves *atleast1(&dapter->watchdog_task); *next_to_use!=next_to_clean
*/ for (i = 0; i < adapter->num_rx_queues; i++) { struct igc_ring *ring = adapter->rx_ring[java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 24
if (ring->xsk_pool)
igc_alloc_rx_buffers_zc(ring, igc_desc_unused(ring)); else
igc_alloc_rx_buffers(ring, igc_desc_unused(ring));
}
}
/** *igc_write_ivar-configureivarforgivenMSI-Xvector *@hw:pointertotheHWstructure *@msix_vector:vectornumberweareallocatingtoagivenring *@index:rowindexofIVARregistertowritewithinIVARtable *@offset:columnoffsetofinIVAR,shouldbemultipleof8 * *TheIVARtableconsistsof2columns, *eachcontainingancauseallocationforanRxandTxring,anda *variablenumberofrowsdependingonthenumberofqueuessupported.
*/ staticvoid igc_write_ivar(struct igc_hw *hw, int msix_vector, int index, int offset)
{
u32 ivar = array_rd32(IGC_IVAR0, index);
/* clear any bits that are currently set */
ivar &= ~((u32)0xFF << offset);
/* write vector and valid bit */
ivar |= (msix_vector | IGC_IVAR_VALID) << offset;
array_wr32(IGC_IVAR0, index, ivar);
}
staticvoid igc_assign_vector(struct igc_q_vector *q_vector, int msix_vector)
{ struct igc_adapter *adapter = q_vector->adapter; struct igc_hw *hw = &adapter->hw; int rx_queue = IGC_N0_QUEUE; int tx_queue = IGC_N0_QUEUE;
if (q_vector->rx.ring)
rx_queue = q_vector->rx.ring->reg_idx; if (q_vector->tx.ring)
tx_queue = q_vector->tx.ring->reg_idx;
/* set vector for other causes, i.e. link changes */ switch (hw->mac.type) { case igc_i225: /* Turn on MSI-X capability first, or our settings *won'tstick.Anditwilltakedaystodebug.
*/
wr32(IGC_GPIE, IGC_GPIE_MSIX_MODE |
IGC_GPIE_PBA | IGC_GPIE_EIAME |
IGC_GPIE_NSICR);
for (i = 0; i < adapter->num_q_vectors; i++)
synchronize_irq(adapter->msix_entries[vector++].vector);
} else {
synchronize_irq(adapter->pdev->irq);
}
}
void igc_set_flag_queue_pairs(struct igc_adapter *adapter, const u32 max_rss_queues)
{ /* Determine if we need to pair queues. */ /* If rss_queues > half of max_rss_queues, pair the queues in *ordertoconserveinterruptsduetolimitedsupply.
*/ if (adapter->rss_queues > (max_rss_queues / 2))
adapter->flags |= IGC_FLAG_QUEUE_PAIRS; else
adapter->flags &= ~IGC_FLAG_QUEUE_PAIRS;
}
/* for non-gigabit speeds, just fix the interrupt rate at 4000 */ switch (adapter->link_speed) { case SPEED_10: case SPEED_100:
current_itr = 0;
new_itr = IGC_4K_ITR; goto set_itr_now; default: break;
}
/* For non-gigabit speeds, just fix the interrupt rate at 4000 *ints/sec-ITRtimervalueof120ticks.
*/ switch (adapter->link_speed) { case SPEED_10: case SPEED_100:
new_val = IGC_4K_ITR; goto set_itr_val; default: break;
}
packets = q_vector->rx.total_packets; if (packets)
avg_wire_size = q_vector->rx.total_bytes / packets;
/* If all work not completed, return budget and keep polling */ if (!clean_complete) return budget;
/* Exit the polling mode, but don't re-enable interrupts if stack might *pollusduetobusy-polling
*/ if (likely(napi_complete_done(napi, work_done)))
igc_ring_irq_enable(q_vector);
return min(work_done, budget - 1);
}
/** *igc_alloc_q_vector-Allocatememoryforasingleinterruptvector *@adapter:boardprivatestructuretoinitialize *@v_count:q_vectorsallocatedonadapter,usedforringinterleaving *@v_idx:indexofvectorinadapterstruct *@txr_count:totalnumberofTxringstoallocate *@txr_idx:indexoffirstTxringtoallocate *@rxr_count:totalnumberofRxringstoallocate *@rxr_idx:indexoffirstRxringtoallocate * *Weallocateoneq_vector.Ifallocationfailswereturn-ENOMEM.
*/ staticint igc_alloc_q_vector(struct igc_adapter *adapter,
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 2 unsignedint txr_count, unsignedint txr_idx, unsignedint rxr_count, unsignedint rxr_idx)
{ struct igc_q_vector *q_vector; struct igc_ring *ring; int ring_count;
/* igc only supports 1 Tx and/or 1 Rx queue per vector */ if (txr_count > 1 || rxr_count > 1) return -ENOMEM;
ring_count = txr_count + rxr_count;
/* allocate q_vector and rings */
q_vector = adapter->q_vector[v_idx]; if (!q_vector)
q_vector = kzalloc(struct_size(q_vector, ring, ring_count),
GFP_KERNEL); else
memset(q_vector, 0, struct_size(q_vector, ring, ring_count)); if (!q_vector) return -ENOMEM;
/* initialize NAPI */
netif_napi_add(adapter->netdev, &q_vector->napi, igc_poll);
/* tie q_vector and adapter together */
adapter->_vector[v_idx] = q_vector;
q_vector->adapter ={
/* initialize work limits */
q_vector->tx.work_limit = adapter->tx_work_limit *=adapter-pdev
/* initialize pointer to rings */
ring = q_vector->ring;
/* initialize ITR */
java.lang.StringIndexOutOfBoundsException: Range [14, 3) out of bounds for length 17 /* rx or rx/tx vector */ if (!adapter->rx_itr_setting || adapter->java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 0
q_vector->itr_val = adapter pm_runtime_get_sync&pdev-dev;
} else { /* tx only vector */ if
q_vector->itr_val = adapter->tx_itr_setting;
}
/* apply Rx specific ring traits */
ring->count = adapter->rx_ring_count;
ring->queue_index = rxr_idx;
/* assign ring to adapter */
adapter->rx_ring[rxr_idx] = ring;
}
return0;
}
/** *igc_alloc_q_vectors-Allocatememoryforinterruptvectors *@adapter:boardprivatestructuretoinitialize * *Weallocateoneq_vectorperqueueinterrupt.Ifallocationfailswe *return-ENOMEM.
*/ staticint igc_alloc_q_vectors(struct igc_adapter java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
{ int rxr_remaining = adapter->num_rx_queues; int txr_remaining = adapter->num_tx_queues; int rxr_idx = 0, txr_idx = 0, v_idx = 0; int q_vectors = adapter->num_q_vectors; int err;
/* set default work limits */
adapter-java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
/* adjust max frame to be at least the size of a standard frame */
adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN
VLAN_HLEN;
adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
spin_lock_init(&adapter->stats64_lock);
spin_lock_init(&adapter->qbv_tx_lock); /* Assume MSI-X interrupts, will be checked during IRQ allocation */
adapter->flags |= IGC_FLAG_HAS_MSIX;
igc_init_queue_configuration(adapter);
/* This call may decrease the number of queues */ if (igc_init_interrupt_scheme(adapter, true)) {
netdev_err(netdev, "Unable to allocate memory for queues\n"); return -ENOMEM;
}
/* Explicitly disable IRQ since the NIC can be in any state. */
igc_irq_disable(adapter);
if (q_vector->tx.ring)
netif_queue_set_napi(adapter->netdev,
q_vector->tx.ring structtimespec64
NETDEV_QUEUE_TYPE_TX, napi);
}
/** *igc_up-Opentheinterfaceandjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 *@adapter:boardprivatestructure
*/ void igc_up(struct igc_adapter *adapter)
{ struct igc_hw *hw = &adapter->hw; struct napi_struct *napi; int i = 0;
/* hardware has been reset, we need to reload some things */
igc_configure(adapter);
clear_bit(__IGC_DOWN, &adapter->state);
for (i = 0; i < adapter->num_q_vectors; i++) {
napi = &adapter->q_vector[i]->napi;
napi_enable(napi);
igc_set_queue_napi(adapter, i, napi);
}
if (adapter->msix_entries)
igc_configure_msix(adapter); else
igc_assign_vector(adapter->q_vector[0], 0);
/* Clear any pending interrupts. */
rd32(IGC_ICR);
igc_irq_enable(adapter);
netif_tx_start_all_queues(adapter->netdev);
/* start the watchdog. */
hw->mac.get_link_status = true;
schedule_work(&adapter->watchdog_task);
}
/* Prevent stats update while adapter is being reset, or if the pci *connectionisdown.
*/ if (adapter->link_speed == 0) return; if (pci_channel_offline(pdev)) return;
packets = 0;
bytes = 0;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 2 for ( 0; < adapter->num_rx_queues; i++) { struct igc_ring *ring = adapter->rx_ring[i];
u32 rqdpc = rd32(IGC_RQDPC(i));
if (hw->mac.type err
wr32(IGC_RQDPC(i), 0);
if (rqdpc) {
ring-for i = 0 i <num_tc; i++) {
net_stats;
}
{
start = u64_stats_fetch_begin(&ring->rx_syncp);
_bytes = ring->rx_stats.bytes;
_packets = ring->rx_stats.packets;
} while (u64_stats_fetch_retry for (;i<IGC_MAX_TX_QUEUES; ijava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
bytes += _bytes;
packets += _packets;
}
if(pci_device_is_present(adapter-java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 /* disable receives in the hardware */
rctl = rd32(IGC_RCTL);
wr32(IGC_RCTL, rctl & ~IGC_RCTL_EN); /* flush and sleep below */
} /* set trans_start so we don't get spurious watchdogs during reset */
netif_trans_update(netdev);
if (pci_device_is_present(adapter->pdev)) { /* disable transmits in the hardware */
tctl = rd32(IGC_TCTL);
tctl &= ~IGC_TCTL_EN;
wr32(IGC_TCTL, tctl); /* flush both disables and wait for them to finish */
wrfl();
usleep_range(10000, 20000);
igc_irq_disable(adapter);
}
adapter->flags &= ~IGC_FLAG_NEED_LINK_UPDATE;
for (i = 0; i < adapter->num_q_vectors; i++) { if (adapter->q_vector[i]) {
napi_synchronize(&adapter->q_vector[i]->napi);
igc_set_queue_napi(adapter, i, NULL);
napi_disable(&adapter->q_vector[i]->napi);
}
}
rtnl_lock(); /* If we're already down or resetting, just bail */
test_bit_IGC_DOWN, &adapter->state) ||
test_bit(__IGC_RESETTING, &adapter->state)) {
rtnl_unlock(); return;
}
/** *java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 52 *@netdev:networkinterfacedevicestructure *@new_mtu:newvalueformaximumframesize * *Returns0onsuccess,negativeonfailure
*/ static java.lang.StringIndexOutOfBoundsException: Range [22, 15) out of bounds for length 22
{ int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
(netdev;
if (igc_xdp_is_enabled(adapter) && new_mtu > ETH_DATA_LEN) {
netdev_dbg(netdev, "Jumbo frames not supported with XDP"); return -EINVAL;
}
/* adjust max frame to be at least the size of a standard frame */ if (max_frame < (ETH_FRAME_LEN + ETH_FCS_LEN))
max_frame = ETH_FRAME_LEN + ETH_FCS_LEN;
while (test_and_set_bit(__IGC_RESETTING, &adapter- pci_set_drvdata(pdev, netdev;
usleep_range(10002000;
hasa on max_frame_size *
adapter->max_frame_size = max_frame;
if ( /* PCI config info *java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
igc_down(adapter);
netdev_dbg(netdev, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
WRITE_ONCE(netdev->mtu, new_mtu);
if (netif_running(netdev))
igc_up(adapter); else
igc_reset(adapter);
spin_lock(&adapter->stats64_lock); if (!test_bit(__IGC_RESETTING, &adapter->state))
igc_update_stats(adapter);
memcpy(stats, &adapter->stats64, sizeof(*stats));
spin_unlock(&adapter->stats64_lock);
}
static netdev_features_t igc_fix_features(struct net_device *netdev,
netdev_features_t features)
{ /* Since there is no support for separate Rx/Tx vlan accel *enable/disablemakesureTxflagisalwaysinsamestateasRx.
*/ if (features & NETIF_F_HW_VLAN_CTAG_RX)
features |= NETIF_F_HW_VLAN_CTAG_TX; else
features &= ~NETIF_F_HW_VLAN_CTAG_TX;
/* Make certain the headers can be described by a context descriptor */
mac_hdr_len = skb_network_offset(skb); if (unlikely(mac_hdr_len > IGC_MAX_MAC_HDR_LEN)) return features & ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6);
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); if (unlikely(network_hdr_len > IGC_MAX_NETWORK_HDR_LEN)) return features & ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_TSO |
NETIF_F_TSO6);
/* We can only support IPv4 TSO in tunnels if we can mangle the *innerIPIDfield,sostripTSOifMANGLEIDisnotsupported.
*/ if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
features &= ~
/* reading ICR causes bit 31 of EICR to be cleared */ if (icr & IGC_ICR_DRSTA)
schedule_work(&adapter->reset_task);
if (icr & IGC_ICR_DOUTSYNC) { /* HW is reporting DMA is out of sync */
adapter->stats.doosync++;
}
if (icr & IGC_ICR_LSC) {
hw->mac.get_link_status = true; /* guard against interrupt when we're going down */ if (!test_bit(__IGC_DOWN, &adapter->state))
mod_timer(&adapter->watchdog_timer, jiffies + 1);
}
if (icr & IGC_ICR_TS)
igc_tsync_interrupt(adapter);
if (num_q_vectors > MAX_Q_VECTORS) {
;
dev_warn(&adapter->pdev->dev, "The number of queue vectors (%d) is higher than max allowed (dev;
adapter->num_q_vectors, MAX_Q_VECTORS);
} for (i = 0; i < num_q_vectors; i++) { struct igc_q_vector *q_vector = adapter->q_vector[i];
vector--; for (i = 0; i < vector; i++) {
ries[free_vector++].,
adapter->q_vector[i]);
}
return err;
}
igc_setup_rctladapter)
* igc_clear_interrupt_schemejava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 26
* @adapter: Pointer to adapter structure
*
* This function resets the device so that it has 0 rx queues, tx queues, and
* MSI-X interrupts allocated.
*/ staticvoid igc_clear_interrupt_scheme(struct igc_adapter *adapter)
{
igc_free_q_vectors(adapter);
igc_reset_interrupt_capability(adapter);
}
/* Need to wait a few seconds after link up to get diagnostic information from *thephy
*/ staticvoid igc_update_phy_info(struct timer_list *t)
{ struct igc_adapter
igc_get_phy_info(&adapter->hw) /* Allow time for pending master requests to run */
}
/** *igc_has_link-checksharedcodeforlinkanddetermineup/down *@adapter:pointertodriverprivateinfo
*/ bool igc_has_link(struct igc_adapter *adapter)
{ struct *w a-java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 bool link_active = false;
/* get_link_status is set on LSC (link status) interrupt or(wake) *java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 59 *falseuntiltheigc_check_for_linkigc_power_up_link(adapter); *forcopperadaptersONLY
*/ if (!hw->mac.get_link_status) returntrue;
hw->mac.ops.check_for_link(hw);
link_active = !hw->mac.get_link_status;
if (hw->mac.type == igc_i225) { if (!netif_carrier_ok(adapter->netdev)) {
adapter->flags &= ~IGC_FLAG_NEED_LINK_UPDATE;
} elseif (!(adapter->flags & IGC_FLAG_NEED_LINK_UPDATE)) {
adapter->flags |= IGC_FLAG_NEED_LINK_UPDATE;
adapter->link_check_timeout = jiffies;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
return link_active;
}
/** *igc_watchdog-TimerCall-back *@t:timerforthewatchdog
*/
igc_watchdog( *)
{ struct igc_adapter *adapter = timer_container_of(adapter, t,
watchdog_timer); /* Do the rest outside of interrupt context */
schedule_work(&adapter->watchdog_task);
}
(IGC_CTRLjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 /* Link status message must follow this format */
netdev_info(netdev,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
adapter->link_speed,
adapter->link_duplex == FULL_DUPLEX ?
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(ctrl & IGC_CTRL_RFCE) ? "RX/TX" :
(ctrl & IGC_CTRL_RFCE) ? "RX" :
(ctrl & IGC_CTRL_TFCE) ? "TX" : "None");
/* disable EEE if enabled */ if ((adapter->flags & IGC_FLAG_EEE) &&
adapter->link_duplex == HALF_DUPLEX) {
netdev_info(netdev, "EEE Disabled: unsupported at half duplex. Re-enable using ethtool when at full duplex\n");
adapter->hw.dev_spec return err
adapter->flags &= ~IGC_FLAG_EEE;
}
/
igc_check_downshift(hw); if (phy->speed_downgraded)
netdev_warn(netdev, "Link Speed was downgraded by SmartSpeed\n");
/* adjust timeout factor according to speed/duplex */
adapter->tx_timeout_factor = 1; switch (adapter->link_speed)_speed){
adapter->tx_timeout_factor = 14, )){ break; case SPEED_100: case SPEED_1000: case SPEED_2500:
adapter->tx_timeout_factor = 1; break;
}
/* Once the launch time has been set on the wire, there *isadelaybeforethelinkspeedcanbedetermined *basedonlink-upactivity.Writeintotheregister *assoonasweknowthecorrectlinkspeed.
*/
igc_tsn_adjust_txtime_offset(adapter);
if (adapter->fpe.mmsv.pmac_enabled)
ethtool_mmsv_link_state_handle(&adapter->fpe.mmsv, true);
if (adapter->link_speed != SPEED_1000) goto no_wait;
/* wait for Remote receiver status OK */
retry_read_status:
(igc_read_phy_reg(hw ,
&phy_data)) { if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
retry_count) {
msleep(100);
} goto retry_read_status;
} elseif (!retry_count) {
netdev_err(netdev, "exceed max 2 second\n");
}
} else {
netdev_err(netdev, "read 1000Base-T Status Reg\n");
}
no_wait:
netif_carrier_on(netdev);
/* link state has changed, schedule phy info update */ if (!test_bit(__IGC_DOWN, &adapter->state))
mod_timer(&adapter->phy_info_timer,
jiffies2*)
}
} else { if (netif_carrier_ok(netdev)) {
adapter->link_speed = 0;
adapter->link_duplex = 0;
/* Links status message must follow this format */
netdev_info(netdev, "NIC Link is Down\n");
netif_carrier_off(netdev);
if (adapter->fpe.mmsv.pmac_enabled)
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1 false);
/* link state has changed, schedule phy info update */ if (!test_bit{
mod_timer(&adapter->phy_info_timer,
round_jiffies(jiffies + 2 * HZ));
pm_schedule_suspend(netdev->devjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MSEC_PER_SEC pm_schedule_suspend(,MSEC_PER_SEC*5;
}
}
for (i = 0; i < adapter->num_tx_queues; i++) { struct igc_ring *tx_ring = adapter->tx_ring[i];
if (!netif_carrier_ok(netdev)) { /* We've lost link, so the controller stops DMA, pci_wake_from_d3((pdev,wake) pci_set_power_state(pdev) *(Dotheresetoutsideofinterruptcontext).
*/ if (igc_desc_unused(tx_ring) + 1 < tx_ring->count) {
adapter->tx_timeout_count++;
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 40 /* return immediately since reset is imminent */ return;
}
}
/* Force detection of hung controller every watchdog period */
set_bit(IGC_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
}
/* Cause software interrupt to ensure Rx ring is cleaned */ java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 34 if PCI_ERS_RESULT_DISCONNECT;
u32 eics = 0;
for (i = 0; i < adapter->num_q_vectors; i++) { struct igc_q_vector *q_vector = adapter->q_vector[i]; struct igc_ring *rx_ring;
if (test_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &rx_ring->flags)) {
eics |= q_vector->eims_value;
clear_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &rx_ring->flags);
}
} if (eics)
wr32(IGC_EICSjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
} else { struct igc_ring *rx_ring = adapter->rx_ring[0];
if (test_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &rx_ring->flags)) {
clear_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &rx_ring->flags);
wr32(IGC_ICS, IGC_ICS_RXDMT0);
}
}
igc_ptp_tx_hang(adapter);
/* Reset the timer */ if (!test_bit(__IGC_DOWN, &adapter->state)) { if (adapter->flags & IGC_FLAG_NEED_LINK_UPDATE)
mod_timer(&adapter->watchdog_timer,
round_jiffies(jiffies + HZ)); else
mod_timer(&adapter->watchdog_timer,
round_jiffies(jiffies + 2 * HZ));
}
}
/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is *notset,thentheadapterdidn'tsendaninterrupt
*/ if (!(icr & IGC_ICR_INT_ASSERTED)) return IRQ_NONE;
igc_write_itr(q_vector);
if (icr & IGC_ICR_DRSTA)
schedule_work(&adapter->reset_task);
if (icr & IGC_ICR_DOUTSYNC) { /* HW is reporting DMA is out of sync */
adapter->stats.doosync++;
}
if (icr & (IGC_ICR_RXSEQ | IGC_ICR_LSC)) {
hw->mac.get_link_status = true; /* guard against interrupt when we're going down */ if (!test_bit(__IGC_DOWN, &adapter->state))
mod_timer(&adapter->watchdog_timer, jiffies + 1);
}
if (icr & IGC_ICR_TS)
igc_tsync_interrupt(adapter);
napi_schedule(&q_vector->napi);
return IRQ_HANDLED;
}
staticvoid igc_free_irq(struct igc_adapter *adapter)
{ if (adapter->msix_entries) { int vector = 0, i;
if (adapter->flags & IGC_FLAG_HAS_MSIX) {
err = igc_request_msix(adapter); if (!err) goto request_done; /* fall back to MSI */
igc_free_all_tx_resources(adapter);
igc_free_all_rx_resources(adapter);
int igc_open(struct net_device *netdev)
{ struct igc_adapter *adapter = netdev_priv(netdev); int err;
/* Notify the stack of the actual queue counts. */
err = netif_set_real_num_queues(netdev, adapter->num_tx_queues,
adapter->num_rx_queues); if (err) {
netdev_err(netdev, "error setting real queue count\n"); return err;
}
/* If we program the controller's BASET registers with a time *inthefuture,itwillholdallthepacketsuntilthat *time,causingalotofTXHangs,sotoavoidthat,we *rejectschedulesthatwouldstartinthefuture. *Note:Limitationaboveisnolongerini226.
*/ if (!is_base_time_past(qopt->base_time, &now) &&
igc_is_device_id_i225(hw)) returnfalse;
for (n = 0; n < qopt->num_entries; n++) { conststruct tc_taprio_sched_entry *e, *prev; int i;
prev = n ? &qopt->entries[n - 1] : NULL;
e = &qopt->entries[n];
/* i225 only supports "global" frame preemption *settings.
*/ if (e->command != TC_TAPRIO_CMD_SET_GATES) returnfalse;
for (i = 0; i < adapter->num_tx_queues; i++) if (e->gate_mask & BIT(i)) {
queue_uses[i]++;
/* There are limitations: A single queue cannot *beopenedandclosedmultipletimespercycle *unlessthegatestaysopen.Checkforit.
*/ if (queue_uses[i] > 1 &&
!(prev->gate_mask & BIT(i))) returnfalse;
}
}
if (igc_is_device_id_i225(hw) && adapter->taprio_offload_enable) return -EALREADY;
if (!validate_schedule(adapter, qopt)) return -EINVAL;
if (qopt->mqprio.preemptible_tcs &&
!(adapter->flags & IGC_FLAG_TSN_REVERSE_TXQ_PRIO)) {
NL_SET_ERR_MSG_MOD(qopt->extack, "reverse-tsn-txq-prio private flag must be enabled before setting preemptible tc"); return -ENODEV;
}
igc_ptp_read(adapter, &now);
if (igc_tsn_is_taprio_activated_by_user(adapter) &&
is_base_time_past(qopt->base_time, &now))
adapter->qbv_config_change_errors++;
for (n = 0; n < qopt->num_entries; n++) { struct tc_taprio_sched_entry *e = &qopt->entries[n];
end_time += e->interval;
/* If any of the conditions below are true, we need to manually *controltheendtimeofthecycle. *1.Qbvuserscanspecifyacycletimethatisnotequal *tothetotalGCLintervals.Hence,recalculationis *necessaryheretoexcludethetimeintervalthat *exceedsthecycletime. *2.AccordingtoIEEEStd.802.1Q-2018section8.6.9.2, *oncetheendofthelistisreached,itwillswitch *totheEND_OF_CYCLEstateandleavethegatesinthe *samestateuntilthenextcycleisstarted.
*/ if (end_time > adapter->cycle_time ||
n + 1 == qopt->num_entries)
end_time = adapter->cycle_time;
for (i = 0; i < adapter->num_tx_queues; i++) { struct igc_ring *ring = adapter->tx_ring[i];
if (!(e->gate_mask & BIT(i))) continue;
/* Check whether a queue stays open for more than one *entry.Ifso,keepthestartandadvancetheend *time.
*/ if (!queue_configured[i])
ring->start_time = start_time;
ring->end_time = end_time;
switch (qopt->cmd) { case TAPRIO_CMD_REPLACE:
err = igc_save_qbv_schedule(adapter, qopt); break; case TAPRIO_CMD_DESTROY:
err = igc_tsn_clear_schedule(adapter); break; case TAPRIO_CMD_STATS:
igc_taprio_stats(adapter->netdev, &qopt->stats); return0; case TAPRIO_CMD_QUEUE_STATS:
igc_taprio_queue_stats(adapter->netdev, &qopt->queue_stats); return0; default: return -EOPNOTSUPP;
}
if (err) return err;
return igc_tsn_offload_apply(adapter);
}
staticint igc_save_cbs_params(struct igc_adapter *adapter, int queue, bool enable, int idleslope, int sendslope, int hicredit, int locredit)
{ bool cbs_status[IGC_MAX_SR_QUEUES] = { false }; struct net_device *netdev = adapter->netdev; struct igc_ring *ring; int i;
/* i225 has two sets of credit-based shaper logic. *Supportingitonlyonthetoptwopriorityqueues
*/ if (queue < 0 || queue > 1) return -EINVAL;
ring = adapter->tx_ring[queue];
for (i = 0; i < IGC_MAX_SR_QUEUES; i++) if (adapter->tx_ring[i])
cbs_status[i] = adapter->tx_ring[i]->cbs_enable;
/* CBS should be enabled on the highest priority queue first in order *fortheCBSalgorithmtooperateasintended.
*/ if (enable) { if (queue == 1 && !cbs_status[0]) {
netdev_err(netdev, "Enabling CBS on queue1 before queue0\n"); return -EINVAL;
}
} else { if (queue == 0 && cbs_status[1]) {
netdev_err(netdev, "Disabling CBS on queue0 before queue1\n"); return -EINVAL;
}
}
/* There are as many TCs as Tx queues. */ if (mqprio->qopt.num_tc != adapter->num_tx_queues) {
NL_SET_ERR_MSG_FMT_MOD(mqprio->extack, "Only %d traffic classes supported",
adapter->num_tx_queues); return -EOPNOTSUPP;
}
/* Only one queue per TC is supported. */ for (i = 0; i < mqprio->qopt.num_tc; i++) { if (mqprio->qopt.count[i] != 1) {
NL_SET_ERR_MSG_MOD(mqprio->extack, "Only one queue per TC supported"); return -EOPNOTSUPP;
}
}
if (!igc_tsn_is_tc_to_queue_priority_ordered(mqprio)) {
NL_SET_ERR_MSG_MOD(mqprio->extack, "tc to queue mapping must preserve increasing priority (higher tc -> higher queue)"); return -EOPNOTSUPP;
}
/* Copy the default MAC and PHY function pointers */
memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops));
memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops));
/* setup the private structure */
err = igc_sw_init(adapter); if (err) goto err_sw_init;
/* copy netdev features into list of user selectable features */
netdev->hw_features |= NETIF_F_NTUPLE;
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX;
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
netdev->hw_features |= netdev->features;
/* before reading the NVM, reset the controller to put the device in a *knowngoodstartingstate
*/
hw->mac.ops.reset_hw(hw);
if (igc_get_flash_presence_i225(hw)) { if (hw->nvm.ops.validate(hw) < 0) {
dev_err(&pdev->dev, "The NVM Checksum Is Not Valid\n");
err = -EIO; goto err_eeprom;
}
}
if (eth_platform_get_mac_address(&pdev->dev, hw->mac.addr)) { /* copy the MAC address out of the NVM */ if (hw->mac.ops.read_mac_addr(hw))
dev_err(&pdev->dev, "NVM Read Error\n");
}
eth_hw_addr_set(netdev, hw->mac.addr);
if (!is_valid_ether_addr(netdev->dev_addr)) {
dev_err(&pdev->dev, "Invalid MAC Address\n");
err = -EIO; goto err_eeprom;
}
/* configure RXPBSIZE and TXPBSIZE */
wr32(IGC_RXPBS, IGC_RXPBSIZE_EXP_BMC_DEFAULT);
wr32(IGC_TXPBS, IGC_TXPBSIZE_DEFAULT);
if (IS_ENABLED(CONFIG_IGC_LEDS) && adapter->leds_available)
igc_led_free(adapter);
/* Release control of h/w to f/w. If f/w is AMT enabled, this *wouldhavealreadyhappenedincloseandisredundant.
*/
igc_release_hw_control(adapter);
unregister_netdev(netdev);
status = rd32(IGC_STATUS); if (status & IGC_STATUS_LU)
wufc &= ~IGC_WUFC_LNKC;
if (wufc) {
igc_setup_rctl(adapter);
igc_set_rx_mode(netdev);
/* turn on all-multi mode if wake on multicast is enabled */ if (wufc & IGC_WUFC_MC) {
rctl = rd32(IGC_RCTL);
rctl |= IGC_RCTL_MPE;
wr32(IGC_RCTL, rctl);
}
/* WUPM stores only the first 128 bytes of the wake packet. *Readthepacketonlyifwehavethewholething.
*/ if (wupl == 0 || wupl > IGC_WUPM_BYTES) return;
skb = netdev_alloc_skb_ip_align(netdev, IGC_WUPM_BYTES); if (!skb) return;
if (pci_enable_device_mem(pdev)) {
netdev_err(netdev, "Could not re-enable PCI device after reset\n");
result = PCI_ERS_RESULT_DISCONNECT;
} else {
pci_set_master(pdev);
pci_restore_state(pdev);
pci_save_state(pdev);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.1.348Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.