Changeset 69e3f27 in rtems


Ignore:
Timestamp:
Nov 14, 2014, 7:58:00 AM (5 years ago)
Author:
Daniel Cederman <cederman@…>
Branches:
4.11, master
Children:
e4d8513
Parents:
9ab1558f
git-author:
Daniel Cederman <cederman@…> (11/14/14 07:58:00)
git-committer:
Daniel Hellstrom <daniel@…> (12/02/14 12:41:15)
Message:

net: Add network task affinity config

This patch adds a default network tasks CPU affinity configuration
option. The network drivers have the option to create their own
daemon tasks with a custom CPU affinity set, or rely on the
default set.

Location:
cpukit/libnetworking/rtems
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/rtems/rtems_bsdnet.h

    r9ab1558f r69e3f27  
    1212
    1313#include <rtems.h>
     14#include <sys/cpuset.h>
    1415
    1516/*
     
    182183        unsigned long           tcp_tx_buf_size;
    183184        unsigned long           tcp_rx_buf_size;
     185
     186        /*
     187         * Default Network Tasks CPU Affinity
     188         */
     189#ifdef RTEMS_SMP
     190        const cpu_set_t         *network_task_cpuset;
     191        size_t                  network_task_cpuset_size;
     192#endif
    184193};
    185194
  • cpukit/libnetworking/rtems/rtems_bsdnet_internal.h

    r9ab1558f r69e3f27  
    158158);
    159159
     160#ifdef RTEMS_SMP
     161/* As rtems_bsdnet_newproc() but with ability to set CPU affinity too */
     162rtems_id rtems_bsdnet_newproc_affinity (
     163  char  *name,
     164  int   stacksize,
     165  void  (*entry)(void *),
     166  void  *arg,
     167  const cpu_set_t *set,
     168  const size_t setsize
     169);
     170#endif
     171
    160172rtems_status_code rtems_bsdnet_event_receive (
    161173  rtems_event_set  event_in,
  • cpukit/libnetworking/rtems/rtems_glue.c

    r9ab1558f r69e3f27  
    5757static rtems_id networkDaemonTid;
    5858static uint32_t   networkDaemonPriority;
     59#ifdef RTEMS_SMP
     60static const cpu_set_t *networkDaemonCpuset = 0;
     61static size_t          networkDaemonCpusetSize = 0;
     62#endif
    5963static void networkDaemon (void *task_argument);
    6064
     
    280284        else
    281285                networkDaemonPriority = rtems_bsdnet_config.network_task_priority;
     286
     287        /*
     288         * Default network task CPU affinity
     289         */
     290#ifdef RTEMS_SMP
     291        networkDaemonCpuset = rtems_bsdnet_config.network_task_cpuset;
     292        networkDaemonCpusetSize = rtems_bsdnet_config.network_task_cpuset_size;
     293#endif
    282294
    283295        /*
     
    661673}
    662674
     675
    663676/*
    664677 * Start a network task
    665678 */
     679#ifdef RTEMS_SMP
    666680rtems_id
    667681rtems_bsdnet_newproc (char *name, int stacksize, void(*entry)(void *), void *arg)
     682{
     683        return rtems_bsdnet_newproc_affinity( name, stacksize, entry, arg,
     684                networkDaemonCpuset, networkDaemonCpusetSize );
     685}
     686
     687rtems_id
     688rtems_bsdnet_newproc_affinity (char *name, int stacksize, void(*entry)(void *),
     689    void *arg, const cpu_set_t *set, const size_t setsize)
     690#else
     691rtems_id
     692rtems_bsdnet_newproc (char *name, int stacksize, void(*entry)(void *), void *arg)
     693#endif
    668694{
    669695        struct newtask *t;
     
    681707        if (sc != RTEMS_SUCCESSFUL)
    682708                rtems_panic ("Can't create network daemon `%s': `%s'\n", name, rtems_status_text (sc));
     709
     710#ifdef RTEMS_SMP
     711        /*
     712         * Use the default affinity or use the user-provided CPU set
     713         */
     714        if ( set != 0 )
     715                rtems_task_set_affinity( tid, setsize, set );
     716#endif
    683717
    684718        /*
Note: See TracChangeset for help on using the changeset viewer.