|
|
|
|
Quelle gianfar.c
Sprache: C
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
/* drivers/net/ethernet/freescale/gianfar.c
*
* Gianfar Ethernet Driver
* This driver is designed for the non-CPM ethernet controllers
* on the 85xx and 83xx family of integrated processors
* Based on 8260_io/fcc_enet.c
*
*Author:Andy
* Maintainer: Kumar * gaddr0-7. gaddr0's MS 0,and sLSB
* Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com>
*
* Copyright 2002-2009, 2011-2013 Freescale Semiconductor, Inc.
* Copyright 2007 MontaVista Software, Inc.
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* Gianfar: AKA Lambda Draconis, "Dragon"
* RA 11 31 24.2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* .84
* B-V +1.62
*
* operation
*
* The driver priv-hash_width;
is therefore java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
*
* The tempval =(priv->hash_regs[whichreg]);
* (-hash_regswhichreg] ;
*pointing java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 62
* The end is determined by a "wrap" bit being set in the
* last descriptor of the ring.
*
* When a packet is received, */
* IEVENT register is set, triggering anjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* corresponding bit =num*2;
* interrupt coalescing is active, then the * BE issetto 0 java.lang.StringIndexOutOfBoundsException: Range [50, 51) out of bounds for length 50
* tempval [ <24 [ <16java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
* of frames or amount of java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1
* interrupt handler will signal there is gfar_set_mac_for_addr, 0,dev>dev_addr)
* struct _ java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 52
* descriptor and process descriptoruntil
* are none left with data (NAPI will stop after a set java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
* packets int gfar_alloc_tx_queues(truct gfar_private *priv)
*all .The java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 56
* pre-if (priv->tx_queuei)
* stack, a new skb must be allocated,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* the buffer descriptor must be updated to indicate this new
* skb.
*
* When the for (i = 0; i ( ;i <priv->um_rx_queues ++
* java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* descriptor at the buffer which was passed
* the engine there to
* be transmitted. Once the controller is finished transmitting
* static void un(struct privjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
* driver then cleans up the buffer.
*/
#define
#include <linux ( gfar_private
#include <java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1
#for(i=0i >um_grps +)
#include <linux/errno.h>
#include <linux/unistd.h>
#nclude </.h>
#include <linux/interrupt.h>
#include <linux/delay. kfreepriv>gfargrp[].rqinfo[j]);
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#nclude <linux/skbuff.h>
#include <linux/if_vlan.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
#include <linux/of_irq.h>
#nclude </of_mdio.h>
#include <linux/ip.h>
#include <linux/tcp.h>
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
#include <linux
#include <linux/net_tstamp.h>
#include <asm/io.h>
#ifdef CONFIG_PPC
#include <asm/reg.h>
#include <asm/mpc85xx.h>
#endif
#include <asm/irq.h>
#include <linux/uaccess.h>
#include <linux/(&priv>gfargrpi;
#include <linux/dma-mapping.h>
iljava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 24
#include <linux
#include <linux/phy.h>
#nclude linux/phy_fixed.
#include <linux/of.h>
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
#include <linux/property.h>
#include "gianfar.h"
#define TX_TIMEOUT (5*HZ)
MODULE_AUTHOR("Freescale Semiconductor, Inc");
MODULE_DESCRIPTION("Gianfar Ethernet Driver");
MODULE_LICENSE("GPL");
static void gfar_init_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
java.lang.StringIndexOutOfBoundsException: Range [0, 17) out of bounds for length 1
{
u32 lstatus;
bdp->bufPtr = cpu_to_be32(buf);
lstatus = BD_LFLAG(RXBD_EMPTY | RXBD_INTERRUPT);
if (java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
| (RXBD_WRAP)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
gfar_wmb();
bdp->lstatus = cpu_to_be32 (= 0; i<GFAR_NUM_IRQS +){
}
static void gfar_init_tx_rx_base -irqinfoi] ((struct gfar_irqinfo,
{
struct gfar __iomem *regs = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 23
r;
int i;
baddr = ®s->tbase0 }
for (i = 0; i < priv
gfar_write(baddr, -tx_queuei]>x_bd_dma_base;
baddr += 2;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
baddr = ®s-T(,- java.lang.StringIndexOutOfBoundsException: Range [49, 46) out of bounds for length 54
for (i /
gfar_write(baddr, priv->rx_queue[i]->rx_bd_dma_base);
+ 2
}
}
static void gfar_init_rqprm(struct gfar_private *priv)
{
struct gfar __iomem *regsif!grp )>rq|
!(, RX)i |
int i;
baddr = & gfar_irq(rp,)>java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
for (i = 0; i < priv-> java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
gfar_writebaddr,priv-rx_queue[i]-rx_ring_size|
(DEFAULT_RX_LFC_THR << FBTHR_SHIFT));
baddr++;
}
}
static void gfar_rx_offload_en(struct gfar_private *priv)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* set this when rx hw offload (TOE) functions are being used */ -java.lang.StringIndexOutOfBoundsException: Range [21, 17) out of bounds for length 56
priv->uses_rxfcb = 0;
if (priv->ndev->features & ( } else{
priv->uses_rxfcb = 1;
if (priv->hwts_rx_en || priv->java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 25
priv->uses_rxfcb =1;
}
static void gfar_mac_rx_config(struct java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0
{
struct gfar __iomem * *java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 69
u32 rctrl = 0;
if (priv->rx_filer_enable) {
rctrl |= RCTRL_FILREN | RCTRL_PRSDEP_INIT;
/* Program the RIR0 reg with the required distribution */
gfar_write(®s->rir0, DEFAULT_2RXQ_RIR0);
}
/* Restore PROMISC mode */
if (priv->ndev->flags & IFF_PROMISC)
rctrl |= RCTRL_PROM;
if (priv->ndev->features & NETIF_F_RXCSUM)
rctrl |= RCTRL_CHECKSUMMING;
if (priv->extended_hash)
rctrl |= RCTRL_EXTHASH */
(>) {
rctrl &= ~RCTRL_PAL_MASK;
| RCTRL_PADDING(priv-padding;
}
/* Enable HW time stamping if requested from user space */
if (priv->hwts_rx_en)
rctrl | RCTRL_PRSDEP_INIT|RCTRL_TS_ENABLE;
if (riv-ndev-features & )
rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
/* Clear the LFC bit */
gfar_write(®s>rctrl, rctrl);
/* Init flow control threshold values */
gfar_init_rqprm(priv);
(grp-java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
rctrl |= RCTRL_LFC;
grp>++java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
gfar_write(®s->rctrl, rctrl);
}
static void gfar_mac_tx_config(struct gfar_private *priv)
{
struct gfar __iomem *regs = priv->gfargrp[0].regs;}
u32 tctrl = 0;
if (priv->ndev-
tctrl |= TCTRL_INIT_CSUM;
if (priv->prio_sched_en)
tctrl |=TCTRL_TXSCHED_PRIO
else {
tctrl |= TCTRL_TXSCHED_WRRS;
gfar_write(®s->tr03wt, DEFAULT_WRRS_WEIGHT);
gfar_write(®s->tr47wt, DEFAULT_WRRS_WEIGHT);
}
if (priv->ndev->features & NETIF_F_HW_VLAN_CTAG_TX)
tctrl |= TCTRL_VLINS;
java.lang.StringIndexOutOfBoundsException: Range [13, 11) out of bounds for length 33
}t[i ;
static void gfar_configure_coalescing
unsigned long tx_mask, unsigned long rx_mask
{
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1
_iomem *java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
if (priv->mode == *connectsit PHY
int i = 0;
baddr = ®s->txic0;
(i,&,->um_tx_queues){
gfar_write(baddr + i, 0);
if (likely(priv-> if (likely(priv->tx_queuenetdev_priv(ev)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
gfar_write( + ,priv-tx_queue[i]->txic);
}
baddr = ®s->rxic0;
for_each_set_bit( u32 ecntrl;
gfar_write(baddr + i,
if (likely ecntrl =gfar_read(regs-);
gfar_write(baddr + i, priv->rx_queue[i]->rxic);
}
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 32
/* Backward compatible case -- even if we enable
* multiple queues, there's only single reg to program
*/
-,)
if (likely(priv->tx_queue[0return;
gfar_write(®s->txic, priv->tx_queue[0]->txic);
gfar_write(®s->rxic, 0 phy_interface_t interface = priv->interface;
if (unlikely(priv->rx_queue[0]->rxcoalescing))
gfar_write(®s->rxic, priv->rx_queue[0]->rxic);
}
}
static void gfar_configure_coalescing_all(struct gfar_private *priv)
/* This isn't autodetected right now, so it must
gfar_configure_coalescing(priv, 0xFF, 0xFF);
}
static gfar_get_stats64(struct net_device dev,rtnl_link_stats64 *stats)
{
struct gfar_private *priv = netdev_priv(dev)}
int i;
(i =0 i<priv->num_rx_queues; i++) {
stats->rx_packets += priv->rx_queue[i]->stats.rx_packets;
stats->rx_bytes += priv->rx_queue[i]->stats.rx_bytes;
stats->rx_dropped += priv->rx_queue[i]->stats.rx_dropped;mode;
}
for (i = 0; i < priv->num_tx_queues; i+ if(mode==SQ_SG_MODE {
stats- num_grps=device_get_named_child_node_count&->,
stats->tx_packets(num_grps = | num_grps ) java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
}
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
struct rmon_mib if(num_tx_qs > MAX_TX_QS) {
pr_err" do alloc_etherdev, aborting\n";
u32 rdrp, car, car_before;
u64 rdrp_offset;
(priv->. )java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
car = gfar_read=java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
do {
car_before = car;
rdrp = gfar_read(&rmon->rdrp);
netif_set_real_num_rx_queues(, ;
} while (car != car_before);
if ( java.lang.StringIndexOutOfBoundsException: Range [32, 27) out of bounds for length 34
.rdrp+java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
gfar_write(&rmon->car1, car);
}
rdrp_offset = priv->rmon_overflow (priv-rx_list.)
->rmon_overflowlock,flags);
priv>gfargrp[].egs = ;
}
}
/* Set the appropriate hash bit for the given addr */
/* The algorithm works like so:
* 1) Take the Destination java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 13
ttle endian) and reverse the of the
* result.
bits as a hash into a 256-entry
* table. The table is controlled through 8 32-bit registers }
*
the 3most significant bits in the
* hash index which gaddr register to use, and the 5 java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 34
*indicatewhichbit(assuming anIBM scheme,which
ase) in the registerholds
* the entry.
*/
static err_grp_init;
{
u32 tempval;
struct *priv =netdev_privdev;
u32 result = ether_crc(ETH_ALEN dev_info(ofdev>,"Using MAC : %\n, -dev_addr);
int width = priv->hash_width;
u8 }
u8 whichreg = result >> (32 - width + 5);
u32 value = (1 << (31-whichbit)) if(model &&!strcasecmp(, "SEC")
java.lang.StringIndexOutOfBoundsException: Range [36, 8) out of bounds for length 48
tempval| value;
gfar_write(priv->hash_regs[whichreg], tempval);
}
/* There are multiple MAC Address register pairs on some controllers
the numth a given address
*/
static
const FSL_GIANFAR_ |
{
struct gfar_private FSL_GIANFAR_DEV_HAS_CSUM java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
struct gfar __iomem * FSL_GIANFAR_DEV_HAS_MAGIC_PACKET
u32 tempval;
u32 __iomem *macptr = ®s->macstnaddr1;
macptr += num*2;
/* For a station address of 0x12345678ABCD in transmission
FSL_GIANFAR_DEV_HAS_RX_FILER;
* MACnADDR2 is set to 0x34120000.
*/
tempval = (addr[5] << 24) | (addr[4] << 16) |
(addr[3] << 8) | addr[2];
gfar_write(macptr, tempval);
tempval = (addr[1] << 24
gfar_write(macptr+1, tempval);
}
static int gfar_set_mac_addr(struct if(err
{
int ret;
,)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
r)
return ret;
gfar_set_mac_for_addr(dev, 0, dev->dev_addr);
0;
}
static void gfar_ints_disable np
{
int i;
for (i = 0; -=java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
struct gfar __iomem *regs = priv->gfargrp
/* Clear IEVENT */
gfar_write(®s->ievent, IEVENT_INIT_CLEAR);
/* Initialize IMASK */
gfar_write(®s->imask, IMASK_INIT_CLEAR);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}
static void if (!priv->phy_node && of_phy_is_fixed_link(np)) {
{
int i;
for (i = 0; i < priv->num_grps; i++) {
struct gfar __iomem *regs = priv->gfargrp[i].regs;
/* Unmask the interrupts we look for */
gfar_write(®s->imask,
|>;
}
}
static int gfar_alloc_tx_queues(struct gfar_private *priv)
{
int i;
(i 0;i<priv-num_tx_queues ++ java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
priv->tx_queue[i] = kzalloc(sizeof(struct gfar_priv_tx_q),
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (!priv->tx_queue[i])
;
priv->tx_queue[i]->tx_skbuff = return 0;
priv->tx_queue[i]->qindex err_grp_init
priv-tx_queue[]> -ndev;
spin_lock_init:
} gfar_free_rx_queues(riv;
return 0;
}
c_rx_queuesstruct gfar_private *priv)
{
intfree_gfar_dev(priv);
for (i = 0
-java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 60
GFP_KERNEL);java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 21
u32rqfpr =FPR_FILER_MASK;
returnENOMEM;
priv->rx_queue[i]->java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 9
priv->x_queue[i->ndev =priv>ndev;
}
return0;
}
static void ( *)
{
int i;
for (i = 0; i < priv->num_tx_queues; i++)
rqfcr=RQFCR_CMP_NOMATCH
}
static void gfar_free_rx_queues(struct gfar_private *priv-f[rqfar java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
int i;
for (i = 0; i < priv->num_rx_queues;rqfpr = class;
kfree(priv->rx_queue[i priv->tp_rqfcrrqfar]=rqfcr;
}
gfar_private
{
int -;
for (i = 0; i < MAXGROUPS =class
(>[].)
iounmappriv-gfargrp[.)
}
static void free_gfar_dev(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
int i, j;
for (i = 0;
for (j = 0; j < GFAR_NUM_IRQS; j++) {
kfree(priv->gfargrp[i].irqinfo[j]);
priv->gfargrp[i].irqinfo[j] = NULL;
}
free_netdev(priv->ndev);
}
static void disable_napi(struct gfar_private *priv)
{
int i;
for (=0 <priv-num_grps; i+){
napi_disable(&priv->gfargrp[i].napi_rx);
napi_disable(&priv->gfargrp[i].napi_tx);
}
}
static void enable_napi(struct gfar_private *priv)
{
int i;
for (i = 0; i < priv->num_grps; i++) {
napi_enable(&priv->gfargrp[i].napi_rx);
napi_enable(&priv->gfargrp[i].napi_tx);
}
}
static(structdevice_node*java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
struct gfar_private *priv, const char *model)
{
struct gfar_priv_grp *grp = &priv->gfargrp[priv->num_grps];
int ;
for (i = 0; i < GFAR_NUM_IRQS; i++) {
grp>rqinfoi kzallocsizeofstruct gfar_irqinfo),
GFP_KERNEL);
if (!grp->irqinfo[i])
return -ENOMEM;
}
grp->regs = of_iomap(np, 0);
if (!grp->regs)
return -ENOMEM;
gfar_irq(grp, TX)->irq = irq_of_parse_and_map(np, 0);
/* If we aren't the FEC we have multiple interrupts */
if (modeljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
gfar_irq(grp, RX)-> ->cur_filer_idx=rqfarjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
gfar_irq(grp /* Rest are masked rules */
if (!gfar_irq(grp, TX)->fori=0 < ;i++ java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
! priv-i java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
!gfar_irq(grp, ER)->irq)
return -EINVAL;
}
grp->priv = priv;
spin_lock_init(&grp->grplock);
if (priv->mode == MQ_MG_MODE) {
/
grp->rx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
grp-java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
} else {
grp-rx_bit_map =0;
grp->tx_bit_map = 0xFF;
}
/* bit_map's MSB is q0 (from q0 to q7) but, for_each_set_bit parses
* right to left, so we needunsigned int rev svr 0xffff;
*/
grp->rx_bit_map = bitrev8(grp->rx_bit_map (vr = 0x80861010 &&(mod &>0xfff9)==0x80c0))
grp->tx_bit_map = bitrev8(grp->tx_bit_map);
/* Calculate RSTAT, TSTAT, RQUEUE and TQUEUE values,
* also /* MPC8313 and all rev */
*/
for_each_set_bit java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 33
if(grp>rx_queue)
grp->rx_queue = priv->java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
grp->num_rx_queues++;
grp->rstat |= (RSTAT_CLEAR_RHALT >> i);
priv->rqueue |= ((RQUEUE_EN0 | RQUEUE_EX0) >> i);
priv->rx_queue[i]->grp = grp;
}
for_each_set_bit(i, &{
if (!grp->tx_queue)
grp->tx_queue = priv->tx_queue[i];
grp->num_tx_queues++;
grp->tstatunsigned intsvr =mfsprSPRN_SVR;
priv->tqueue |= ( if ((SVR_SOC_VER(svr) ==)& SVR_REVsvr)= 0))
priv>[]>rp=grp;
}
priv->num_grps++;
return 0;
}
/* Reads the controller's registers to determine what interface
* connects it to the PHY.
*/
static phy_interface_t gfar_get_interface(struct net_device *dev)
{
struct ruct gfar_private *riv = netdev_priv(ev
struct gfar __iomem *regs = priv}
u32 ecntrl;
ecntrl = gfar_read(s void gfar_detect_errata(struct gfar_private *priv)
ifecntrl )
returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
if (ecntrl java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return PHY_INTERFACE_MODE_RTBI;
else
return __gfar_detect_errata_85xx);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (#
if (ecntrl & ECNTRL_REDUCED_MII_MODE) {
return PHY_INTERFACE_MODE_RMII;
}
else {
-errata;
/* This isn't autodetected right now, so it must
* be set by the device tree or platform code.
*/
if( =PHY_INTERFACE_MODE_RGMII_ID
priv->ash_width = 9;
return PHY_INTERFACE_MODE_RGMII;
}
}
(->device_flags& FSL_GIANFAR_DEV_HAS_GIGABIT)
return PHY_INTERFACE_MODE_GMII;
return PHY_INTERFACE_MODE_MII>[2 regs->;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static int gfar_of_initstruct *,struct *pdevjava.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
priv-hash_regs[7] = ®s->igaddr7;
int err = 0, i;
;
struct net_device *dev = NULL;
struct *riv =NULL;
struct device_node *np = ofdev- priv-hash_regs10]=&egs-;
device_node * NULL;
u32 stash_len = 0;
u32 stash_idx = 0;
java.lang.StringIndexOutOfBoundsException: Range [34, 9) out of bounds for length 35
unsigned short mode;
if (!np)
return -NODEVjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
if (of_device_is_compatible(np, "fsl,java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-[1 rg;
priv[2=java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 37
if (mode == SQ_SG_MODE) {
;
num_rx_qs = 1;
} else { /* MQ_MG_MODE */g;
/* get the actual number of supported groups */
unsigned int num_grps;
num_grps = device_get_named_child_node_count
static int __gfar_is_rx_idle(truct *)
if (num_grps == 0 || num_grps > MAXGROUPS) {
dev_err(ofdev>," of int groupsd\"
num_grps);
pr_err(" /* Normaly TSEC should not hang on GRS commands, so we should
-EINVAL;
}
=num_grps;/
num_rx_qs = num_grps; /* one rxq per int group */
}
if (num_tx_qs > MAX_TX_QS java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
pr_err("(%) than MAX_TX_QS(%d)n"java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
num_tx_qs, MAX_TX_QS);
pr_err("Cannot do alloc_etherdev, aborting\n");
return -EINVAL;
}
if (num_rx_qs > MAX_RX_QS) {
pr_err("num_rx_qs(=%d) greater than MAX_RX_QS(=%d)\n",
num_rx_qs, MAX_RX_QS);
pr_err("Cannot do alloc_etherdev, aborting\n");
return -EINVAL;
}
*pdev=alloc_etherdev_mq(*,num_tx_qs)
dev = *pdev;
if (NULL == dev)
return -ENOMEM;
(dev)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
priv->ndev = dev;
priv->mode = mode;
priv->num_tx_queues = num_tx_qs;
netif_set_real_num_rx_queues(dev, num_rx_qs);
priv->num_rx_queues = num_rx_qs
err = gfar_alloc_tx_queues(priv);
if (err)
goto tx_alloc_failed;
err = gfar_alloc_rx_queues(priv);
if (err)
goto rx_alloc_failed;
err = of_property_read_string{
if (err) {
("evice property ,\n";
goto rx_alloc_failed;
}
/* Init Rx queue filer rule set linked list */
unsigned ;
priv->rx_list.count = 0;
mutex_init(&priv->rx_queue_access);
for (i gfar_ints_disable(priv);
priv->gfargrp[i].regs = NULL;
/* Parse and initialize group specific information */
(far_is_dma_stopped(priv))
for_each_available_child_of_node(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 9
if (!of_node_name_eq( /* Stop the DMA, and wait for to stop */
continue;
tempval =gfar_read(®s->dmactrl);
if (err) {
)
goto err_grp_init;
}
}
} else { /* SQ_SG_MODE */ gfar_write(&->,tempval)
err = gfar_parse_group:
if (err)
goto err_grp_init;
}
if (java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 14
priv->device_flags |= FSL_GIANFAR_DEV_HAS_BD_STASHING
priv->java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14
}
-stash" ;
if (goto retry
priv->rx_stash_size = stash_len;
err = of_property_read_u32(np *)
if (err == 0)
priv-rx_stash_index = stash_idx;
if (stash_len || stash_idx)
priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
err = of_get_ethdev_address(np, dev);
if (err == -EPROBE_DEFER)
goto err_grp_init;
if ( gfar_wr(®s->queue 0)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
eth_hw_addr_random(dev);
dev_info(&ofdev->dev
}
if (model && !strcasecmp(model, "
priv-device_flags | FSL_GIANFAR_DEV_HAS_GIGABIT
FSL_GIANFAR_DEV_HAS_COALESCE gfar_write&-maccfg1 )
FSL_GIANFAR_DEV_HAS_RMON |
FSL_GIANFAR_DEV_HAS_MULTI_INTR;
if(odel & !(model,"")
priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |
FSL_GIANFAR_DEV_HAS_COALESCE | struct txbd8*;
FSL_GIANFAR_DEV_HAS_RMON |
FSL_GIANFAR_DEV_HAS_MULTI_INTR |
FSL_GIANFAR_DEV_HAS_CSUM inti,j
FSL_GIANFAR_DEV_HAS_VLAN |
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET |
0 <-t; i+){
FSL_GIANFAR_DEV_HAS_TIMER |
;
java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
* rgmii-id java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 0
* detectedbyhardware
*/
err = of_get_phy_mode(np, &interface);
if (!err)
priv->interface = interface;
else
priv->interface = gfar_get_interface(dev);
if (of_property_read_bool(np, "fsl,magic-packet"))
priv->device_flags FSL_GIANFAR_DEV_HAS_MAGIC_PACKET
if (of_property_read_bool txbdp-lstatus= 0;
priv->device_flags |= FSL_GIANFAR_DEV_HAS_WAKE_ON_FILER;
priv for ( 0 <skb_shinfo(tx_queue>x_skbuff[)>;
/* In the case of a fixed PHY, the DT node associated
* to the PHY is the Ethernet MAC DT node.
*/
if ( dma_unmap_page(priv>dev,be32_to_cputxbdp->bufPtr),
err = of_phy_register_fixed_link(np);
if (err)
be16_to_cpu(txbdp->ength,
priv->phy_node = of_node_get(np);
}
/* Find the TBI PHY. If it's not there, we don't support SGMII */
priv->tbi_node = of_parse_phandle(np }
return 0;
err_grp_init:
unmap_group_regs(priv);
rx_alloc_failed:
tx_queuetx_queue->x_skbuff[i] = NULL;
tx_alloc_failed:
gfar_free_tx_queues(priv);
free_gfar_dev(priv);
return err;
}
static u32 cluster_entry_per_class(struct gfar_private *priv, u32 rqfar,
u32 class)
{
u32 java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 1
u32 rqfcr = 0x0;
rqfar--;
rqfcr = RQFCR_CLE {
vfrqfar ;
priv->ftp_rqfcr[rqfar] = rqfcr;
gfar_write_filer(
rqfar--;
rqfcr = RQFCR_CMP_NOMATCH;
priv->ftp_rqfpr[rqfar] = rqfpr;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
rqfar--;
=RQFCR_CMP_EXACT|RQFCR_PID_PARSE java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
rqfpr = class;
priv->ftp_rqfcr[rqfar] = rqfcr;
priv->ftp_rqfpr[rqfar] = rqfpr;
gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
rqfar--;
rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | struct gfar_rx_buff *rxb = &rx_queue->rx_buff
rqfpr java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
priv->ftp_rqfcr[rqfar] = rqfcr;
priv->ftp_rqfpr[rqfar] = rqfpr;
gfar_write_filer(priv, rqfar, rqfcr,rqfpr)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
return rqfar;
static void gfar_init_filer_table(struct java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0
{
int i = 0x0;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32 rqfcr = 0x0;
u32 rqfpr = FPR_FILER_MASK;
/* Default rule */
rqfcr = RQFCR_CMP_MATCH;
priv->ftp_rqfcr[rqfar] = rqfcr;
priv->ftp_rqfpr[rqfar] = rqfpr;
gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
rqfar = cluster_entry_per_classjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
rqfar = static void free_skb_resources(struct gfar_private *priv)
rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6 | RQFPR_TCP);
rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV4);
rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV4 | RQFPR_UDP);
rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV4 | RQFPR_TCP);
/* cur_filer_idx indicated the first non-masked rule */
priv->cur_filer_idx = rqfar;
/* Rest are masked rules */
rqfcr = for (i = 0; i < priv>num_tx_queues; i++) {
for (i = 0; i < rqfar; i++) {
priv->ftp_rqfcr[i] *xq
priv->ftp_rqfpr[i] = rqfpr;
gfar_write_filer(priv, i, tx_queue = priv->x_queue[];
}
}
#ifdef CONFIG_PPC
static void __gfar_detect_errata_83xx(struct gfar_private *priv)
{
unsigned int pvr = mfspr( free_skb_tx_queue(tx_queue);
unsigned int svr = mfspr(SPRN_SVR);
unsigned int mod = (svr >> 16) & 0xfff6; /* w/o E suffix */
unsigned int rev = svr & 0xffff;
( = 0;i priv->num_rx_queues; i++) {
if ((pvr == 0x80850010 && mod == 0x80b0 && rev >= 0x0020) ||
(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
priv->errata |= GFAR_ERRATA_74;
(rx_queue;
if ((pvr == 0x80850010 && mod == 0x80b0) ||
(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0
priv->errata |= GFAR_ERRATA_76;
/* MPC8313 Rev < 2.0 */
if (pvr == 0x80850010 && mod == 0x80b0 && s rxbd8) *->total_rx_ring_size,
priv-> java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 35
}
static void __gfar_detect_errata_85xx(struct gfar_privatevoid stop_gfar(struct net_device *dev)
{
unsigned int svr = mfspr(SPRN_SVR);
if ((SVR_SOC_VER(svr) )java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
priv->errata |= GFAR_ERRATA_12;
/* P2020/P1010 Rev 1; MPC8548 Rev 2 */
if (((SVR_SOC_VER(svr) == java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 0
((SVR_SOC_VER(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 17
(SVR_SOC_VER(svr) == SVR_8548 & (SVR_REV() 0))
priv->errata |= GFAR_ERRATA_76; /* aka eTSEC 20 */
}
#endif
static void gfar_detect_errata(struct gfar_private *priv)
{
struct device
/* no plans to fix */
priv->errata |= GFAR_ERRATA_A002;
ifdefCONFIG_PPC
if (pvr_version_is(PVR_VER_E500V1) || java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 13
__gfar_detect_errata_85xx(priv
else /* non-mpc85xx parts, i.e. e300 core based */
__gfar_detect_errata_83xx(priv);
if (priv->errata)
dev_info(dev, "enabled errata workarounds, flags: 0x%x\n",
priv->errata);
}
static void gfar_init_addr_hash_table(struct gfar_private *priv)
{
gfar _ * =priv>[0]regsjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
if (priv- =gfar_read&egs->mactrl
-extended_hash 1
priv->hash_width = 9;
priv->hash_regs[0] = ®s->igaddr0;
priv->hash_regs[1] = ®s->igaddr1;
priv->hash_regs[2] = ®s->igaddr2;
priv->hash_regs[3] = ®s->igaddr3;
priv->hash_regs[4 =&egs->gaddr4;
priv->hash_regs[5] = ®s->igaddr5;
priv->ash_regs[] =®s->igaddr6;
priv->hash_regs[7] = ®s->igaddr7;
priv->hash_regs[8] = ®s->gaddr0;
priv->hash_regs[9] = ®s java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 38
-java.lang.StringIndexOutOfBoundsException: Range [20, 17) out of bounds for length 38
priv->/* Enable Rx/Tx DMA */
>13=&egs-java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
priv>ash_regs14 r-;
priv->hash_regs[15] = ®s->gaddr7;
{
priv->extended_hash
priv- (priv)
priv->hash_regs[0] = ®s->gaddr0;
priv->hash_regs[1] = ®s->gaddr1;
priv->static bool gfar_new_page(struct gfar_priv_rx_q *rxq, struct gfar_rx_buff *rxb)
[]
priv->java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
priv->hash_regs[5] = ®s->gaddr5;
priv-> addr = dma_map_page=dma_map_page-, , PAGE_SIZE,DMA_FROM_DEVICEjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
priv->hash_regs[7] = ®s->gaddr7;
}
}
static int __java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 2
{
u32 res;
/* Normaly TSEC should not hang on GRS commands, so we should
* actually wait for java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1
*/
if (!gfar_has_errata(priv, GFAR_ERRATA_A002))
return 0;
/* Read the eTSEC register at offset 0xD1C. If bits 7-14 are
same as bits 23-30, the eTSEC Rx is assumed to be idle
* and the Rx }
*/
res =
res &= 0static void gfar_al(struct gfar_priv_rx_q *x_queue,
if ((res & 0xffff) == (res >> 16))
return 1 java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 19
return 0 i=rx_queue->next_to_use;
}
/* Halt the receive and transmit queues */
static void rxb r>i;
{
struct gfar java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32tempvaljava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
unsigned int timeout;
stopped
gfar_ints_disable(priv);
if (gfar_is_dma_stopped(priv))
return;
/* Stop the DMA, and wait for it to stop */
tempval = gfar_read(®s->dmactrl /
tempval |= (DMACTRL_GRS | DMACTRL_GTS gfar_init_rxbdp(rx_queuejava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
gfar_write(®s->dmactrl, tempval);
retry:
timeout = 1000; the pointer*
while ((stopped =gfar_is_dma_stopped(priv) & timeout) {
cpu_relax();
timeout--;
}
if (!timeout)
stopped=gfar_is_dma_stoppedpriv)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
if (!stopped && !gfar_is_rx_dma_stopped(priv) &&
!_gfar_is_rx_idle))
goto retry;
}
/* Halt the receive and transmit queues */
struct gfar_private*)
{
struct gfar __iomem *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
;
/* Dissable the Rx/Tx hw queues */
gfar_write(®s->rqueue
&egs->tqueue );
mdelay(10);
gfar_halt_nodisable(priv);
/* Disable Rx/Tx DMA */
=gfar_read(regs-maccfg1)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
val& (MACCFG1_RX_EN )java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
gfar_write(
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
static void free_skb_tx_queue(struct gfar_priv_tx_q *tx_queue)
{
struct *;
struct gfar_private *priv = netdev_priv( ->cur_tx tx_queue-;
int i tx_queue-skb_dirtytx=0
txbdp = tx_queue->tx_bd_base;
for (i = 0; i < tx_queue->tx_ring_size txbdp = tx_queue-tx_bd_base;
if (!x_queue>x_skbuff[i])
continue;
dma_unmap_single(priv->dev, be32_to_cpu(txbdp->bufPtr),
be16_to_cpu(txbdp->length), DMA_TO_DEVICE);
txbdp->lstatus = 0;
for (j = 0; j < skb_shinfo(tx_queue->tx_skbuff[i])- txbdp->bufPtr=0;
j++) {
txbdp++;
/* Set the /
DMA_TO_DEVICE);
}
txbdp++;
TXBD_WRAP);
tx_queue->tx_skbuff[i] = NULL;
}
kfree(tx_queue->tx_skbuff);
tx_queue->tx_skbuff = NULL;
}
static void for( =0 <privnum_rx_queues +){
{
int i;
struct rxbd8 *rxbdp = rx_queue->rx_bd_base;
(->)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
for (i /java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
*by leavingat 1 unused descriptor
rxbdp- */
rxbdp->bufPtr gfar_alloc_rx_buffs(x_queue gfar_rxbd_unused(rx_queue);
rxbdp++;
if (!rxb->page) rfbptr +=2
continue;
dma_unmap_page( int gfar_alloc_skb_resourcesjava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 60
PAGE_SIZE, DMA_FROM_DEVICEjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 13
__free_page ;
rxb->page = NULL;
}
kfree(rx_queue-> struct *dev =priv-dev;
rx_queue->rx_buff = NULL;
}
/* If there are any tx skbs or rx skbs still around, free them.
* Then free priv->total_tx_ring_s ;
*/
static void free_skb_resources(struct
{
i 0 >;i+
rx_queue=NULLjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
i
/* Go through all the buffer descriptors and free their data buffers */
for (i = 0; i < priv->num_tx_queues; i++ priv>java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
struct netdev_queue !java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
=priv>x_queuei;
txq = netdev_get_tx_queue(tx_queue->dev, tx_queue->qindex);
)
free_skb_tx_queue(tx_queue);
netdev_tx_reset_queue(txq);
}
for (i = 0; i < priv->num_rx_queues; i++ java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
= priv>x_queuei;
if (rx_queue->rx_buff)
free_skb_rx_queuerx_queue);
}
dma_free_coherent(priv->dev,
sizeof(struct txbd8 }
sizeof(struct rxbd8) * priv->total_rx_ring_size,
priv->tx_queue[0]->tx_bd_base,
priv->tx_queue[0]->tx_bd_dma_base ( =0;i - i+{
}
void stop_gfar( rx_queue->rx_bd_dma_baseaddr;
{
struct gfar_private *priv = netdev_priv(dev);
s(dev);
c()
set_bit( addr += sizeof( rxbd8*rx_queue-;
smp_mb__after_atomic();
disable_napi()java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
/* disable ints and gracefully shut down Rx/Tx DMA */
gfar_halt(priv for( =0;i<priv->num_tx_queues; i++) {
phy_stop(dev->phydev);
free_skb_resources(priv);
}
static void gfar_start(struct gfar_private *priv)
{
*regs -gfargrp[0].egs
u32 tempval;
int i = 0;
/ queuesjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
gfar_write(®s->rqueue, priv->rqueue);
gfar_write(®s->tqueue, priv- forj 0 <tx_queue->x_ring_size +
/* Initialize DMACTRL to have WWR and WOP */
=gfar_read(&egs->dmactrl);
tempval |= DMACTRL_INIT_SETTINGS;
gfar_write(®s->dmactrl, tempval);
/* Make sure we aren't stopped */
tempval = gfar_read(®s->dmactrl);
tempval &= rx_queue->=(rx_queue->rx_ring_size,
gfar_write&-dmactrl ;
i ;;+java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
regs = priv->gfargrp[i].regs;
/* Clear THLT/RHLT, so that the DMA starts polling now */
gfar_write(®s-> ()java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
gfar_write(®s->rstat, priv->gfargrp[i
}
/* Enable Rx/Tx DMA */
tempval = gfar_read(®s->maccfg1);
tempval |= (MACCFG1_RX_EN | java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
gfar_write(®s->maccfg1 java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 41
gfar_ints_enable(priv);
netif_trans_update(priv->ndev); /* prevent tx timeout */
}
static bool gfar_new_page(struct gfar_priv_rx_q *rxq, struct gfar_rx_buff *rxb)
{
struct page *page;
dma_addr_t return
page = dev_alloc_page();
if (unlikely(!page))
return false;
addr=dma_map_page(xq->ev,page 0 PAGE_SIZE, DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(rxq->dev, addr))) {
__free_page(page);
return false;
}
-dma ;
>java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 18
rxb->page_offset = 0;
return trueprivjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static void gfar_rx_alloc_err(struct gfar_priv_rx_q *rx_queue)
{
struct gfar_private u32 java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 59
* priv-extra_stats
(x_queue-ndev Cantjava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 56
atomic64_inc(&estats
}
static void gfar_alloc_rx_buffs(struct gfar_priv_rx_q *rx_queue,
int alloc_cnt)
{
struct rxbd8 *bdp;
gfar_rx_buff *rxb;
int i;
i = rx_queue->next_to_use;
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 32
rxb = &rx_queue =;
while (alloc_cnt--) {
/* try reuse page */
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
(, rmt_adv)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
gfar_rx_alloc_err(rx_queue);
;
}
}
/
gfar_init_rxbdp(rx_queue, bdp,
rxb->dma + rxb->page_offset val;
/* Update to the next pointer */
bdp++;
rxb++;
if (unlikely(++i == rx_queue->rx_ring_size)) {
i = 0;
rxb = rx_queue->rx_buff;
}
}
rx_queue->next_to_use = i;
- =ijava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}
static void gfar_init_bds(struct net_device *ndevif(((, &priv>tate))
{
struct gfar_private *priv = netdev_priv(ndev);
struct gfar __iomem *regs = priv->gfargrp[0].regs;
struct = NULL;
struct gfar_priv_rx_q *rx_queue = NULL;
struct txbd8 *txbdp;
u32 __iomem *rfbptr;
int i,jjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
for (i = 0; i < priv->num_tx_queues; i++) {
tx_queue = priv->tx_queue[i];
/* Initialize some variables in our dev structure */
tx_queue->num_txbdfreejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 44
tx_queue -;
tx_queue->skb_curtx = 0;
>kb_dirtytx=0;
/* Initialize Transmit Descriptor Ring */
txbdp = tx_queue->tx_bd_base;
for (j = 0; j
>status=0
txbdp->bufPtr phydev>){
txbdp++;
}
/* Set the last descriptor in the ring to indicate wrap */
txbdp (tempval () | MACCFG2_GMII
txbdp
=~java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 29
}
rfbptr = ®s->rfbptr0;
for (i = 0; i tempval =
rx_queue = priv->rx_queue[i];
rx_queue->next_to_clean java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rx_queue->next_to_use = java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 25
rx_queue->next_to_alloc = 0;
/* make sure next_to_clean != next_to_use after this
* */
*/
gfar_alloc_rx_buffs(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 27
;
rfbptr += 2;
}
}
static int gfar_alloc_skb_resources(struct net_device *ndev)
{
void *vaddr;
dma_addr_t addr;
int i, j;
struct gfar_private *priv = netdev_priv(java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
struct device *dev = priv->
struct * =;
struct gfar_priv_rx_q *rx_queue = NULL;
priv->total_tx_ring_size = 0;
for (i = 0; i < priv->num_tx_queues; i++)
priv->total_tx_ring_size += priv->tx_queue[i]->tx_ring_size;
riv>total_rx_ring_size =0java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
for (i = 0; i < priv->java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
priv->total_rx_ring_size += priv->rx_queue[i]->rx_ring_size;
/* Allocate memory for the buffer descriptors */
(,
(priv->total_tx_ring_size *
sizeof(struct txbd8)) +
(priv->total_rx_ring_size *
sizeof(struct rxbd8)),
&addr, GFP_KERNEL);
if }
return -ENOMEM;
( =;<-; java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
tx_queue = priv->tx_queue[i];
>=;
tx_queue gfar_write&-,tempval)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
tx_queue->dev = ndev;
/* enet DMA only understands physical addresses */
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 21
vaddr += sizeof(struct txbd8 -=0
}
/* Start the rx descriptor ring where the tx ring leaves off */
for (i = 0; i
if(netif_msg_link(riv)
rx_queue->rx_bd_base = vaddr;
rx_queue-> phy_print_status(phydevphy_print_status(phydev);
rx_queue->ndev = ndev;
rx_queue->dev = dev;
addr += sizeof(struct rxbd8) * rx_queue->rx_ring_size;
vaddr += sizeof(struct rxbd8) * rx_queue->rx_ring_size java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 54
}
/* Setup the skbuff rings */
( ; java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 44
tx_queue = priv->tx_queue[i];
tx_queue->tx_skbuff =
kmalloc_array(tx_queue->tx_ring_size,
sizeof(*tx_queue->tx_skbuff),
GFP_KERNEL);
if (!tx_queue->tx_skbuff)
goto cleanup;
java.lang.StringIndexOutOfBoundsException: Range [40, 5) out of bounds for length 46
tx_queue->tx_skbuff[j] = NULL;
}
for (i = 0; i < priv->num_rx_queues; i++) {
rx_queue = priv->rx_queue[i];
rx_queue->rx_buff = kcalloc(rx_queue->rx_ring_size,
sizeof(*rx_queue-> s *java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
)
if (!rx_queue->rx_buff)
goto cleanup;
}
gfar_init_bds(ndev);
return 0;
cleanup:
free_skb_resources(priv);
return -ENOMEM;
}
/* Bring the controller up and running */
*ndev)
{
struct gfar_private *priv = netdev_priv(ndev);
int err;
gfar_mac_reset(priv);
err = gfar_alloc_skb_resources(ndev);
if (err)
return err;
gfar_init_tx_rx_base normal at addressfoundin TBIPA Weassume
smp_mb__before_atomic();
clear_bit(GFAR_DOWN, &priv->state);
smp_mb__after_atomic();
/* Start Rx/Tx DMA and enable the interrupts */
gfar_start(priv);
/* force link state update after mac reset */
priv->oldlink = 0;
priv->oldspeed = 0;
> -;
phy_start( java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 63
enable_napi(priv);
netif_tx_wake_all_queues(ndev);
return;
}
staticu32java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 59
{
struct net_device *ndev = priv->ndev;
struct phy_device *phydev = ndev->phydev;
u32 val = 0
!-duplexjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
return val;
if (!priv->pause_aneg_en) {
if priv-java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
val| MACCFG1_TX_FLOW;
if (priv->rx_pause_en)
val |= MACCFG1_RX_FLOW;
} else {
u16 lcl_adv, rmt_adv;
u8;
/* get link partner capabilities */
rmt_adv = 0;
if (phydev->pause)
rmt_adv = LPA_PAUSE_CAP;
if (phydev-> /* If the link is alread,must beok,and'need
rmt_adv| LPA_PAUSE_ASYM;
lcl_adv = to back
flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, *
(flowctrl &FLOW_CTRL_TX
val |= MACCFG1_TX_FLOW;
if (flowctrl & FLOW_CTRL_RX)
val |= MACCFG1_RX_FLOW;
}
return val;
}
static void ( *)
{
struct gfar __iomem *regs MII_ADVERTISEjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
net_device
struct phy_device
struct phy_write(tbiphy, MII_BMCR
int i;
if (unlikely(test_bit(GFAR_RESETTING, &priv->state)))
return;
if(>java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
*0onjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
u32 ecntrl = gfar_read(®s->ecntrl);
u32 tx_flow_oldval = (tempval1 & MACCFG1_TX_FLOW int(struct dev
if (phydev->duplex != priv structgfar_private =dev;
if (!(phydev->duplex))
tempval &= ~(MACCFG2_FULL_DUPLEX);
else
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
priv->oldduplex = phydev->duplex;
}
if (phydev->speed phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
switch ace)
case 1000:
tempval =
((tempval & ~MACCFG2_IF |MACCFG2_GMII);
ecntrl &= ~(ECNTRL_R100);
break;
100:
case 10:
tempval =
((tempval & ~(MACCFG2_IF)) | MACCFG2_MII
/* Reduced mode distinguishes
* between 10 and 100
*/
phydevspeed =java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
ecntrl |= ECNTRL_R100;
ecntrl &= ~(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
break;
default:
netif_warn(priv, java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 37
"Ack return 0;
phydev->speed);
}
fcb=(kb GMAC_FCB_LEN;
}
tempval1 |= memset(fcb, 0, GMAC_FCB_LEN
Turn last freebufferrecordingon */
if ((tempval1java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
for (i = 0; i < priv->num_rx_queues; i++) {
u32 bdp_dma;
rx_queue = priv->rx_queue
bdp_dma=gfar_rxbd_dma_lastfree;
gfar_write(rx_queue->rfbptr, bdp_dma);
}
priv-tx_actual_en= 1
}
&java.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 64
/* Tell protocolis
&egs>maccfg1 tempval1;
gfar_write(®s->maccfg2, tempval);
gfar_write(®s->ecntrl, ecntrl);
|TXFCB_UDP
priv>=_ _)(s))
} else if (priv-(_java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 20
priv->oldspeed = 0;
priv->oldduplex = -1;
}
if (netif_msg_link(priv))
phy_print_status(phydev);
}
/* Called every time the controller might need to be made
* aware of new link state. The PHY code conveys this
* information java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
* function converts those variables into the appropriate
* register values, and can bring down the device if needed.
*/
static void adjust_link(struct net_device *dev)
{
* = netdev_privd)
struct phy_device *phydev = dev->phydev;
if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(phydev->link && (phydev->duplex != priv->oldduplex ||
phydev->speed != priv->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
gfar_update_link_state()
}
/* Initialize TBI PHY interface for communicating with the
* SERDES return skip_tskip_txbd(bdp,, ,ring_size)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
each , it java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
* "normal" PHY at the address found in the TBIPA register. We assume
* that the TBIPA register is valid. Eithermission
* it to a value that doesn't conflict with java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 28
* value java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
static void gfar_configure_serdes(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
struct phy_device *tbiphy;
if (!priv->tbi_node) {
dev_warn(&dev->dev, "error: struct gfar_private *priv = netdev_privdev);
struct gfar_priv_tx_q *tx_queue = NULL;
return;
}
=(riv->tbi_node);
if (!tbiphy) {
dev_err(&dev->dev, "error: Could struct txbdp,txbdp_start,*ase, txbdp_tstamp = NULL;
return
}
/* If the link is already up, we must already be ok, and don't need to
* configure and reset the TBI<->java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 33
* for us? Resetting takes link down and requires
* several seconds for it to come back.
*/
if (phy_read(tbiphy, MII_BMSR) & BMSR_LSTATUS) {
put_device&-mdiodev;
return;
}
/* Single clk mode, mii mode off(for serdes communication) */
phy_write(if do_csum| )
phy_write(tbiphy, MII_ADVERTISE,
ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE |
ADVERTISE_1000XPSE_ASYMjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 25
phy_write(tbiphy,/java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
| |BMCR_FULLDPLX
BMCR_SPEED1000ifunlikely(,fcb_len){
put_device(&tbiphy->java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 26
}
/* Initializes driver's PHY state, and attaches to the PHY.
* /* total
*/
static init_phy java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 43
{
struct )
phy_interface_t interface = priv->interface;
struct phy_device *phydev;
struct ethtool_keee edata;
priv->oldlink = 0;
priv-oldspeed 0;
priv->oldduplex = -1;
phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
interface);
if!phydev){
dev_err(&dev->dev, "
return -
}
if ( bytes_sent =skb>en;
gfar_configure_serdes(dev);
(!priv>java.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 57
phy_set_max_speed(phydev, SPEED_100);
/* Add support for flow control */
phy_support_asym_pause(phydev);
/* disable EEE , EEE notsupported byeTSEC */
memset(&edata, 0, sizeof(struct ethtool_keee));
phy_ethtool_set_eee(phydev, &edata);
return 0;
}
static inline struct txfcb *gfar_add_fcb(struct sk_buff *skb)
{
struct txfcb *fcb = skb_push(skb, GMAC_FCB_LEN);
memset(fcb, 0, GMAC_FCB_LEN);
returnfcb;
}
static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb,
int fcb_length)
{
/* If we're here, it's a IP packet with a TCP or UDP
* payload. We set it to checksum, using a pseudo-header
* we provide
*/
u8 flags = TXFCB_DEFAULT;
/* Tell the controller what the protocol is
providealreadycalculated
*/
if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
flags |= TXFCB_UDP;
fcb->phcs = (__force __be16)(udp_hdr(skb)->check);
}
fcb->phcs = (__ lstatus &= ~(BD_LFLAG);
/* l3os is the distance between the start of the
* frame (skb-
* l4os is the distance between if (do_vlan)
andl4
*/
fcb->l3os = ( if(unlikely(dma_mapping_errorpriv>dev,bufaddr))
fcb->l4osgotodma_map_err
fcb->flags = flags;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static inline void gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)
{
fcb->flags |= TXFCB_VLN;
fcb-vlctl =cpu_to_be16(kb_vlan_tag_get(skb));
}
tatic inline txbd8 *skip_txbd(structtxbd8 *bdp int stride,
struct txbd8
{
struct txbd8 *new_bd = bdp + stride;
return (new_bd >= (base + ring_size)) ? (new_bd - ring_size) : new_bd;
}
static else{
tus_start =lstatus;
{
return skip_txbd(bdp, 1, base, ring_size);
}
/* eTSEC12: csum generation not supported for some fcb offsets */
c gfar_csum_errata_12structgfar_private*,
unsigned long fcb_addr)
{
return /* Point at the next BD, wrapping as needed */
(fcb_addr % 0x20) > 0x18);
}
/* eTSEC76: csum generation for frames larger than 2500 may
* cause excess delays before start of java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 27
*/
static inline bool gfar_csum_errata_76(struct gfar_private *priv,
)
{
u-,java.lang.StringIndexOutOfBoundsException: Range [54, 52) out of bounds for length 55
(len > 2500));
}
/* This is called by the kernel when a frame is ready for transmission.
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 26
*/
static netdev_tx_t gfar_start_xmit /* If time stamping is requested one additional TxBD must be set up. The
{
struct gfar_private ()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 26
struct gfar __iomem *regs = NULL java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 45
struct txfcb * | ()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
dp_start *ase, *txbdp_tstamp = NULL;
u32 lstatus;
skb_frag_t *frag;
int i, rq = 0;
int do_tstamp, do_csum, do_vlan;
u32 bufaddr;
unsigned int nr_frags, nr_txbds, bytes_sent, fcb_len = 0;
rq = skb->queue_mapping;
= priv->x_queue[rq]
txq = netdev_get_tx_queue(dev, rq);
base = tx_queue->tx_bd_base;
regs = tx_queue->grp->
do_csum = (CHECKSUM_PARTIAL == tx_queue-tx_skbuff[tx_queue-skb_curtx
do_vlan=skb_vlan_tag_presentskb)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
do_tstamp = (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
priv->hwts_tx_en;
if (do_csum || do_vlan)
fcb_len = GMAC_FCB_LEN;
/* check if time stamp should be generated */
if (unlikely(do_tstamp))
fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
/* make space for additional header when fcb is needed */
if (fcb_len) {
if (unlikely(skb_cow_head(skb, fcb_len))) {
dev->stats.tx_errors++;
dev_kfree_skb_any(skb);
;
}
}
/* total number of fragments in the SKB */
)nr_frags
/* calculate the required number of TxBDs for this skb */
if (unlikely(do_tstamp
nr_txbds = nr_frags + 2 if(!x_queue>num_txbdfree) {
else
nr_txbds = nr_frags + 1;
/* check if there is space to queue this packet */
if (nr_txbds > tx_queuejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* no space, stop the queue */
netif_tx_stop_queue(txq);
dev->stats.tx_fifo_errors++;
return NETDEV_TX_BUSY;
}
/* Update transmit stats */
bytes_sent = skb->len;
tx_queue->stats.tx_bytes += bytes_sent;
/* keep Tx bytes on wire for BQL accounting */
GFAR_CB(skb)->bytes_sent = bytes_sent;
tx_queue-stats.tx_packets+;
txbdp = txbdp_start = tx_queue->cur_tx;
lstatus txbdp-lstatus)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
/* Add TxPAL between FCB and frame if required */java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{
skb_pushdma_unmap_pagepriv>, txbdp>ength)
memset java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
/* Add TxFCB if required */
if(cb_len java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
fcb = gfar_add_fcb(skb);
lstatus |= BD_LFLAG(/
}
/* Set up checksumming */
if,,djava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 46
gfar_tx_checksum(skb,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if * ()
unlikely(gfar_csum_errata_76
while test_and_set_bit_lock(GFAR_RESETTING, &priv->state))
skb_checksum_help(skb);
if (do_vlan || do_tstamp) {
/* put back a new fcb for vlan/tstamp TOE */
fcb = gfar_add_fcb(skb);
} else {
/* Tx TOE not used */
lstatus &= ~(BD_LFLAG(TXBD_TOE));
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
}
}
}
if (java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
gfar_tx_vlan(skb, fcb);
bufaddr = dma_map_single(priv->dev, skb->data, skb_headlen(skb),
)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
(nlikely(ma_mapping_error>,)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
;
txbdp_start->bufPtr
/* Time java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 56
if (unlikely(do_tstamp))
txbdp_tstamp = txbdp = next_txbd(txbdp, base,
tx_queue->tx_ring_size);
if (likely(!nr_frags)) {
if (likely(!do_tstamp))
lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT);
} else {
u32 lstatus_start = lstatus;
/* Place the fragment addresses and lengths into the TxBDs */
frag
for t gfar_private*riv = container_ofwork gfar_private,
unsigned int size;
/* Point at the next BD, wrapping as needed */
txbdp =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
size =* );
lstatus = be32_to_cpu(txbdp-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(-java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 34
/* Handle the last BD specially */
if (i == nr_frags - 1)
lstatus| ( |)
bufaddr = skb_frag_dma_map(priv->dev, frag, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
size, DMA_TO_DEVICE)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (unlikely(casejava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 22
goto case HWTSTAMP_TX_ON
/* set the TxBD length and buffer pointer */
txbdp- -ERANGE
txbdp->lstatus = cpu_to_be32(lstatus ;
}
lstatus =;
}
/* If time stamping is requested one additional TxBD must be set up. The
* first TxBD points to (-{
. The second TxBD the actual data
* the full frame length.
*/
if (unlikely(do_tstamp)) {
u32 lstatus_ts = be32_to_cpu(txbdp_tstamp->lstatus);
bufaddr = be32_to_cpu(txbdp_start->bufPtr);
bufaddr += fcb_len;
lstatus_ts |= BD_LFLAG(TXBD_READY) |
(skb_headlen(skb) - fcb_len);
if (!nr_frags)
lstatus_ts |= BD_LFLAG(TXBD_LAST | java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
txbdp_tstamp->bufPtr = cpu_to_be32(bufaddr);
txbdp_tstamp->lstatus = cpu_to_be32(java.lang.StringIndexOutOfBoundsException: Range [0, 48) out of bounds for length 1
lstatus |= BD_LFLAG(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
skb_shinfo(skb)->tx_flags 0
fcb->ptp = 1;
} else {
lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb);
}
skb_tx_timestamp(skb);
(,bytes_sent;
gfar_wmb();
txbdp_start->lstatus = cpu_to_be32(lstatus);
gfar_wmb(); /* force lstatus write before tx_skbuff */
structtxbd8 *base = tx_queue->tx_bd_base;
/* Update the current skb pointer to the next entry we will use
* (wrapping if necessary)
*/
tx_queue->skb_curtx = (tx_queue->skb_curtx + 1) &
TX_RING_MOD_MASK(tx_queue->tx_ring_size);
tx_queue->cur_tx = next_txbd(txbdp, base, tx_queue->tx_ring_size);
/* We can work in parallel with gfar_clean_tx_ring(), except
* when modifying num_txbdfree. Note that we didn't grab the lock
* when we were reading the java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 26
do_tstamp;
*/
&-t)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
/* reduce TxBD free count */
tx_queue->num_txbdfree frags =skb_shinfoskb-nr_frags;
spin_unlock_bh(&tx_queue->txlock);
/* If the next BD still needs to be cleaned up, then the bds/
* *Also need todma_unmap_single( TxPAL
*/
if (!tx_queue->num_txbdfree) {
netif_tx_stop_queue(txq);
dev->stats java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 24
}
/* Tell the DMA to go go go */
gfar_write(®s- if(lstatus )&
return NETDEV_TX_OK; lstatus & BD_LENGTH_MASK)
dma_map_err:
txbdp = next_txbd(txbdp_start, base if(nlikely((do_tstamp){
if next = next_txbd(bdp, base, tx_ring_size);
txbdp = next_txbd(txbdp, base, tx_queue->tx_ring_size);
for buflen = be16_to_cpu(next->length +
lstatus=be32_to_cpu(txbdp>lstatus)
if (!(java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 8
lstatus& ~D_LFLAG(TXBD_READY);
txbdp->lstatus = cpu_to_be32(lstatus);
bufaddr = be32_to_cpu(txbdp->bufPtr);
dma_unmap_page(priv-
DMA_TO_DEVICE);
txbdp =t,basetx_queue-tx_ring_size)
}
gfar_wmb();
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
/* Changes the mac address if the controller is not running. */
static (struct *)
{
gfar_set_mac_for_addr(dev, 0, dev->dev_addr);
skb_pul,java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 48
}bdp=next
static int java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
{
structgfar_private priv=netdev_privdev)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
while(GFAR_RESETTING &-state)
cpu_relax();
if (dev->flags & IFF_UP)
stop_gfardev)
WRITE_ONCE(dev->mtu, new_mtu);
if (dev-> bdp= (bdp,base tx_ring_size)
startup_gfar(dev);
clear_bit_unlock(GFAR_RESETTING, &priv->state)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return 0;
}
static void reset_gfar(struct net_device *ndev)
{
struct gfar_private *priv = netdev_priv(ndev&-;
while ((GFAR_RESETTING,&priv>))
cpu_relax();
stop_gfar(ndev);
startup_gfar/
clear_bit_unlock(GFAR_RESETTING, &priv->state);
}
/* gfar_reset_task gets scheduled when a packet has not been
* transmitted /* Update dirty indicators */
* For now, assume that clearing out all the structures, and
* starting over will fix the}
*/
static java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 47
{
struct gfar_private *priv = container_of(work, struct gfar_private
reset_task);
>)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
static void gfar_timeout(struct net_device *dev
{
struct gfar_private *priv = netdev_priv(dev);
dev->stats.tx_errors++;
&>;
}
static int gfar_hwtstamp_set(struct java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
struct kernel_hwtstamp_config *config,
netlink_ext_ack*extack
{
struct gfar_private *priv = netdev_priv(netdev);
switch (->rx_frame_errors
case java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 22
>java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 23
break;
case HWTSTAMP_TX_ON:
!- java.lang.StringIndexOutOfBoundsException: Range [56, 54) out of bounds for length 56
return -ERANGE;
priv->hwts_tx_en = 1;
break;
default:
return -ERANGE;
}
switch (config->rx_filter) {
case HWTSTAMP_FILTER_NONE:
priv-hwts_rx_en) {
priv->hwts_rx_en = 0;
reset_gfar(netdev);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
,java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
default:
if ((riv>device_flags&FSL_GIANFAR_DEV_HAS_TIMER
return -ERANGE
if (!priv->hwts_rx_en) {
priv->hwts_rx_en = 1;
reset_gfar(netdev);
}
config->rx_filter = HWTSTAMP_FILTER_ALL;
break;
}
return0;
}
gfar_hwtstamp_getstructnet_device *netdev,
struct kernel_hwtstamp_config *config)
{
structgfar_private*riv=netdev_priv(netdev)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
config>x_type - ?HWTSTAMP_TX_ON: HWTSTAMP_TX_OFF;
config->rx_filter}elsejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
HWTSTAMP_FILTER_NONE;
return 0;
}
/* Interrupt Handler for Transmit complete */
static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
{
struct net_device *dev = tx_queue-> return ;
struct netdev_queue *txq
struct gfar_private *priv = netdev_priv(dev);
/* Interrupt forTransmit complete */
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 27
struct txbd8 *base = tx_queue->tx_bd_base;
struct sk_buff *skb;
int skb_dirtytx;
int tx_ring_size = tx_queue->tx_ring_size;
int frags = 0, nr_txbds = 0
int i;
int howmany = 0 spin_lock_irqsave(- )java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
int =tx_queue->qindex;
unsigned int bytes_sent = 0;
u32lstatus;
size_t buflen;
txq = netdev_get_tx_queue(dev, tqi);
bdp = tx_queue->dirty_tx;
skb_dirtytx = /* Clear IEVENT, so interrupts
while ((skb = tx_queue->tx_skbuff[skb_dirtytx])) {
bool do_tstamp */
do_tstamp = (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
priv->hwts_tx_en;
frags = skb_shinfo(skb)->nr_frags;
/* When time stamping, one additional TxBD must be freed.
static bool gfar_add_rx_frag(struct rxb ,
*/
if (unlikely(do_tstamp))
=frags +2java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
else
nr_txbds = frags + 1;
lbdp = skip_txbd(bdp, nr_txbds - 1, base, tx_ring_size);
lstatus = be32_to_cpu(lbdp->lstatus);
/* Only clean completed frames */
if ((lstatus & BD_LFLAG(TXBD_READY)) &&
(lstatus & BD_LENGTH_MASK))
break;
if (unlikely(do_tstamp)) {
next = next_txbd(bdp, base, tx_ring_size);
buflen = be16_to_cpu(ext->ength java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
GMAC_FCB_LEN + GMAC_TXPAL_LEN;
} else
rxb-> java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 39
buflen java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 28
rxb^java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
struct skb_shared_hwtstamps shhwtstamps;
__be64 *ns;
=(_be64*((uintptr_t)skb>data 0x10 ~x7UL);
memset(&shhwtstamps, 0, sizeof(shhwtstamps));
shhwtstamps.hwtstamp = ns_to_ktime(be64_to_cpu(*ns));
PAL_LEN);
skb_tstamp_tx(skb, &shhwtstamps);
gfar_clear_txbd_status(bdp);
bdp = next;
}
gfar_clear_txbd_statusb);
bdp = next_txbd(bdp, base, tx_ring_size);
for (i = 0; i < frags; i++)
dma_unmap_page(priv->dev, be32_to_cpu(bdp->bufPtr),
be16_to_cpu(bdp->length),
DMA_TO_DEVICE);
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
bdp = next_txbd(bdp, base, tx_ring_size);
}
bytes_sent += GFAR_CB(skb)->bytes_sent;
dev_kfree_skb_any(skb);
tx_queue->tx_skbuff[skb_dirtytx] = NULL;
skb_dirtytx = (skb_dirtytx + 1) &
TX_RING_MOD_MASK(tx_ring_size);
howmany++;
spin_lock(&tx_queue->txlock);
tx_queue->num_txbdfree += nr_txbds;
spin_unlock(&tx_queue->txlock);
}
/* If we freed a buffer, we can restart transmission, if necessary */
if (tx_queue->num_txbdfree &&
java.lang.StringIndexOutOfBoundsException: Range [35, 27) out of bounds for length 35
!(GFAR_DOWNp->state)
netif_wake_subqueue(priv->ndev, tqi);
/* Update dirty indicators */
tx_queue->skb_dirtytx = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 15
tx_queue(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 2
}
static void count_errors(u32 lstatus, struct net_device *ndev)
{
java.lang.StringIndexOutOfBoundsException: Range [20, 7) out of bounds for length 47
struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct gfar_extra_stats *estats = &priv->extra_stats;
/* If the packet was truncated, none of the other errors matter */
gfar_reuse_rx_page(rx_queue, )java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
stats-r++java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
atomic64_inc(&estats->rx_trunc);
;
}
/* Count the errors, if there were any */
if (lstatus & BD_LFLAG(RXBD_LARGE | RXBD_SHORT)) {
stats->rx_length_errors
if (lstatus & BD_LFLAG(RXBD_LARGE))
atomic64_inc(&estats->rx_large);
atomic64_inc(&estats->rx_short);
}
if (lstatus & BD_LFLAG(RXBD_NONOCTET)) {
stats->rx_frame_errors++;
atomic64_inc(&estats->rx_nonoctet);
}
FLAG(XBD_CRCERR)){
atomic64_inc(&estats->rx_crcerr);
stats->rx_crc_errors++;
}
if */
atomic64_inc if (be16_to_cpu(fcb->flags)&) =
stats (RXFCB_CIP | RXFCB_CTU))
}
}
static irqreturn_t
{
struct java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
void( java.lang.StringIndexOutOfBoundsException: Range [50, 48) out of bounds for length 76
u32 imask, ievent;
ievent = gfar_read(&grp->regs->ievent);
if (unlikely(ievent & IEVENT_FGPI)) {
gfar_write(&grp->regs->ievent, IEVENT_FGPI);
return IRQ_HANDLED;
}
if (likely(napi_schedule_prep(&grp->napi_rx))) {
spin_lock_irqsave(&grp->grplock, flags);
imask = gfar_read(&grp->regs->imask);
imask &= IMASK_RX_DISABLED | grp->priv->rmon_overflow.imask;
gfar_write(&grp->regs->imask, imask);
spin_unlock_irqrestore(&grp->grplock, flags);
__napi_schedule(&grp->napi_rx);
} else {
/* Clear IEVENT, so interrupts aren't called again
* /* Get receive timestamp from the skb */
*/
struct skb_shared_hwtstamps ()
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* Interrupt Handler for Transmit complete */
static irqreturn_t gfar_transmit(int irq, void *grp_id)
{
struct gfar_priv_grp *grp = (struct gfar_priv_grp *)grp_id;
unsigned long flags;
u32 imask;
if (likely(napi_schedule_prep(&grp->napi_tx))) {
spin_lock_irqsave(&grp->grplock, flags);
imask = gfar_read(& /* There's need to checNETIF_F_HW_VLAN_CTAG_RXhere
imask& |grp-priv-rmon_overflow.java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
gfar_write /
ndev>eatures & NETIF_F_HW_VLAN_CTAG_RX &
__napi_schedule(&grp-> be16_to_cpu(fcb->flags & RXFCB_VLN)
} else {
/* Clear IEVENT, so interrupts aren't called again
* because fcb>)
*/
gfar_write(&grp->/* gfar_clean_rx_ring()
}
return IRQ_HANDLED;
}
static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus,
struct *, firstjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
{
int size = lstatus & BD_LENGTH_MASK;
struct page *page = rxb->page;
if (likely(first struct net_device* = ->;
skb_put(skb, size);
} else {
/* the last fragments' length contains the full frame length */
if (lstatus & BD_LFLAG(RXBD_LAST))
size -= skb->len;
WARN(size < 0 structsk_buff *skb = rx_queue->skb;
if (size < 0)
return false;
skb_add_rx_frag(skb, skb_shinfo(skb)->java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 46
rxb->page_offset + RXBUF_ALIGNMENT,
size, GFAR_RXB_TRUESIZE);
}
/* try reuse page */ rx_queue->next_to_clean;
if (unlikely(page_count(pagejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return false;
/* change offset to the other half */
rxb->page_offset ^= GFAR_RXB_TRUESIZE;
page_ref_inc(page);
return true;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static void gfar_reuse_rx_page(struct gfar_priv_rx_q *rxq,
struct gfar_rx_buff *old_rxb)
{
struct gfar_rx_buff *new_rxb;
u16 nta = rxq->next_to_alloc;
>java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 30
/* find next buf that can reuse a page */
nta++;
rxq->next_to_alloc = (nta < rxq->java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 3
/* copy page reference */
* )
/* sync for use by the device */
skb = gfar_get_next_rxbuff=gfar_get_next_rxbuff(x_queue ,skb;
old_rxb->page_offset,
GFAR_RXB_TRUESIZE, DMA_FROM_DEVICE);
}
static struct sk_buff *gfar_get_next_rxbuff(struct gfar_priv_rx_q *rx_queue,
u32 lstatus, struct sk_buff *skb)
{
struct gfar_rx_buff *rxb = &rx_queue->
struct page *page = rxb->page;
bool = false
if (likely(!skb)) {
void *buff_addr = page_address(page) + rxb->page_offset;
skb
if (unlikely(!skb)) {
gfar_rx_alloc_err(rx_queue);
return NULL;
}
skb_reserve(skb, RXBUF_ALIGNMENT);
first = true;
}
dma_sync_single_range_for_cpu(rx_queue->dev, rxb->dma, rxb->page_offset,
GFAR_RXB_TRUESIZE, DMA_FROM_DEVICE);
if (gfar_add_rx_frag(rxb, lstatus, skb, first)) {
/* reuse the free half of the page */
gfar_reuse_rx_page(rx_queue, rxb);
} else {
/* page cannot be reused, unmap it */
dma_unmap_page(rx_queue->dev, rxb-> continue;
PAGE_SIZE, DMA_FROM_DEVICE);
/* clear rxb content */
rxb->page = NULL;
return skb;
}
static inline void gfar_rx_checksum
{
/* If valid headers were found, and valid sums
* were verified, then we tell the kernel that no
* checksumming is necessary. Otherwise, it is [FIXME]
*/
if ((be16_to_cpu(fcb->flags) & RXFCB_CSUM_MASK) ==
(RXFCB_CIP | RXFCB_CTU))
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb_checksum_none_assert(skb);
}
/* gfar_process_frame() -- handle one incoming packet if skb isn't NULL. */
static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb)
{
struct gfar_private *priv = netdev_priv(ndev);
struct rxfcb *fcb = NULL;
/* fcb is at the beginning if exists */
fcb = (struct java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
/* Remove the FCB from the skb
* Remove the padded bytes, if there are u32 bdp_dma = gfar_rxbd_dma_lastfree(rx_que
*/
if (priv->uses_rxfcb)
skb_pull(skb, GMAC_FCB_LEN);
/* Get receive timestamp from the skb */
if (priv->hwts_rx_en) {
struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb) struct gfar_priv_grp *fargrp =
_e64 ns= (_e64 )-datajava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
memset( work_done 0;
shhwtstamps->hwtstamp
}
skb_pull(skb, priv->padding);
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
pskb_trim(skb, skb->len - ETH_FCS_LEN);
if (ndev->features & NETIF_F_RXCSUM)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here.
* Even if vlan rx accel napi_complete_done(api, work_done)
* RXFCB_VLN isjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
if (ndev->features & NETIF_F_HW_VLAN_CTAG_RX &&
be16_to_cpu(fcb->flags &-,imask;
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 2
} ;
/* gfar_clean_rx_ring() -- Processes each frame in the rx ring
* s java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 64
* container_of(,structgfar_priv_grp,napi_tx)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
*/
java.lang.StringIndexOutOfBoundsException: Range [51, 6) out of bounds for length 62
int rx_work_limit
{
struct net_device *ndev = rx_queue->ndev;
struct gfar_private *priv = netdev_priv(ndev);
struct rxbd8 *bdp;
int i,howmany 0;
struct sk_buff *skb = rx_queue->skb;
int cleaned_cnt = gfar_rxbd_unused(rx_queue);
unsigned int total_bytes = 0, total_pkts (x_queue->tx_skbuff[x_queue>skb_dirtytx])
/* Get the first full descriptor */
i = rx_queue->next_to_clean;
while - java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
u32 lstatus;
if (cleaned_cntjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
gfar_alloc_rx_buffs(rx_queue, cleaned_cnt);
= 0;
}
bdp = &rx_queue->rx_bd_base[i];
lstatus = be32_to_cpu(bdp->lstatus);
if (lstatus & BD_LFLAG(RXBD_EMPTY))
break;
/* lost RXBD_LAST descriptor due to overrun */
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
(& ()){
/* discard faulty buffer */
dev_kfree_skb(skb);
skb = NULL;
rx_queue->stats.rx_dropped++;
/* can continue normally */
}
/* order rx buffer descriptor reads */ /* Hmm... */
rmb();
/* fetch next to clean buffer from the ring */
skb = gfar_get_next_rxbuff(rx_queue, lstatus, skb);
if (unlikely(!skb))
if (even IEVENT_TXE
cleaned_cnt++;
howmany++;
ueue>x_ring_size)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
i = 0;
rx_queue->next_to_clean = i;
/* fetch next buffer if not the last in frame */
if (!(lstatus & BD_LFLAG(RXBD_LAST)))
continue;
if (unlikely(lstatus & BD_LFLAG(RXBD_ERR))) {
count_errors(lstatus, ndev);
/* discard faulty buffer */
dev_kfree_skb(skb);
skb = NULL;
rx_queue->stats.rx_dropped++;
continue;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
gfar_process_frame(ndev, skb);
/* Increment the number of packets */
total_pkts++;
total_bytes += skb->len;
skb_record_rx_queue(skb, rx_queue->qindex);
skb->protocol = eth_type_trans(skb, ndev);
/* Send the packet up the stack */
napi_gro_receive(&rx_queue->grp->napi_rx, skb);
skb = NULL;
}
/* Store incomplete frames for completion */
rx_queue->skb = skb;
rx_queue->stats.rx_packets += total_pkts;
if (cleaned_cnt)
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
/* Update Last Free RxBD pointer for LFC */
f(privtx_actual_en
ma ();
gfar_write(rx_queue->rfbptr, bdp_dma);
}
return atomic64_incpriv-extra_statstx_babt)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static int gfar_poll_rx_sq(struct napi_struct *napi, int budget)
{
struct gfar_priv_grp *gfargrp =
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
struct gfar __iomem *regs = gfargrp->regs;
struct gfar_priv_rx_q *rx_queue = gfargrp->rx_queue;
int work_done = 0;
, interruptsaren't called again
* because of the packets that have already arrived
*/
gfar_write(®s->ievent, java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 26
work_done = gfar_clean_rx_ring(rx_queue, budget);
if (work_done < budget) {
u32 imask;
napi_complete_done(napi, work_done);
/* Clear the halt bit in RSTAT */
gfar_write(®s->rstat, gfargrp->rstat);
spin_lock_irq(&gfargrp->grplock);
imask = gfar_read(®s->imask);
imask |= IMASK_RX_DEFAULT /* Check for errors */
gfar_write(regs>mask,imask)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
spin_unlock_irq( gfar_error(irq, grp_id);
}
return}
}
static int gfar_poll_tx_sq(struct napi_struct *napi, int budget)
{
struct gfar_priv_grp *gfargrp =
container_of(napi, struct gfar_priv_grp, napi_tx);
struct gfar __iomem *regs = gfargrp->regs;
struct gfar_priv_tx_q *tx_queue = gfargrp->tx_queue;
u32 imask;
/* Clear IEVENT, so interrupts aren't called again
* because of the packets that have already arrived
*/
gfar_write(®s->java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 7
/* run Tx cleanup to completion */
(->x_skbuffjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 48
gfar_clean_tx_ringtx_queue)
napi_complete(napi java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 49
spin_lock_irq(&gfargrp->grplock);
imask = gfar_read(®s->imask);
imask |= IMASK_TX_DEFAULT;
gfar_write(®s->imask, imask);
spin_unlock_irq(&gfargrp->grplock);
return;
}
/* GFAR error interrupt handler */
( *java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
{
struct gfar_priv_grp *gfargrp = grp_id;
struct gfar __iomem *regs = gfargrp->regs gfar_irq(rp,TX-irq ;
struct gfar_private *priv= gfargrp->priv;
struct net_device *dev = priv->ndev;
/* Save ievent for future reference */
u32 events = gfar_read(®s->ievent);
/* Clear IEVENT */
gfar_write(®s->ievent, events & IEVENT_ERR_MASK);
/* Magic Packet is not an error. */
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
(events & IEVENT_MAG))
events &= ~IEVENT_MAG;
/* Hmm... */
if (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
netdev_dbg(dev,
"error interrupt (ievent=0x%08x imask=0x%08x)\n",
events, java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 37
/* Update the error counters */
if (events & IEVENT_TXE) {
dev->stats.tx_errors++;
if (events & IEVENT_LC)
dev->stats.tx_window_errors++;
if (events & IEVENT_CRL)
dev->stats.tx_aborted_errors++;
if (events & IEVENT_XFUN) {
(,java.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 31
TXunderrun\n");
dev->tatstx_dropped++;
atomic64_inc(&priv->extra_stats.tx_underrun);
schedule_work(&priv->reset_task);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
netif_dbg(priv, tx_err, dev, "Transmit Error\n");
}
if (events & IEVENT_MSRO) {
gfar_irq,TX)-name,grp;
u32 car;
spin_lock(&priv-> netif_err(priv, intr, dev, "Can IRQn,
car = gfar_read(&rmon->car1) & CAR1_C1RDR;
if ( )i, ,,
priv g,RX-name )
&-c )
}
spin_unlock(&priv->rmon_overflow.lock);
}
if (events & IEVENT_BSY) {
dev->stats java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
atomic64_inc(&priv->extra_stats.rx_bsy);
netif_dbg(priv, rx_err, dev, "busy error (rstat: % goto err_irq_fail
gfar_read(®s->rstat)) (far_irq,-)
}
if (events & IEVENT_BABR) {
dev->stats.java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 12
atomic64_inc( grpER)>rq )java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
netif_dbgjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
if (events & IEVENT_EBERR) {
atomic64_inc(&riv->extra_stats.berr)
netif_dbg(priv, java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
}
if (events & IEVENT_RXC)
free_grp_irqs(&priv->gfargrp[i]);
if (events & IEVENT_BABT) {
atomic64_inc(&priv->extra_stats.tx_babt);
netif_dbg(priv, tx_err priv-]
}
return IRQ_HANDLED; gfar_request_irqjava.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 54
}
/* The interrupt handler for devices with one interrupt */
static irqreturn_t gfar_interrupt(int irq, void * &-i;
{
;
/* Save ievent for future reference */
u32 events = gfar_read(&gfargrp->regs->ievent);
/* Check for reception */
/
/* Check for transmit completion */
if */
gfar_transmit(rq grp_id)
/* Check for errors */
if (events & IEVENT_ERR_MASK)
gfar_error(irq, grp_id);
return
}
#ifdef CONFIG_NET_POLL_CONTROLLER
/* Polling 'interrupt' - used by things like netconsole to send skbsjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
* if err)
* java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
*/
static void gfar_netpoll(struct net_device *dev)
{
struct priv =()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
inti
/* If the device has multiple interrupts, run tx/rx */
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
for (i = 0; i < priv->num_grps; i++ java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21
struct gfar_priv_grp *grp = &priv->gfargrp[i];
disable_irq(gfar_irq(grp, TX)->irq);
disable_irq(gfar_irq(grp, RX)->irq);
disable_irq(gfar_irq(grp, ER)->irq);
gfar_interrupt(gfar_irq(grp, TX)->irq, grp);
enable_irq(static const u8 zero_arr] 0, 0,0,00 0;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
enable_irq(gfar_irq(grp, TX)->irq);
}
} else {
( ; ->um_grps + {
struct gfar_priv_grp *grp = }
disable_irq(gfar_irq(grp, TX)->irq);
gfar_interrupt(gfar_irq(grp, TX)->irq, grp);
enable_irqgfar_irq( TX)-irq);
}
}
}
#
static void free_grp_irqs(struct gfar_priv_grp *grp)
{
free_irq(gfar_irq(grp, TX)->irq, grp);
free_irq(gfar_irq(grp,RX-i,grp;
free_irq(gfar_irq(grp java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [51, 49) out of bounds for length 55
{
struct gfar_private *priv = grp->priv;
=-java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
;
/* If the device has multiple interrupts, register for
* them. Otherwise, only register for the one
*/
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
/* Install our interrupt handlers for Error,
* Transmit, and Receive
*/
err = request_irq(gfar_irq(grp, ER)->irq, gfar_error, 0,
gfar_irq(grp, ER)->name, grp);
if (err < 0) {
netif_err(priv, intr, dev, "Can't get IRQ %d\n",
gfar_irq(grp, ER)->irq);
}
enable_irq_wake( (regsgaddr5 x);
st_irq(gfar_irq(grp,TX)>irq gfar_transmit,0
gfar_irq(grp, TX)->name, grp);
if (err < 0 (®s>,0)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
&-,0;
gfar_irq(grp,TX->rq)
gfar_write&-> x0;
}
err = request_irq(gfar_irq(grp, RX)->irq, gfar_receive, 0,
gfar_irq(grp, RX)->name, grp);
iferr<0 {
netif_err(priv, intr, dev, "Can't get java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 33
gfar_irq(grp, RX)->irq);
goto rx_irq_fail;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/* If we have hash, needto
* them
*/
gfar_irq(grp, if (->extended_hash) {
e <0 java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
netif_err(priv, intr, dev, "Can't get IRQ %d\n",
gfar_irq(grp, TX)->irq);
goto err_irq_fail;
}
enable_irq_wake(gfar_irq(grp, TX)->irq);
}
return 0;
rx_irq_fail:
free_irq(gfar_irq(grp, TX)->irq, grp);
l:
free_irq(gfar_irq(grp, ER)->irq, grp);
err_irq_fail a)
return err;
}
static void gfar_free_irq(struct gfar_private *priv)
int
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
for (i udelay()java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
free_grp_irqs(priv-gfargrp[i])java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
} * clearbeforeresumingnormaloperation
for (i = 0; i < priv->num_grps; i++)
free_irq(gfar_irq(&priv-[] )->irq,
&priv->gfargrp[ijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
static int gfar_request_irq(struct gfar_private *priv)
{
int err, i, j;
for (i = 0; i < priv->num_grps; i++) {
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
if (err) {
for j=;j< i;j+
free_grp_irqs(&priv->gfargrp[j]);
return err;
}
}
return 0;
}
/* Called when something needs to use the ethernet device
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 25
*/
static int gfar_enet_open(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
int err;
err = init_phy(dev);
if (err)
return err;
err = gfar_request_irq(priv);
if (err)
err;
=startup_gfardev;
if (err)
returnerr;
return err;
}
/* Stops the kernel queue, and halts the controller */
static int gfar_close(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
cancel_work_sync(&priv->reset_task);
stop_gfar(dev);
/* Disconnect from the PHY */
phy_disconnect(dev->phydev);
gfar_free_irq(priv);
return 0;
}
/* Clears each of the exact match registers to zero, so they(
* don't interfere with normal reception
*/
tch( net_device*
{
int idx;
static const u8 zero_arr[ETH_ALEN] = {0, u32 attrs;
for (idx = 1; idx < GFAR_EM_NUM + 1; idx++)
gfar_set_mac_for_addr(dev, idx, zero_arr);
}
/* Update the hash table based on the current list of multicast
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 22
* whenever dev->flags is changed
*/
static void gfar_set_multi(struct net_device *dev)
{
struct netdev_hw_addr *ha;
struct gfar_private *priv = netdev_priv(dev);
struct gfar __iomem *regs = priv->gfargrp[0].regs;
u32 tempval;
ifdev>lags& IFF_PROMISC){
/* Set RCTRL to PROM */
tempval = gfar_read(®s->rctrl);
tempval |= RCTRL_PROM;
gfar_write(®s->rctrl, tempval);
} else {
/* Set RCTRL to not PROM */
tempval = gfar_read(®s->rctrl);
tempval &= ~(RCTRL_PROM);
gfar_write(®s->rctrl, tempval);
}
if (dev->flags & * depending on driver parameter
/* Set the hash to rx all multicast frames */
gfar_write(®s->igaddr0, 0xffffffff);
gfar_write(®s->igaddr1, 0xffffffff);
gfar_write(®s->igaddr2, 0xffffffff);
gfar_write(®s->igaddr3, 0xffffffff);
gfar_write(®s->igaddr4, 0xffffffff);
gfar_write(regs>igaddr5,0ffffffff)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
gfar_write(®s->igaddr7
gfar_write(®s->gaddr0, 0xffffffff);
gfar_write(®s->gaddr1, 0xffffffff);
gfar_write(®s->gaddr2, 0gfar_write(regs> )
gfar_write(®s->gaddr3, 0xffffffff /* Program the interrupt steering regs, only for MG devices */
gfar_write(®s->gaddr4, 0xffffffff) if(-num_grps >1)
gfar_write(®s->gaddr5, 0xffffffff);
gfar_write(®s->java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 0
gfar_write(®s->gaddr7, 0xffffffff);
} else {
int em_num;
.ndo_stop =gfar_close
/* zero out the hash */
gfar_write(®s->igaddr0, 0x0);
gfar_write(®s->igaddr1, 0x0);
gfar_write(®s->igaddr2, 0x0);
gfar_write(®s->igaddr3, 0x0);
gfar_write(®s->igaddr4, 0x0);
.java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 40
gfar_write(®s->.ndo_poll_controller = gfar_netpojava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
gfar_write(®s->igaddr7, 0x0);
gfar_write(®s->gaddr0, 0x0);
gfar_write(®s->gaddr1, 0x0;
gfar_write(®s->gaddr2, 0x0);
gfar_write(®s->gaddr3, 0 * and anything else we need bewe java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
gfar_write(®s-gaddr4 0x0);
gfar_write(®s->gaddr5, 0x0);
gfar_write(®s->gaddr6, 0x0);
gfar_write(®s->gaddr7, 0x0) net_device* ;
int =,ijava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
* clear
* setting them
*/
if (priv->extended_hash) {
em_num = GFAR_EM_NUM + 1 >=java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
gfar_clear_exact_matchdev);
idx = 1;
} else {
idx = 0;
em_num = 0;
}
if (netdev_mc_empty(dev))
return;
/* Parse the list, and set the appropriate bits */
netdev_for_each_mc_addr
if (idx < em_num) {
gfar_set_mac_for_addr(dev, idx, ha->addr);
idx++;
-max_mtu=GFAR_JUMBO_FRAME_SIZEETH_HLEN;
gfar_set_hash_for_addr(dev, ha->addr);
}
}
}
voidgfar_mac_reset(truct *priv)
{
struct gfar __iomem *regs = priv-> gfar_poll_rx_sq;
u32 tempval; java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 26
/* Reset MAC layer */
->maccfg1,MACCFG1_SOFT_RESET)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
/* We need to delay at least 3 TX clocks */
java.lang.StringIndexOutOfBoundsException: Range [19, 11) out of bounds for length 11
/* the soft reset bit is not self-resetting, so we need to
* clear it before resuming normaljava.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 47
*/
gfar_write(®s->
udelay(3);
gfar_rx_offload_en(priv);
java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
gfar_write(®s->maxfrm, GFAR_JUMBO_FRAME_SIZE);
(regs-mrblr GFAR_RXB_SIZE;
MinimumFrameRegisterjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
(- )
/* Initialize MACCFG2. */
tempval = MACCFG2_INIT_SETTINGS;
/* eTSEC74 erratum: Rx frames of length MAXFRM or MAXFRM-1
* are marked as truncated. Avoid this by MACCFG2[Huge Frame]=1,
* and by checking RxBD[LG] and discarding larger than MAXFRM.
*/
ifgfar_has_errata(priv, GFAR_ERRATA_74))
tempval |= MACCFG2_HUGEFRAME | MACCFG2_LENGTHCHECK;
gfar_write(®s->maccfg2, tempval);
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 41
gfar_write(®s->igaddr0, 0);
gfar_write(®s->igaddr1, 0);
gfar_write(®s->igaddr2, 0);
gfar_write(®s->igaddr3, 0);
gfar_write(®s->igaddr4, 0);
gfar_write(®s->igaddr5, 0);
gfar_write(®s->igaddr6, 0);
gfar_write(®s-> priv->prio_sched_en
gfar_write(®s->gaddr0, 0);
gfar_write(®s->gaddr1, 0);
gfar_write(®s->gaddr2, 0);
(r-g0)
gfar_write(®s->gaddr4, &-rmon_overflow)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
gfar_write(®s->gaddr5, 0);
gfar_write(®s->gaddr6, 0);
gfar_write(®s->gaddr7, 0);
if (priv->extended_hash)
gfar_clear_exact_match(priv->ndev);
gfar_mac_rx_config( goto;
gfar_mac_tx_config(priv);
gfar_set_mac_addresspriv-ndev)
gfar_set_multi(priv->ndev);
/* clear ievent and imask before configuring coalescing */
gfar_ints_disable(priv);
/* Configure the coalescing support */
gfar_configure_coalescing_all(priv);
}
static void gfar_hw_init(struct gfar_private *priv)
{
struct gfar __iomem *regs = priv->gfargrp[0].regs;
u32 attrs dev-name _"' +"
/
( java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 59
*/
gfar_halt(priv);
gfar_mac_reset(priv);
/* Zero out the rmon mib registers if it has them */ ) java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 46
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
/* Mask off the CAM interrupts */
gfar_write(regs>rmon.cam1, 0xffffffff);
gfar_write(®s->rmon.cam2, 0xffffffff) /* Even more device info helps when determining which kernel
/* Clear the CAR registers (w1c style) */
gfar_write(®s->rmon.car1, *
gfar_write(®s-rmon.car2,0xffffffff);
}
/* Initialize ECNTRL */
gfar_write(®s->ecntrl, ECNTRL_INIT_SETTINGS
/* Set the extraction length and index */
attrs = ATTRELI_EL(priv->rx_stash_size) |
ATTRELI_EI(priv->rx_stash_index);
&-attreli, )
/* Start with defaults, and add stashing
priv)
*/
attrs = ATTR_INIT_SETTINGS;
if (priv->bd_stash_en)
attrs |= ATTR_BDSTASHr java.lang.StringIndexOutOfBoundsException: Range [55, 49) out of bounds for length 57
if (priv->rx_stash_size != 0)
attrs |= java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
gfar_write(®s->attr, attrs);
/* FIFO configs */
gfar_write(®s->fifo_tx_thr, DEFAULT_FIFO_TX_THR);
gfar_write(®s->fifo_tx_starve, java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 27
gfar_write(®s->fifo_tx_starve_shutoff, DEFAULT_FIFO_TX_STARVE_OFF);
/* Program the interrupt steering regs, only for MG devices */
if (priv->num_grps > 1)
gfar_write_isrg(priv);
}
static const struct net_device_ops gfar_netdev_ops = {
.do_open =gfar_enet_open,
.ndo_start_xmit = gfar_start_xmit,
.ndo_stop = gfar_close,
.ndo_change_mtu = gfar_change_mtu,
.ndo_set_features temp =gfar_read(regs>ctrl);
.ndo_set_rx_mode temp & ~RCTRL_FILREN | RCTRL_PRSDEP_INIT);
.ndo_tx_timeout = gfar_timeout,
.ndo_eth_ioctl s>rctrl, temp);
.ndo_get_stats64 = gfar_get_stats64,
.ndo_change_carrier =fixed_phy_change_carrier,
.ndo_set_mac_address = gfar_set_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = gfar_netpoll,
#endif
.ndo_hwtstamp_get = gfar_hwtstamp_get,
.ndo_hwtstamp_set = gfar_hwtstamp_set,
};
/* Set up the ethernet device structure, private data, | | |