Skip to content

Commit b2abd4c

Browse files
Paul Gortmakerdavem330
authored andcommitted
tipc: Optimize handling excess content on incoming messages
Remove code that trimmed excess trailing info from incoming messages arriving over an Ethernet interface. TIPC now ignores the extra info while the message is being processed by the node, and only trims it off if the message is retransmitted to another node. (This latter step is done to ensure the extra info doesn't cause the sk_buff to exceed the outgoing interface's MTU limit.) The outgoing buffer is guaranteed to be linear. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fb621ba commit b2abd4c

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

‎net/tipc/eth_media.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
101101
* Accept only packets explicitly sent to this node, or broadcast packets;
102102
* ignores packets sent using Ethernet multicast, and traffic sent to other
103103
* nodes (which can happen if interface is running in promiscuous mode).
104-
* Routine truncates any Ethernet padding/CRC appended to the message,
105-
* and ensures message size matches actual length
106104
*/
107105

108106
static int recv_msg(struct sk_buff *buf, struct net_device *dev,
109107
struct packet_type *pt, struct net_device *orig_dev)
110108
{
111109
struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
112-
u32 size;
113110

114111
if (!net_eq(dev_net(dev), &init_net)) {
115112
kfree_skb(buf);
@@ -118,13 +115,9 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
118115

119116
if (likely(eb_ptr->bearer)) {
120117
if (likely(buf->pkt_type <= PACKET_BROADCAST)) {
121-
size = msg_size((struct tipc_msg *)buf->data);
122-
skb_trim(buf, size);
123-
if (likely(buf->len == size)) {
124-
buf->next = NULL;
125-
tipc_recv_msg(buf, eb_ptr->bearer);
126-
return 0;
127-
}
118+
buf->next = NULL;
119+
tipc_recv_msg(buf, eb_ptr->bearer);
120+
return 0;
128121
}
129122
}
130123
kfree_skb(buf);

‎net/tipc/net.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ void tipc_net_route_msg(struct sk_buff *buf)
248248

249249
/* Handle message for another node */
250250
msg_dbg(msg, "NET>SEND>: ");
251+
skb_trim(buf, msg_size(msg));
251252
tipc_link_send(buf, dnode, msg_link_selector(msg));
252253
}
253254

0 commit comments

Comments
 (0)