On Thu, Dec 03, 2015 at 06:07:41PM +0100, Alexandr Nedvedicky wrote:
> +#ifdef _KERNEL
> +extern struct taskq *softnettq;
> +#endif /* _KERNEL */
> #endif /* _NET_IF_H_ */
I think this should go to net/if_var.h
> +static void
> +ip_send_dispatch(void *cx)
> +{
Maybe you should pass NULL here and use the global ipsend_mq.
ip_send() also uses the global and would make it symmetric.
> + struct mbuf *m;
> + struct mbuf_list ml;
> + int s;
> +
> + mq_delist((struct mbuf_queue *)cx, &ml);
> + s = splsoftnet();
> + KERNEL_LOCK();
> + while ((m = ml_dequeue(&ml)) != NULL) {
> + ip_output(m, NULL, NULL, 0, NULL, NULL, 0);
> + }
> + KERNEL_UNLOCK();
> + splx(s);
> +}
kettenis@ said in another mail that it is better to grab the lock
before splsoftnet(). Your code is spinning with soft net interrupts
disabled.
> --- netinet/ip_var.h 16 Jul 2015 21:14:21 -0000 1.60
> +++ netinet/ip_var.h 3 Dec 2015 17:06:33 -0000
> @@ -180,6 +180,8 @@ void ip_freef(struct ipq *);
> void ip_freemoptions(struct ip_moptions *);
> int ip_getmoptions(int, struct ip_moptions *, struct mbuf **);
> void ip_init(void);
> +struct mbuf*
> + ip_insertoptions(struct mbuf *, struct mbuf *, int *);
As you add the prototype here, you should remove it from
netinet/ip_output.c.
> +static struct task ip6send_task = TASK_INITIALIZER(ip6_send_dispatch,
> &ip6send_mq);
Line too long.
> + mq_delist((struct mbuf_queue *)cx, &ml);
> + s = splsoftnet();
> + KERNEL_LOCK();
> + while ((m = ml_dequeue(&ml)) != NULL) {
> + ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, NULL);
> + }
> + KERNEL_UNLOCK();
> + splx(s);
Use global ip6send_mq?
Swap spl and lock.
> --- netinet6/ip6_var.h 25 Oct 2015 14:43:06 -0000 1.56
> +++ netinet6/ip6_var.h 3 Dec 2015 17:06:33 -0000
> @@ -275,6 +275,7 @@ int ip6_setpktopts(struct mbuf *, struct
> void ip6_clearpktopts(struct ip6_pktopts *, int);
> void ip6_randomid_init(void);
> u_int32_t ip6_randomid(void);
> +void ip6_send(struct mbuf *);
>
> int route6_input(struct mbuf **, int *, int);
You have tab and space, other functions only have tab.