Changeset 044cf4d7 in rtems


Ignore:
Timestamp:
10/08/14 06:11:28 (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
419accf
Parents:
77dd9a4
git-author:
Sebastian Huber <sebastian.huber@…> (10/08/14 06:11:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/08/14 06:12:24)
Message:

ppp: Add ppp_unit()

This makes porting to the new network stack easier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/net/if_ppp.c

    r77dd9a4 r044cf4d7  
    196196#endif
    197197
     198static int
     199ppp_unit(struct ppp_softc *sc)
     200{
     201  return sc->sc_if.if_unit;
     202}
     203
    198204static rtems_task ppp_rxdaemon(rtems_task_argument arg)
    199205{
     
    415421  if ( sc->sc_rxtask == 0 ) {
    416422    /* start rx daemon task */
    417     status = rtems_task_create(rtems_build_name('R','x','P','0'+sc->sc_if.if_unit), priority, 2048,
     423    status = rtems_task_create(rtems_build_name('R','x','P','0'+ppp_unit(sc)), priority, 2048,
    418424                               RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
    419425                               RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
     
    430436
    431437    /* start tx daemon task */
    432     status = rtems_task_create(rtems_build_name('T','x','P','0'+sc->sc_if.if_unit), priority, 2048,
     438    status = rtems_task_create(rtems_build_name('T','x','P','0'+ppp_unit(sc)), priority, 2048,
    433439                               RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
    434440                               RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
     
    655661
    656662    case PPPIOCGUNIT:
    657         *(int *)data = sc->sc_if.if_unit;
     663        *(int *)data = ppp_unit(sc);
    658664        break;
    659665
     
    733739                        if (sc->sc_flags & SC_DEBUG)
    734740                            printf("ppp%d: comp_alloc failed\n",
    735                                sc->sc_if.if_unit);
     741                               ppp_unit(sc));
    736742                        error = ENOBUFS;
    737743                    }
     
    748754                        if (sc->sc_flags & SC_DEBUG)
    749755                            printf("ppp%d: decomp_alloc failed\n",
    750                                sc->sc_if.if_unit);
     756                               ppp_unit(sc));
    751757                        error = ENOBUFS;
    752758                    }
     
    759765        if (sc->sc_flags & SC_DEBUG)
    760766            printf("ppp%d: no compressor for [%x %x %x], %x\n",
    761                    sc->sc_if.if_unit, ccp_option[0], ccp_option[1],
     767                   ppp_unit(sc), ccp_option[0], ccp_option[1],
    762768                   ccp_option[2], nb);
    763769        return (EINVAL);        /* no handler found */
     
    993999        break;
    9941000    default:
    995         printf("ppp%d: af%d not supported\n", ifp->if_unit, dst->sa_family);
     1001        printf("ppp%d: af%d not supported\n", ppp_unit(sc), dst->sa_family);
    9961002        error = EAFNOSUPPORT;
    9971003        goto bad;
     
    10361042
    10371043    if (sc->sc_flags & SC_LOG_OUTPKT) {
    1038         printf("ppp%d output: ", ifp->if_unit);
     1044        printf("ppp%d output: ", ppp_unit(sc));
    10391045        pppdumpm(m0);
    10401046    }
     
    13571363                    && (*sc->sc_xcomp->comp_init)
    13581364                        (sc->sc_xc_state, dp + CCP_HDRLEN, slen - CCP_HDRLEN,
    1359                          sc->sc_if.if_unit, 0, sc->sc_flags & SC_DEBUG)) {
     1365                         ppp_unit(sc), 0, sc->sc_flags & SC_DEBUG)) {
    13601366                    s = splimp();
    13611367                    sc->sc_flags |= SC_COMP_RUN;
     
    13671373                    && (*sc->sc_rcomp->decomp_init)
    13681374                        (sc->sc_rc_state, dp + CCP_HDRLEN, slen - CCP_HDRLEN,
    1369                          sc->sc_if.if_unit, 0, sc->sc_mru,
     1375                         ppp_unit(sc), 0, sc->sc_mru,
    13701376                         sc->sc_flags & SC_DEBUG)) {
    13711377                    s = splimp();
     
    14471453        for (mp = m; mp != NULL; mp = mp->m_next)
    14481454            ilen += mp->m_len;
    1449         printf("ppp%d: got %d bytes\n", ifp->if_unit, ilen);
     1455        printf("ppp%d: got %d bytes\n", ppp_unit(sc), ilen);
    14501456        pppdumpm(m);
    14511457    }
     
    14911497             */
    14921498            if (sc->sc_flags & SC_DEBUG)
    1493                 printf("ppp%d: decompress failed %d\n", ifp->if_unit, rv);
     1499                printf("ppp%d: decompress failed %d\n", ppp_unit(sc), rv);
    14941500            s = splimp();
    14951501            sc->sc_flags |= SC_VJ_RESET;
     
    15421548            if (sc->sc_flags & SC_DEBUG)
    15431549                printf("ppp%d: VJ uncompress failed on type comp\n",
    1544                         ifp->if_unit);
     1550                        ppp_unit(sc));
    15451551            goto bad;
    15461552        }
     
    15971603            if (sc->sc_flags & SC_DEBUG)
    15981604                printf("ppp%d: VJ uncompress failed on type uncomp\n",
    1599                         ifp->if_unit);
     1605                        ppp_unit(sc));
    16001606            goto bad;
    16011607        }
     
    16971703        splx(s);
    16981704        if (sc->sc_flags & SC_DEBUG)
    1699             printf("ppp%d: input queue full\n", ifp->if_unit);
     1705            printf("ppp%d: input queue full\n", ppp_unit(sc));
    17001706        ifp->if_iqdrops++;
    17011707        goto bad;
Note: See TracChangeset for help on using the changeset viewer.