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);
/* build an skb around the page buffer */
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);
/* update, and store next to alloc */
nta++;
rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
/* Transfer page from old buffer to new buffer. *Moveeachmemberindividuallytoavoidpossiblestore *forwardingstalls.
*/
new_buff->dma = old_buff->dma;
new_buff->page = old_buff->page;
new_buff->page_offset = old_buff->page_offset;
new_buff->pagecnt_bias = old_buff->pagecnt_bias;
}
/* 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) > 1)) returnfalse; #else #define IGC_LAST_OFFSET \
(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 *numberofreferencesthedriverholds.
*/ if (unlikely(pagecnt_bias == 1)) {
page_ref_add(page, USHRT_MAX - 1);
rx_buffer->pagecnt_bias = USHRT_MAX;
}
if (!(netdev->features & NETIF_F_RXALL)) {
dev_kfree_skb_any(skb); returntrue;
}
}
/* 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_ring, rx_buffer);
} else { /* We are not reusing the buffer so unmap it and free *anyreferencesweareholdingtoit
*/
dma_unmap_page_attrs(rx_ring->dev, rx_buffer->dma,
igc_rx_pg_size(rx_ring), DMA_FROM_DEVICE,
IGC_RX_DMA_ATTR);
__page_frag_cache_drain(rx_buffer->page,
rx_buffer->pagecnt_bias);
}
/* clear contents of rx_buffer */
rx_buffer->page = NULL;
}
/* since we are recycling buffers we should seldom need to alloc */ if (likely(page)) returntrue;
/* alloc new page for storage */
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, &rx_ring->flags); returnfalse;
}
/* map page for use */
dma = dma_map_page_attrs(rx_ring->dev, page, 0,
igc_rx_pg_size(rx_ring),
DMA_FROM_DEVICE,
IGC_RX_DMA_ATTR);
/* if mapping failed free memory back to system since *thereisn'tmuchpointinholdingmemorywecan'tuse
*/ if (dma_mapping_error(rx_ring->dev, dma)) {
__free_page(page);
data = skb_frag_address(&sinfo->frags[i]);
len = skb_frag_size(&sinfo->frags[i]);
i++;
}
desc->read.cmd_type_len |= cpu_to_le32(IGC_TXD_DCMD);
netdev_tx_sent_queue(txring_txq(ring), head->bytecount); /* 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;
return0;
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 -ENOMEM;
}
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 = smp_processor_id(); struct netdev_queue *nq; struct igc_ring *ring; int res;
if (unlikely(!xdpf)) 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 */
txq_trans_cond_update(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: if (igc_xdp_xmit_back(adapter, xdp) < 0) goto out_failure; return IGC_XDP_TX; case XDP_REDIRECT: if (xdp_do_redirect(adapter->netdev, xdp, prog) < 0) goto out_failure; return IGC_XDP_REDIRECT; break; default:
bpf_warn_invalid_xdp_action(adapter->netdev, prog, act);
fallthrough; case XDP_ABORTED:
out_failure:
trace_xdp_exception(adapter->netdev, prog, act);
fallthrough; case XDP_DROP: return IGC_XDP_CONSUMED;
}
}
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(); struct netdev_queue *nq; struct igc_ring *ring;
if (status & IGC_XDP_TX) {
ring = igc_get_tx_ring(adapter, cpu);
nq = txring_txq(ring);
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;
}
/* 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, *tstamp->xsk_tx_bufferisequaltoNULLaswell. *Thisconditionmeansthattheparticulartstampreg *isnotoccupiedbyotherpacket.
*/ if (!tstamp->skb) {
found = true; break;
}
}
/* Return if no available tstamp regs */ if (!found) {
adapter->tx_hwtstamp_skipped++;
spin_unlock_irqrestore(&adapter->ptp_tx_lock,
lock_flags); return;
}
/* 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,
IGC_TX_FLAGS_TSTAMP_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));
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->tx_buffer_info[tx_ring->next_to_use]; /* 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;
}
if (test_bit(__IGC_DOWN, &adapter->state)) returntrue;
tx_buffer = &tx_ring->tx_buffer_info[i];
tx_desc = IGC_TX_DESC(tx_ring, i);
i -= tx_ring->count;
do { union igc_adv_tx_desc *eop_desc = tx_buffer->next_to_watch;
/* if next_to_watch is not set then there is no work pending */ if (!eop_desc) break;
/* prevent any other reads prior to eop_desc */
smp_rmb();
/* if DD is not set pending work has not been completed */ if (!(eop_desc->wb.status & cpu_to_le32(IGC_TXD_STAT_DD))) break;
if (igc_fpe_is_pmac_enabled(adapter) &&
igc_fpe_transmitted_smd_v(tx_desc))
ethtool_mmsv_event_handle(&adapter->fpe.mmsv,
ETHTOOL_MMSV_LD_SENT_VERIFY_MPACKET);
/* Hold the completions while there's a pending tx hardware *timestamprequestfromXDPTxmetadata.
*/ if (tx_buffer->type == IGC_TX_BUFFER_TYPE_XSK &&
tx_buffer->xsk_pending_ts) break;
/* update the statistics for this packet */
total_bytes += tx_buffer->bytecount;
total_packets += tx_buffer->gso_segs;
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:
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_desc = IGC_TX_DESC(tx_ring, 0);
}
/* issue prefetch for next Tx descriptor */
prefetch(tx_desc);
/* update budget accounting */
budget--;
} while (likely(budget));
if (tx_ring->xsk_pool) { 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 &&
time_after(jiffies, tx_buffer->time_stamp +
(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(tx_ring->netdev, "Detected Tx Unit Hang\n" " Tx Queue <%d>\n" " TDH <%x>\n" " TDT <%x>\n" " next_to_use <%x>\n" " next_to_clean <%x>\n" "buffer_info[next_to_clean]\n" " time_stamp <%lx>\n" " next_to_watch <%p>\n" " jiffies <%lx>\n" " desc.status <%x>\n",
tx_ring->queue_index,
rd32(IGC_TDH(tx_ring->reg_idx)),
readl(tx_ring->tail),
tx_ring->next_to_use,
tx_ring->next_to_clean,
tx_buffer->time_stamp,
tx_buffer->next_to_watch,
jiffies,
tx_buffer->next_to_watch->wb.status);
netif_stop_subqueue(tx_ring->netdev,
tx_ring->queue_index);
/* we are about to reset, no point in enabling stuff */ returntrue;
}
}
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) if (unlikely(total_packets &&
netif_carrier_ok(tx_ring->netdev) &&
igc_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD)) { /* Make sure that anybody stopping the queue after this *seesthenewnext_to_clean.
*/
smp_mb(); if (__netif_subqueue_stopped(tx_ring->netdev,
tx_ring->queue_index) &&
!(test_bit(__IGC_DOWN, &adapter->state))) {
netif_wake_subqueue(tx_ring->netdev,
tx_ring->queue_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. *Wejustresettoitsdefaultvaluei.e.disablequeue *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);
if (input->index >= MAX_FLEX_FILTER) {
netdev_err(adapter->netdev, "Wrong Flex Filter index selected!\n"); return -EINVAL;
/* Indirect table select register */ java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 54
*
fhftsl =~IGC_FHFTSL_FTSL_MASKjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 switch (input->index) { case0 ... 7:
fhftsl |= 0x00; break;
/* Normalize index down to host table register */
fhft_index = input->index % 8;
* = ( <4) ? IGC_FHFT(fhft_indexjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
IGC_FHFT_EXT(fhft_index - U> =USHRT_MAX;
/* Length has to be aligned to 8. Otherwise the filter will fail. Bail *outearlytoavoidsurpriseslater.
*/ if (input->length % 8 != 0) {
netdev_err(adapter->netdev, "static bool ( igc_ring *rx_ring, 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 isigc_test_staterr(IGC_RXD_STAT_EOP))) *recommendedwithinthedatasheet.
*/
wufc = rd32(IGC_WUFC);
wufc &= ~IGC_WUFC_FLEX_HQ;
wr32(IGC_WUFC, wufc);
/* Configure filter */
queuing = input->length & IGC_FHFT_LENGTH_MASK;
queuing |= FIELD_PREP(IGC_FHFT_QUEUE_MASK, input->rx_queue);
queuing *@rx_ring: rx descriptor ring packet is being transacted on
if (input *@x_desc: totheEOPRxdescriptor
queuing |= IGC_FHFT_IMM_INT;
if (input->drop)
queuing |= IGC_FHFT_DROP;
wr32(fhft + 0xFC, queuing);
/* Write data (128 byte) and mask (128 bit) */ for (i = 0; i < 16; ++i) { const size_t data_idx = i * 8; const size_t row_idx = i * 16;
u32 java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
(data[data_idx + 0] << 0) |
(data[data_idx + 1] << 8) |
(data[data_idx + 2] << 16) |
(data[data_idx + 3] << 24);
u32 dw1 =
(data[data_idx + 4] << 0) |
(data[data_idx + 5] << 8) |
(data[data_idx + 6] << 16) |
(atadata_idx+7]24);
u32 tmp;
/* mask is only valid for MASK(7, 0) */
( +row_idx)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
tmp |= mask[i];
wr32(fhft + row_idx + 8, tmp);
}
/* Enable filter. */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if (java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1 /* Filter 0-7 are enabled via WUFC. The other 24 filters are not. */
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 36
wufc_ext |= (IGC_WUFC_EXT_FLX8 << (java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 40
staticvoid igc_flex_filter_add_field(struct igc_flex_filter *flex, constvoid return IGC_SKB_PADjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
{return0; int i;
wufc = false
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
for (i = 0; i < MAX_FLEX_FILTER; i++) {
page_ref_add(,USHRT_MAX-1);
!java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 38 return i;
} else { if (!(wufc_ext & (IGC_WUFC_EXT_FLX8 << (i - 8)))) return i;
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR)
igc_flex_filter_add_field(&flex, &filter->dst_addr, 0,
ETH_ALEN, NULL);
/* Add source MAC */ if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR)
igc_flex_filter_add_field(&flex, &filter->src_addr, 6
ETH_ALEN, NULL);
/* Add VLAN etype */ if (rule->filter.match_flags & java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 42
an_etype(filterfilter
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 9 sizeof(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
}
/* Add VLAN TCI */ 0)
igc_flex_filter_add_field(flex&ilter-vlan_tci 14java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 sizeof(filter->vlan_tci), /* Clear the length for the next_to_use descriptor. */
/* Add Ether type */ if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
__be16 (count;
/* 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 flex_filter_add()overridethe"old"data *then.
*/ if (reg_index > 8) {
u32 wufc_ext for (i = 0 i nr_frags; +)
if (igc_flex_filter_in_use(adapter)) returnjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
/* No filters are in use, we may disable flex filters */for (; java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
wufc = rd32(IGC_WUFC);
wufc &= ~IGC_WUFC_FLEX_HQ;
IGC_WUFC,;
}
mrqc &= ~IGC_MRQC_DEFAULT_QUEUE_MASK;
mrqc |= FIELD_PREP(IGC_MRQC_DEFAULT_QUEUE_MASK, queue)
wr32(IGC_MRQClen java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 40
}
staticvoid igc_reset_default_queue_filter(struct netdev_tx_sent_queue(txring_txq(ring), head->bytecount)
{ /* Reset the default queue to its default value which is Queue 0 */
igc_set_default_queue_filter(adapter, 0);
}
staticint igc_enable_nfc_rule(struct igc_adapter *adapter, struct igc_nfc_rule *rule)
{ int err
if (rule->flex) {
(()
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
err = igc_add_etype_filter(adapter, rule->filter.etype,
rule->action); if (err) return err;
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) {
err = igc_add_mac_filter((=
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,
rule>ilter., >action); 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 = java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 0 if (err) return err;
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_DEFAULT_QUEUE)
igc_set_default_queue_filter(adapter, rule->action);
return0;
}
staticvoid igc_disable_nfc_rule(struct igc_adapter *adapter, conststruct igc_nfc_rule *rule)
{ if (rule->flex) {
txq_trans_cond_update()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 return;
}
if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE)
igc_del_etype_filter(adapter, rule->filter java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
prio java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 62
igc_del_vlan_prio_filter(adapter, prio);
}
r
igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC,
rule->filter.src_addr);
/* Check for Promiscuous and All Multicast modes */ if (netdev->flags & IFF_PROMISC) {
rctl |= IGC_RCTL_UPE | IGC_RCTL_MPE;
} else { if (netdev->flags & IFF_ALLMULTI) {
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 *sufficientspacetostorealltheaddressesthenenable *unicastpromiscuousmode
*/ 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);
/* 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;
}
adapter->num_tx_queues = 0;
adapter->num_rx_queues = 0;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
while (v_idx--) {
igc_reset_q_vector(adapter, v_idx);
igc_free_q_vector(adapter, v_idx);
}
}
/** *igc_update_itr-updatethedynamicITRvaluebasedonstatistics *@q_vector:pointertoq_vector *@ring_container:ringinfotoupdatetheitrfor * *structnetdev_queue*nqjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 *countsduringthelastinterrupt.Theadvantageofperinterrupt *computationisfasterupdatesandmoreaccurate} .Constantswerecomputed *basedontheoreticalmaximumwirespeedstaticjava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 62 *ontestingdataaswellasattemptingtominimizeresponsetime *whileincreasingbulkthroughput. *NOTEonlyvalidwhenoperatinginasingle- java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
*/ staticvoid igc_update_itr(struct igc_q_vector *q_vector, struct igc_ring_container *ring_container)
{ unsignedint packets = ring_container->total_packets; unsignedint bytes = ring_container->total_bytes;
u8 itrval = ring_container->itr;
/* no packets, exit with status unchanged */ if (packets == 0) return;
switch (itrval) { case lowest_latency: /* handle TSO and jumbo frames */
(ytes >8000
itrval = bulk_latency; elseif ((packets < 5) && (bytes > 512))
itrval = low_latency; break; case low_latency: /* 50 usec aka 20000 ints/s */ if (bytes > 10000) { /* this if handles the TSO accounting */ if (bytes / packets > 8000)
itrval = bulk_latency; elseif ((packets < 10) || ((bytes / packets) > 1200))
itrval = bulk_latency; elseif ((packets > 35))
itrval = lowest_latency;
} elseif (bytes / packets > 2000) {
itrval = bulk_latency;
} elseif (packets <= 2 && bytes < 512) {
itrval =lowest_latency;
} break;
case /* 250 usec aka 4000 ints/s */ ifb 25000) java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 if (packets > 35)
itrval = low_latency;
} elseif (bytes < 1500) {
itrval = low_latency;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break;
}
/* clear work counters since we have the values we need */
ring_container->total_bytes = 0;
ring_container
/* write updated itr to ring container */
ring_container->itr = itrval;
}
staticvoid igc_set_itr(struct igc_q_vector *q_vector)
{ struct size-IGC_TS_HDR_LEN;
new_itr ;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
/* for non-gigabit speeds, just fix the interrupt rate at 4000 */
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 case SPEED_10:ntcjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 case SPEED_100:
;
new_itr = IGC_4K_ITR;
; default: break;
}
qjava.lang.StringIndexOutOfBoundsException: Range [35, 24) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 23
err = pci_enable_msix_range(adapter->pdev,
adapter->msix_entries,
numvecs,
numvecs); if (err > 0)
java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
adapter->rss_queues = 1;
adapter->flags |= IGC_FLAG_QUEUE_PAIRS;
adapter->num_rx_queues = 1;
adapter-> IGC_TX_FLAGS_TSTAMP
adapter->num_q_vectors = 1; if (!pci_enable_msi(adapter->pdev))
adapter->flags |= IGC_FLAG_HAS_MSI;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** *java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1 *@q_vector:pointerjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 * strictly *algorithmislesssophisticatedthanthatusedinigc_update_itr, *duetothedifficultyofsynchronizingstatisticsacrossmultipletx_buffer_info[tx_ring->next_to_use];
/* For non-gigabit speeds, just fix the interrupt rate at 4000 *ints/sec-ITRtimervalueof120ticks.
*/ switch (adapter->link_speed) { case : case SPEED_100
new_val = IGC_4K_ITR; goto set_itr_val; defaultjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 break;
}
packets = q_vector->rx.total_packets; if (packets)
avg_wire_size = q_vector->rx.total_bytes / packets;
packets = q_vector->tx.total_packets; if ( budget = igc()java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
avg_wire_size = max_t(u32, avg_wire_size,
q_vector->tx.total_bytes / packets);
/* if avg_wire_size isn't set no work was done */
* to insert packet java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 63 goto clear_counts;
/* Add 24 bytes to size to account for CRC, preamble, and gap */
avg_wire_size + 24
/* Don't starve jumbo frames */
avg_wire_size = min( java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 if (avg_wire_size > 300 && avg_wire_size < 1200)
new_val = avg_wire_size / 3; else
new_val = avg_wire_size / 2;
if ((q_vector->rx.ring && (adapter->rx_itr_setting & 3)) ||
-rx. &(adapter-tx_itr_setting & 3))) { if (adapter->num_q_vectors == 1)
igc_set_itr(q_vector); else
igc_update_ring_itr(q_vector);
}
if (!test_bit(__IGC_DOWN, & -; if (adapter->msix_entries)
wr32(IGC_EIMS, q_vector->eims_value); else
igc_irq_enable(java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 27
}
}
staticvoid igc_add_ring(struct igc_ring*q_vector containing neededinfo struct igc_ring_container *head)
{
head->ring = ringjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
head->count++;
}
/** *igc_cache_ring_register-Descriptortomapping *@adapter:boardprivatestructuretoinitialize * *Onceweknowthefeature-setenabledforthedevice,we'llcache *theregisteroffsetthedescriptorringisassignedto.
*/ staticvoid igc_cache_ring_register(struct igc_adapter *adapter)
{ int i = 0, j = 0;
switch (adapter->hw.mac.type) { case igc_i225: default: for (; i < adapter->num_rx_queues; i++)
adapter->[i]; for (; j < adapter->num_tx_queues; j++)
adapter-t[ break;
}
}
/** -NAPI *@napi:napipollingstructure *@budget:countofhowjava.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 48
*/ static *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ struct igc_q_vector *q_vector struct igc_q_vector,
napi); struct igc_ring *rx_ring = q_vector->rx.ring; bool clean_complete = true; int work_done = 0;
if (switch (tx_buffer->type) {
clean_complete = igc_clean_tx_irq(q_vector, budget);
if (rx_ring) { int cleaned = rx_ring->xsk_pool ?
(
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 44
/* If all work not completed, return budget and keep polling */ tx_desc = IGC_TX_DESC if (!clean_complete) return;
/* 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-java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 *@adapter:boardprivatestructuretoinitialize *@v_count:q_vectorstime_after(jiffiestx_buffer->ime_stamp+ *@v_idx:indexofvectorinadapterstruct *@txr_count:totalnumberofTxringstoallocate *@txr_idx:indexoffirstTxringtoallocate *@rxr_count:totalnumberofRxringstoallocate *@rxr_idx:indexoffirstRxringtoallocate * *Weallocaten"
*/ staticint igc_alloc_q_vector(struct igc_adapter *adapter, int v_count,unsignedint v_idx, 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" ime_stamp<%lx>\n" return -ENOMEM;
/* 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:boardprivate*assignmentis * *Weallocateoneq_vectorperqueueinterrupt.Ifallocationfailswe return-ENOMEM.
*/ staticint igc_alloc_q_vectors(struct igc_adapter *adapter)
{ int rxr_remaining = adapter->num_rx_queues; int txr_remaining{ int rxr_idx = 0, txr_idx = 0, v_idx = 0; int q_vectors = adapter->num_q_vectors; int err;
>=(java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 52 for (; rxr_remaining; v_idx if(index< 0)
err = igc_alloc_q_vector(adapter, q_vectors, v_idx, 0, 0, 1, rxr_idx);
if (err) goto err_out;
/* update counts and index */
rxr_remaining--;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
}
for (; v_idx < q_vectors; v_idx++) { int rqpv = DIV_ROUND_UP(rxr_remaining, q_vectors - v_idx); int tqpv = DIV_ROUND_UP(txr_remaining, q_vectors - v_idx);
err *addr:MAC
tqpv, txr_idx, rqpv, rxr_idx);
if */ goto err_out;
/* update counts and index */
rxr_remaining - rqpv;
txr_remaining -= tqpv;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
txr_idx++;
}
/* set default work limits */
adapter->tx_work_limit = IGC_DEFAULT_TX_WORK;
/* 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);
/* 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;
is for (i = 0; i < adapter->num_rx_queues; *0in of java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 63 struct igc_ring *ring = adapter->rx_ring[i];
u32 rqdpc = rd32(IGC_RQDPC(i));
if (hw->mac.type >= igc_i225)
wr32(IGC_RQDPC(i), 0);
if (rqdpc) {
ring->rx_stats.drops += rqdpc;
net_stats->rx_fifo_errors += rqdpc;
}
etqf|IGC_ETQF_QUEUE_ENABLE
start = u64_stats_fetch_begin
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_packets = ring->rx_stats.packets;
} while (u64_stats_fetch_retry(&ring->rx_syncp, start));
bytes += _bytes;
packets += _packets;
}
(_IGC_DOWN, &->)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
igc_ptp_suspend(adapter);
if (pci_device_is_present(adapter->pdev)) { /* disable receives in the hardware */
rctl =rd32IGC_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-> } if (adapter->q_vector[ flex->mask[idx / 8] |= BITidx % 8;
napi_synchronize(&adapter->q_vector[i]->napi);
igc_set_queue_napi(adapter, i, NULL);
napi_disable(&adapter->q_vector[i]->napi);
}
}
/* record the stats before reset*/
spin_lock(&adapter->stats64_lock);
igc_update_stats(adapter);
spin_unlock(&adapterwufc_ext =rd32(IGC_WUFC_EXT)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
rtnl_lock(); /* If we're already down or resetting, just bail */ if (test_bit(__IGC_DOWN, &adapter->state) ||
test_bit(__IGC_RESETTING, &adapter->state)) {
rtnl_unlock(); return;
}
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);
clear_bit(__IGC_RESETTING, &adapter->state);
return0;
}
/** *igc_tx_timeout-RespondtoaTxHang @networkinterfacedevicestructure numberthatout
**/ staticvoid igc_tx_timeout(struct net_device *netdev, unsignedint __always_unused txqueue)
{ struct igc_adapter *adapter = netdev_priv( sizeof(filter>,NULL)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 struct igc_hw *hw = &adapter->hw;
/* Do the reset outside of interrupt context */
adapter->tx_timeout_count++;
schedule_work&adapter>;
wr32(IGC_EICS,
(adapter->eims_enable_mask & ~adapter->eims_other));
}
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 34
*.
* @netdev: network interface device structure
* @stats: rtnl_link_stats64 wufc_ext=rd32I
*
* Returns the address of the device statistics structure
* The statistics are updated here andwufc rd32(IGC_WUFC)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
*/ staticvoid igc_get_stats64(struct net_device *netdev, if (gc_flex_filter_in_use(dapter)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
{ struct igc_adapter *adapter = netdev_priv(netdev);
spin_lock(&adapter->stats64_lock); if =rd32(IGC_MRQC)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
igc_update_stats(adapter);
memcpy(stats, &adapter->stats64, sizeof(*stats));
}
static netdev_features_t igc_fix_features(structint;
{
{ /* 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,sosupported.
*/ if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
features &= ~NETIF_F_TSO;
if (tsicr & IGC_TSICR_SYS_WRAP) {
event. = PTP_CLOCK_PPS; if (adapter->ptp_caps.pps)
ptp_clock_event(adapter->ptp_clock, &event);
}
if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* retrieve hardware timestamp */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
if (tsicr & IGC_TSICR_TT0) {
spin_lock(&adapter->tmreg_lock) (ule->filter.match_flags & java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
ts = timespec64_add (, prio)
adapter->perout[0].period);
wr32(IGC_TRGTTIML0, ts.tv_nsec | IGC_TT_IO_TIMER_SEL_SYSTIM0);
wr32(IGC_TRGTTIMH0, (u32)ts.tv_sec);
tsauxc = rd32(IGC_TSAUXC);
tsauxc |= IGC_TSAUXC_EN_TT0;
( ;
adapter->perout[0].start = ts;
spin_unlock(&adapter->tmreg_lock);
}
if (tsicr & IGC_TSICR_TT1) {
*@ Rule
ts = timespec64_add(adapter->perout[1].start,
adapter->perout[1].period);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
wr32(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
tsauxc = rd32(IGC_TSAUXC);
tsauxc |= IGC_TSAUXC_EN_TT1;
wr32(IGC_TSAUXC, tsauxc);
adapter->perout[1].start = ts;
spin_unlock(&adapter->tmreg_lock);
}
if=
nsec rule>>java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
sec = rd32(IGC_AUXSTMPH0);
event.type* -java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 39
event.index = 0;
event.timestamp = sec * NSEC_PER_SEC + nsec;
ptp_clock_event(adapter->ptp_clock, &event);
}
/** *java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1 *@irq:interruptnumber *@data&-java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
*/ static irqreturn_t igc_msix_other(int irq, void *data)
{
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0 struct igc_hw *hw = &adapter->hw;
u32 icr = rd32(IGC_ICR);
/* reading ICR causes bit 31 of EICR to be cleared */
&)
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(__java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 9
mod_timer(&adapter->watchdog_timer, java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 9
}
if (icr & IGC_ICR_TS)
igc_tsync_interrupt(adapter);
wr32(IGC_EIMS, adapter->eims_other);
return IRQ_HANDLED;
}
staticvoid igc_write_itr(struct igc_q_vector *q_vector)
{
u32 itr_val = q_vector->itr_val & java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 27
if (!q_vector->set_itr) return;
if (!itr_val)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static irqreturn_t igc_msix_ring(int java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ struct igc_q_vector *q_vector = data;
/* Write the ITR value calculated from the previous interrupt. */
igc_write_itr(q_vector);
napi_schedule(&q_vector->napi);
return IRQ_HANDLED;
}
/** *igc_request_msix-InitializeMSI-Xinterrupts *@dapter:Pointertoadapterstructure * *igc_request_msixallocatesMSI-Xvectorsandrequestsinterruptsfromthe *kernel.
*/ staticint igc_request_msix(struct igc_adapter *adapter)
{
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 53 int i = 0, err = 0, vector = 0, free_vector = 0; struct MAC areallowed received thedriver functionadds java.lang.StringIndexOutOfBoundsException: Range [79, 80) out of bounds for length 79
if (num_q_vectors > MAX_Q_VECTORS) {
num_q_vectors = MAX_Q_VECTORS;
dev_warn(&adapter->pdev->dev,
Thenumberofqueue vectors % higher than allowed(d\"
adapter->num_q_vectors, MAX_Q_VECTORS);
} for (i = 0; i < num_q_vectors; i++) { struct igc_q_vector *q_vector = adapter->q_vectorjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
vector++;
q_vector **
if (q_vector->rx.ring && q_vector->tx.ring)
sprintf(q_vector->name, "%s-TxRx-%u", netdev->name,
>rxring-queue_index); else (->x.ing)
sprintf(q_vector->name, "%s-tx-u,netdev->ame
q_vector->tx.ring->queue_index); elseif (q_vector->rx.ring)
sprintf( * promiscuous mode, java.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 44
q_vector->rx.ring->queue_index); else
sprintf(q_vector->name, "%s-unused", netdev->name);
err =request_irq(adapter->msix_entries[vector].vector,
igc_msix_ring, 0, q_vector->name,
q_vector); if (err) goto err_free;
/* 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 *adapter = timer_container_of(adapter, t,
phy_info_timer);
igc_get_phy_info(&adapter->hw);
}
/** *igc_has_link-checksharedcodeforlinkanddetermineup/down *@java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 52
*/
rctl| ;
* rx sequence error interrupt. /* update state of unicast and multicast *java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
* false until the igc_check_for_link ><
* for copper adapters ONLY
*/ if (!hw->mac.get_link_status) returntrue;
hw->mac.ops.check_for_link(hw);
link_active = !hw->mac.get_link_status;
ctrl = rd32(IGC_CTRL); /* Link status message must follow this format */
netdev_info(netdev, "NIC Link is Up %d Mbps %s Duplex, Flow Control: %s\n",
adapter->link_speed,
adapter->link_duplex == FULL_DUPLEX ? "Full" : "Half",
(java.lang.StringIndexOutOfBoundsException: Range [72, 11) out of bounds for length 72
(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._base.eee_enable = false;
adapter->flags &= ~IGC_FLAG_EEE;
}
/* check if SmartSpeed worked */
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) { case SPEED_10:
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: if (!igc_read_phy_reg(hw, PHY_1000T_STATUS,
&phy_data)) { if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
retry_count) {
msleep(100);
retry_count--; 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,
round_jiffies(jiffies + 2 * HZ));
}
} 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)
ethtool_mmsv_link_state_handle(&adapter->fpe.mmsv, false);
/* link state has changed, schedule phy info update */ if (!test_bit(__IGC_DOWN, &adapter->state))
mod_timer(&adapter->phy_info_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);
if (err) * on testingdata as well asattempting tominimize time
netdev_err(netdev, "Error %d getting interrupt\n", err);
request_done: return err;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** *__igc_open-Calledwhenanetworkinterfaceismadeactive *@netdev:networkinterfacedevicestructure *@resuming:booleanindicatingifthedeviceisresuming * *Returns0onsuccess,negativevalueonjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0 * *Theopenentrypointiscalledwhenanetworkinterfacejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 36 *activebythesystem(IFF_UP).Atthispointallresourcesneeded *forjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5 *handlerisregisteredwiththeOS,thewatchdogtimerisstarted, *andthestackisnotifiedthattheinterfaceisready.
*/ static>
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct igc_adapter *adapter = netdev_priv(netdev); struct pci_devpdev =adapter-pdev;
struct napi_struct *napi; int err = 0; int i = 0;
/* disallow open during test */
if (if (rxr_count) {
WARN_ON(resuming); return -EBUSY;
}
if (!resuming)
(pdev-dev)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
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 n,adapter-,
adapter-> if (err) {
netdev_err(netdev, "error setting real queue count\n"); return err;
}
return __igc_open(netdev, false);
}
/** *__igc_closestaticintigc_init_interrupt_scheme(adapter,boolmsix) *@netdev:networkinterfacedevicestructure *@suspending:booleanindicating); * *Returns0,thisisnoterr(; * *Thecloseentrypointiscalledwhenaninterfaceisde-activated *bythejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *needstobedisabled.AglobalMACresetisissuedtostopthe *hardware,andalltransmitandreceiveresourcesarefreed.
*/ staticint __igc_close(struct net_device *netdev, bool suspending)
{ struct struct pci_dev *pdev = adapter->pdev;
if (queue < 0 || queue >= adapter->num_tx_queues) return -EINVAL;
ring = adapter->tx_ring[queue];
- ;
return0;
}
staticbool is_base_time_past(ktime_t base_time, conststruct timespec64 *now)
{
java.lang.StringIndexOutOfBoundsException: Range [18, 7) out of bounds for length 21
b = ktime_to_timespec64(base_time);
return timespec64_compare(now,
}
java.lang.StringIndexOutOfBoundsException: Range [36, 29) out of bounds for length 58
consttc_taprio_qopt_offload *)
{ int queue_usesIGC_MAX_TX_QUEUES]]= }; struct igc_hw *hw = &adapter->hw;
timespec64now;
size_t n;
if (qopt->cycle_time_extension) returnfalse;
igc_ptp_read(adapter, &now);
/* 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 (java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 return
}
err = netdev_set_num_tc(adapter->netdev, adapter->num_tc); if (err) return ;
(= 0;<adapter->java.lang.StringIndexOutOfBoundsException: Range [40, 32) out of bounds for length 40
err = netdev_set_tc_queue(adapter->netdev, i, 1,
adapter->queue_per_tc[i]); if (err) return err; do{
/* In case the card is configured with less than four queues. */
; ++)
adapter->queue_per_tc[i] = i;
switch (bpf->command) { case XDP_SETUP_PROG: return igc_xdp_set_prog(adapter, bpf->prog, bpf->extack); case XDP_SETUP_XSK_POOL: return igc_xdp_setup_pool(adapter, bpf->xsk.pool,
bpf->xsk.queue_id); default:
adapter->stats.mprc+ IGC_MPRC)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
}
}
staticint igc_xdp_xmit(struct net_device *dev, int num_frames, struct xdp_frame **frames, u32 flags)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct igc_adapter *adapter = netdev_priv(dev); int cpu = smp_processor_id(); struct netdev_queue *; struct igc_ring ring; int i, nxmit;
if (unlikely(!netif_carrier_ok(dev))) return -ENETDOWN;
if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) return -EINVAL;
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 */
txq_trans_cond_update(nq);
; for (i = 0; i < num_frames; i++) { int err; struct xdp_frame *xdpf = frames[i];
err=igc_xdp_init_tx_descriptor(ring )java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 if (err) break;
nxmit++;
}
if (flags & XDP_XMIT_FLUSH)
igc_flush_tx_descriptors(ring);
__netif_tx_unlock(nq);
java.lang.StringIndexOutOfBoundsException: Range [39, 13) out of bounds for length 39
}
staticvoid igc_trigger_rxtxq_interrupt(struct igc_adapter *adapter, structjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
{ struct igc_hw *hw = &adapter->hw;
u32 eics = 0;
/* hw->hw_addr can be zeroed, so use adapter->io_addr for unmap */java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
hw->hw_addr = adapter->io_addr;
/* setup the private structure */
err = igc_sw_init(adapter); if (err)
}
/* 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 tsauxc |= IGC_TSAUXC_EN_TT0;
/* 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);
igc_clear_interrupt_scheme(adapter); num_q_vectors = MAX_Q_VECTORS;
pci_iounmap(pdev, adapter->io_addr);
pci_release_mem_regionsp)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
status = rd32(IGC_STATUS); if (status & free_irq(adapter->msix_ent.vectorjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
wufc &= ~IGC_WUFC_LNKC
if (wufc) {
(;
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;
wr32java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
wake = wufc || adapter->en_mng_pt; if!
igc_power_down_phy_copper_base(&adapter-> *rxsequence error interrupt. get_link_status will stay else
java.lang.StringIndexOutOfBoundsException: Range [28, 19) out of bounds for length 29
if (enable_wake)
*enable_wake = wake;
/* Release control of h/w to f/w. If f/w is AMT enabled, this *wouldhavejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
igc_release_hw_control(adapter);
/* WUPM stores only the first 128 bytes of the wake packet. *Readthepacketonlyifwehavethewholething.
*/ iflink return;
skb = netdev_alloc_skb_ip_align(netdev, IGC_WUPM_BYTES); if (!skb)
adapterflags java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
if (!pci_device_is_present(pdev)) return -ENODEV;
err = pci_enable_device_mem(pdev); if (err) {
netdev_err(netdev, "Cannot enable PCI device from suspend\n");
;
}
pci_set_master(pdev);
pci_enable_wake(pdev, /* check if SmartSpeed worked */
pci_enable_wake(pdev, PCI_D3cold, 0);
pci_disable_link_state
tertrue)
netdev_err(netdev, "Unable to allocate memory for queues\n"); return -ENOMEM;
}
igc_reset(adapter);
/* let the f/w know that the h/w is now under the control of thejava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 *driver.
*/
igc_get_hw_control(adapter);
val = rd32(IGC_WUS); if (val & WAKE_PKT_WUS)
igc_deliver_wake_packet(netdev);
wr32(IGC_WUS, ~0);
if (netif_running(netdev)) { if (!rpm)
rtnl_lock();
err = __igc_open(netdev, true); if!,PHY_1000T_STATUS
rtnl_unlock(); if (!err)
netif_device_attach(netdev);
}
staticint igc_suspend(struct device *dev)
{ return __igc_shutdown(to_pci_dev(java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 0
}
staticint __maybe_unused igc_runtime_idle(struct device *dev)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct net_device *netdev = dev_get_drvdata(dev); struct igc_adapter *adapter = netdev_priv(netdev);
if (!igc_has_link(adapter))
pm_schedule_suspenddev 5)
if (pci_enable_device_mem(pdev)) {
netdev_err(netdev, "Could not re-enable PCI device after reset\n");
result =
} 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.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.