--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Oct 30, 2007 at 04:01:04PM +0200, Oleg Lomaka wrote:

[...]

> I had RxFIFO overrun again
> from dmest:
> msk0: Rx FIFO overrun!


[...]

Please try attached patch again. Sorry for the trouble.
After applying the patch show me verbosed dmesg output related with
msk(4)/PHY driver.

Thanks for testing.
--
Regards,
Pyun YongHyeon

--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="msk.queue.patch2"

Index: if_msk.c
================================================== =================
RCS file: /home/ncvs/src/sys/dev/msk/if_msk.c,v
retrieving revision 1.18
diff -u -r1.18 if_msk.c
--- if_msk.c 20 Jul 2007 00:25:20 -0000 1.18
+++ if_msk.c 31 Oct 2007 03:31:48 -0000
@@ -368,6 +368,8 @@
struct msk_if_softc *sc_if;

sc_if = device_get_softc(dev);
+ if (phy != PHY_ADDR_MARV)
+ return (0);

return (msk_phy_readreg(sc_if, phy, reg));
}
@@ -406,6 +408,8 @@
struct msk_if_softc *sc_if;

sc_if = device_get_softc(dev);
+ if (phy != PHY_ADDR_MARV)
+ return (0);

return (msk_phy_writereg(sc_if, phy, reg, val));
}
@@ -516,17 +520,14 @@
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), gmac);

/* Enable PHY interrupt for FIFO underrun/overflow. */
- if (sc->msk_marvell_phy)
- msk_phy_writereg(sc_if, PHY_ADDR_MARV,
- PHY_MARV_INT_MASK, PHY_M_IS_FIFO_ERROR);
+ msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK,
+ PHY_M_IS_FIFO_ERROR);
} else {
/*
* Link state changed to down.
* Disable PHY interrupts.
*/
- if (sc->msk_marvell_phy)
- msk_phy_writereg(sc_if, PHY_ADDR_MARV,
- PHY_MARV_INT_MASK, 0);
+ msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
/* Disable Rx/Tx MAC. */
gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
@@ -1018,64 +1019,38 @@
static int
mskc_setup_rambuffer(struct msk_softc *sc)
{
- int totqsize, minqsize;
- int avail, next;
+ int next;
int i;
uint8_t val;

/* Get adapter SRAM size. */
val = CSR_READ_1(sc, B2_E_0);
sc->msk_ramsize = (val == 0) ? 128 : val * 4;
- if (sc->msk_hw_id == CHIP_ID_YUKON_FE)
- sc->msk_ramsize = 4 * 4;
if (bootverbose)
device_printf(sc->msk_dev,
"RAM buffer size : %dKB\n", sc->msk_ramsize);
-
- totqsize = sc->msk_ramsize * sc->msk_num_port;
- minqsize = MSK_MIN_RXQ_SIZE + MSK_MIN_TXQ_SIZE;
- if (minqsize > sc->msk_ramsize)
- minqsize = sc->msk_ramsize;
-
- if (minqsize * sc->msk_num_port > totqsize) {
- device_printf(sc->msk_dev,
- "not enough RAM buffer memory : %d/%dKB\n",
- minqsize * sc->msk_num_port, totqsize);
- return (ENOSPC);
- }
-
- avail = totqsize;
- if (sc->msk_num_port > 1) {
- /*
- * Divide up the memory evenly so that everyone gets a
- * fair share for dual port adapters.
- */
- avail = sc->msk_ramsize;
- }
-
- /* Take away the minimum memory for active queues. */
- avail -= minqsize;
- /* Rx queue gets the minimum + 80% of the rest. */
- sc->msk_rxqsize =
- (avail * MSK_RAM_QUOTA_RX) / 100 + MSK_MIN_RXQ_SIZE;
- avail -= (sc->msk_rxqsize - MSK_MIN_RXQ_SIZE);
- sc->msk_txqsize = avail + MSK_MIN_TXQ_SIZE;
-
+ /*
+ * Give receiver 2/3 of memory and round down to the multiple
+ * of 1024. Tx/Rx RAM buffer size of Yukon II shoud be multiple
+ * of 1024.
+ */
+ sc->msk_rxqsize = rounddown((sc->msk_ramsize * 1024 * 2) / 3, 1024);
+ sc->msk_txqsize = (sc->msk_ramsize * 1024) - sc->msk_rxqsize;
for (i = 0, next = 0; i < sc->msk_num_port; i++) {
sc->msk_rxqstart[i] = next;
- sc->msk_rxqend[i] = next + (sc->msk_rxqsize * 1024) - 1;
+ sc->msk_rxqend[i] = next + sc->msk_rxqsize - 1;
next = sc->msk_rxqend[i] + 1;
sc->msk_txqstart[i] = next;
- sc->msk_txqend[i] = next + (sc->msk_txqsize * 1024) - 1;
+ sc->msk_txqend[i] = next + sc->msk_txqsize - 1;
next = sc->msk_txqend[i] + 1;
if (bootverbose) {
device_printf(sc->msk_dev,
"Port %d : Rx Queue %dKB(0x%08x:0x%08x)\n", i,
- sc->msk_rxqsize, sc->msk_rxqstart[i],
+ sc->msk_rxqsize / 1024, sc->msk_rxqstart[i],
sc->msk_rxqend[i]);
device_printf(sc->msk_dev,
"Port %d : Tx Queue %dKB(0x%08x:0x%08x)\n", i,
- sc->msk_txqsize, sc->msk_txqstart[i],
+ sc->msk_txqsize / 1024, sc->msk_txqstart[i],
sc->msk_txqend[i]);
}
}
@@ -1517,10 +1492,6 @@
error = ENXIO;
goto fail;
}
- /* Check whether PHY Id is MARVELL. */
- if (msk_phy_readreg(sc_if, PHY_ADDR_MARV, PHY_MARV_ID0)
- == PHY_MARV_ID0_VAL)
- sc->msk_marvell_phy = 1;

fail:
if (error != 0) {
@@ -3226,15 +3197,12 @@
{
uint16_t status;

- if (sc_if->msk_softc->msk_marvell_phy) {
- msk_phy_readreg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_STAT);
- status = msk_phy_readreg(sc_if, PHY_ADDR_MARV,
- PHY_MARV_INT_STAT);
- /* Handle FIFO Underrun/Overflow? */
- if ((status & PHY_M_IS_FIFO_ERROR))
- device_printf(sc_if->msk_if_dev,
- "PHY FIFO underrun/overflow.\n");
- }
+ msk_phy_readreg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_STAT);
+ status = msk_phy_readreg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_STAT);
+ /* Handle FIFO Underrun/Overflow? */
+ if ((status & PHY_M_IS_FIFO_ERROR))
+ device_printf(sc_if->msk_if_dev,
+ "PHY FIFO underrun/overflow.\n");
}

static void
@@ -4035,8 +4003,7 @@
/* Disable all GMAC interrupt. */
CSR_WRITE_1(sc, MR_ADDR(sc_if->msk_port, GMAC_IRQ_MSK), 0);
/* Disable PHY interrupt. */
- if (sc->msk_marvell_phy)
- msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
+ msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);

/* Disable the RAM Interface Arbiter. */
CSR_WRITE_1(sc, MR_ADDR(sc_if->msk_port, TXA_CTRL), TXA_DIS_ARB);
Index: if_mskreg.h
================================================== =================
RCS file: /home/ncvs/src/sys/dev/msk/if_mskreg.h,v
retrieving revision 1.6
diff -u -r1.6 if_mskreg.h
--- if_mskreg.h 12 Jun 2007 10:50:32 -0000 1.6
+++ if_mskreg.h 31 Oct 2007 03:31:49 -0000
@@ -2333,7 +2333,6 @@
int msk_suspended;
int msk_hw_feature;
int msk_clock;
- int msk_marvell_phy;
int msk_msi;
struct msk_if_softc *msk_if[2];
device_t msk_devs[2];
@@ -2370,8 +2369,6 @@
device_t msk_if_dev;
int32_t msk_port; /* port # on controller */
int msk_framesize;
- int msk_phytype;
- int msk_phyaddr;
int msk_link;
struct callout msk_tick_ch;
int msk_watchdog_timer;

--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
--EVF5PPMfhYS0aIcm--