Add rtems_bsd_set_if_input()

This commit is contained in:
Sebastian Huber
2017-06-21 14:35:19 +02:00
parent 07c8680872
commit e846288593
6 changed files with 127 additions and 1 deletions

View File

@@ -2698,6 +2698,22 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
break;
}
#ifdef __rtems__
case RTEMS_SIOSIFINPUT:
if (ifp->if_input_arg == NULL) {
struct rtems_ifinputreq *ifipfr;
ifipfr = (struct rtems_ifinputreq *)data;
ifipfr->old_if_input = ifp->if_input;
ifp->if_input_arg = ifipfr->arg;
(*ifipfr->init)(ifp, ifipfr->arg);
ifp->if_input = ifipfr->new_if_input;
error = 0;
} else {
return (EEXIST);
}
break;
#endif /* __rtems__ */
default:
error = ENOIOCTL;
break;

View File

@@ -354,13 +354,27 @@ struct ifnet {
if_snd_tag_query_t *if_snd_tag_query;
if_snd_tag_free_t *if_snd_tag_free;
#ifndef __rtems__
/*
* Spare fields to be added before branching a stable branch, so
* that structure can be enhanced without changing the kernel
* binary interface.
*/
int if_ispare[4]; /* general use */
#else /* __rtems__ */
void *if_input_arg;
#endif /* __rtems__ */
};
#ifdef __rtems__
struct rtems_ifinputreq {
char ifr_name[IFNAMSIZ];
void *arg;
void (*init)(struct ifnet *, void *);
void (*new_if_input)(struct ifnet *, struct mbuf *);
void (*old_if_input)(struct ifnet *, struct mbuf *);
};
#define RTEMS_SIOSIFINPUT _IOWR('i', 255, struct rtems_ifinputreq)
#endif /* __rtems__ */
/* for compatibility with other BSDs */
#define if_name(ifp) ((ifp)->if_xname)