public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Cc: "Martin Hundebøll" <martin@hundeboll.net>
Subject: Re: [B.A.T.M.A.N.] [PATCHv3 2/3] batman-adv: Receive fragmented packets and merge
Date: Tue, 21 May 2013 21:10:11 +0200	[thread overview]
Message-ID: <20130521191011.GA3435@ritirata.org> (raw)
In-Reply-To: <1369133299-8325-3-git-send-email-martin@hundeboll.net>

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On Tue, May 21, 2013 at 12:48:18PM +0200, Martin Hundebøll wrote:
> +bool batadv_frag_skb_fwd(struct sk_buff *skb,
> +			 struct batadv_hard_iface *recv_if,
> +			 struct batadv_orig_node *orig_node_src)
> +{
> +	struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
> +	struct batadv_orig_node *orig_node_dst = NULL;
> +	struct batadv_neigh_node *neigh_node = NULL;
> +	struct batadv_frag_packet *packet;
> +	uint16_t total_size;
> +	bool ret = false;
> +
> +	packet = (struct batadv_frag_packet *)skb->data;
> +	orig_node_dst = batadv_orig_hash_find(bat_priv, packet->dest);
> +	if (!orig_node_dst)
> +		goto out;
> +
> +	neigh_node = batadv_find_router(bat_priv, orig_node_dst, recv_if);
> +	if (!neigh_node)
> +		goto out;
> +
> +	/* Forward the fragment, if the merged packet would be too big to
> +	 * be assembled.
> +	 */
> +	total_size = ntohs(packet->total_size) + ETH_HLEN;
> +	if (total_size > neigh_node->if_incoming->net_dev->mtu) {

I guess here you forgot to remove the ETH_LEN from the total_size computation.

> +		batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_FWD);
> +		batadv_add_counter(bat_priv, BATADV_CNT_FRAG_FWD_BYTES,
> +				   skb->len + ETH_HLEN);

and here should ETH_HLEN be counted in the amount of bytes sent?

Moreover we are always avoiding third person in kernel doc ("Returns" should be
"Return" and so on..) and you should not put () (in the kernel doc).


Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-05-21 19:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 10:48 [B.A.T.M.A.N.] [PATCHv3 0/3] Fragmentation version 2 Martin Hundebøll
2013-05-21 10:48 ` [B.A.T.M.A.N.] [PATCHv3 1/3] batman-adv: Remove old fragmentation code Martin Hundebøll
2013-05-21 10:48 ` [B.A.T.M.A.N.] [PATCHv3 2/3] batman-adv: Receive fragmented packets and merge Martin Hundebøll
2013-05-21 19:10   ` Antonio Quartulli [this message]
2013-05-23  5:07     ` Martin Hundebøll
2013-05-21 10:48 ` [B.A.T.M.A.N.] [PATCHv3 3/3] batman-adv: Fragment and send skbs larger than mtu Martin Hundebøll
2013-05-21 19:19   ` Antonio Quartulli
2013-05-23  5:38     ` Martin Hundebøll
2013-05-23  7:29       ` Antonio Quartulli
2013-05-23  8:46         ` Antonio Quartulli
2013-05-23  8:51 ` [B.A.T.M.A.N.] [PATCHv3 0/3] Fragmentation version 2 Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130521191011.GA3435@ritirata.org \
    --to=ordex@autistici.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=martin@hundeboll.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox