Changeset 5068f3f9 in rtems


Ignore:
Timestamp:
Feb 10, 2010, 12:15:06 AM (10 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, master
Children:
1bab8a6d
Parents:
e5e4e3fb
Message:

2010-02-09 Till Straumann <strauman@…>

  • network/if_mve/mv643xx_eth.c: Fixed alignment attribute in descriptor declaration. Not the pointers to the descriptors have to be aligned but the descriptors themselves (didn't cause problems but caused unnecessary holes in 'private' struct).

FIX: Added more robustness when number of available TX descriptors
drops to zero. (This can e.g., happen if the link goes bad causing
packets to stall in the FIFO.) At the following points the transmitter
is explicitly (re-)started:

o when link comes up and number of available TXDs is zero the

TX is restarted.

o on a failed attempt to send data due to lack of TXDs the

TX is restarted if swiping the TX ring doesn't yield any
buffers (i.e., if the # of available buffers is still zero
after the swipe).

Location:
c/src/lib/libbsp/powerpc/beatnik
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/beatnik/ChangeLog

    re5e4e3fb r5068f3f9  
     12010-02-09  Till Straumann <strauman@slac.stanford.edu>
     2
     3        * network/if_mve/mv643xx_eth.c: Fixed alignment attribute
     4        in descriptor declaration. Not the pointers to the descriptors
     5        have to be aligned but the descriptors themselves (didn't
     6        cause problems but caused unnecessary holes in 'private' struct).
     7
     8        FIX: Added more robustness when number of available TX descriptors
     9        drops to zero. (This can e.g., happen if the link goes bad causing
     10        packets to stall in the FIFO.) At the following points the transmitter
     11        is explicitly (re-)started:
     12          o when link comes up and number of available TXDs is zero the
     13            TX is restarted.
     14          o on a failed attempt to send data due to lack of TXDs the
     15            TX is restarted if swiping the TX ring doesn't yield any
     16            buffers (i.e., if the # of available buffers is still zero
     17            after the swipe).
     18
    1192009-12-14      Sebastian Huber <sebastian.huber@embedded-brains.de>
    220
  • c/src/lib/libbsp/powerpc/beatnik/network/if_mve/mv643xx_eth.c

    re5e4e3fb r5068f3f9  
    688688        volatile struct mveth_rx_desc *next;    /* next descriptor (CPU address; next_desc_ptr is a DMA address) */
    689689        uint32_t        pad[2];
    690 } MvEthRxDescRec, *MvEthRxDesc
    691 __attribute__(( aligned(RING_ALIGNMENT) ));
     690} __attribute__(( aligned(RING_ALIGNMENT) )) MvEthRxDescRec, *MvEthRxDesc;
    692691
    693692typedef volatile struct mveth_tx_desc {
     
    704703        void            *u_buf;                                         /* user buffer */
    705704        volatile struct mveth_tx_desc *next;    /* next descriptor (CPU address; next_desc_ptr is a DMA address)   */
    706 } MvEthTxDescRec, *MvEthTxDesc
    707 __attribute__(( aligned(RING_ALIGNMENT) ));
     705} __attribute__(( aligned(RING_ALIGNMENT) )) MvEthTxDescRec, *MvEthTxDesc;
    708706
    709707/* Assume there are never more then 64k aliasing entries */
     
    12231221/* MID-LAYER SUPPORT ROUTINES */
    12241222
     1223/* Start TX if descriptors are exhausted */
     1224static __inline__ void
     1225mveth_start_tx(struct mveth_private *mp)
     1226{
     1227uint32_t running;
     1228        if ( mp->avail <= 0 ) {
     1229                running = MV_READ(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_R(mp->port_num));
     1230                if ( ! (running & MV643XX_ETH_TX_START(0)) ) {
     1231                        MV_WRITE(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_R(mp->port_num), MV643XX_ETH_TX_START(0));
     1232                }
     1233        }
     1234}
     1235
    12251236/* Stop TX and wait for the command queues to stop and the fifo to drain */
    12261237static uint32_t
     
    19561967        /* if no descriptor is available; try to wipe the queue */
    19571968        if ( (mp->avail < 1) && MVETH_CLEAN_ON_SEND(mp)<=0 ) {
     1969                /* Maybe TX is stalled and needs to be restarted */
     1970                mveth_start_tx(mp);
    19581971                return -1;
    19591972        }
     
    20012014
    20022015                                        if ( mp->avail < 1 && MVETH_CLEAN_ON_SEND(mp)<=0 ) {
     2016                                                        /* Maybe TX was stalled - try to restart */
     2017                                                        mveth_start_tx(mp);
     2018
    20032019                                                        /* not enough descriptors; cleanup...
    20042020                                                         * the first slot was never used, so we start
     
    21432159        if (   ( mp->avail < needed )
    21442160        && ( MVETH_CLEAN_ON_SEND(mp) <= 0 || mp->avail < needed ) ) {
     2161                /* Maybe TX was stalled and needs a restart */
     2162                mveth_start_tx(mp);
    21452163                return -1;
    21462164        }
     
    26072625                if ( IFM_LINK_OK & media ) {
    26082626                        mveth_update_serial_port(mp, media);
     2627                        /* If TX stalled because there was no buffer then whack it */
     2628                        mveth_start_tx(mp);
    26092629                }
    26102630                if ( pmedia )
Note: See TracChangeset for help on using the changeset viewer.