[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 11 Nov 2008 19:08:27 +0100
From: "Johann Baudy" <johaahn@...il.com>
To: "Lovich, Vitali" <vlovich@...lcomm.com>
Cc: "Evgeniy Polyakov" <zbr@...emap.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] Packet socket: mmapped IO: PACKET_TX_RING
Hi Vitali,
> If the user places a 1 KB packet into the buffer, but then when we try to send it, it turns out the mtu is too small (or something like that), if we don't clear the flag back to TP_STATUS_KERNEL and just return an error, the user will never know.
>
> --------------------------------------
> 0 | 1 KB frame - status = TP_STATUS_USER |
> --------------------------------------
> 1 | 1 KB frame - status = TP_STATUS_USER |
> --------------------------------------
> Etc
>
> So when the user fills up the ring buffer and goes back to frame 0, he won't know that that packet was actually fatally rejected (i.e. the kernel moved on) and will just block waiting for the status to clear (which it never will). Similarly in the case where the packet gets rejected for being too small.
>
> In other words, when the kernel doesn't send a packet but moves on and doesn't keep trying (as would be the case for the packet size being too small or too big because that is considered an irrecoverable error), it has to notify the user by clearing that status flag for that frame.
>
If there is an error in packet_skb_fill, it returns a negative value
as error code. If a negative value is returned from packet_skb_fill we
exit send() procedure and set status of packet to TP_STATUS_USER.
(this is how error is handled in my last code (not sure committed
one)).
Do you want to introduce a new packet status that marks packet as
ERROR (with TP_STATUS_LOOSING for example?). This way user will be
able to determine easily the one which is failing?
PS: I need to test my last code at office and I'll send it.
Best regards,
Johann
--
Johann Baudy
johaahn@...il.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists