[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 07/10: eth-multiplexer: Avoid copying data multiple times.
From: |
Samuel Thibault |
Subject: |
[hurd] 07/10: eth-multiplexer: Avoid copying data multiple times. |
Date: |
Sun, 19 Nov 2017 15:27:17 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 56957059d60d87e21d2369ffa9b017f9acc14458
Author: Justus Winter <address@hidden>
Date: Thu Sep 21 14:20:16 2017 +0200
eth-multiplexer: Avoid copying data multiple times.
* eth-multiplexer/vdev.c (broadcast_pack): Construct message just once.
(deliver_pack): Remove function.
(deliver_msg): Make function static.
* eth-multiplexer/vdev.h (deliver_{msg,pack}): Remove declarations.
---
eth-multiplexer/vdev.c | 35 +++++++++++++++--------------------
eth-multiplexer/vdev.h | 2 --
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c
index 7d5390b..367623d 100644
--- a/eth-multiplexer/vdev.c
+++ b/eth-multiplexer/vdev.c
@@ -193,29 +193,13 @@ destroy_vdev (void *port)
destroy_filters (&vdev->port_list);
}
+static int deliver_msg (struct net_rcv_msg *msg, struct vether_device *vdev);
+
/* Broadcast the packet to all virtual interfaces
* except the one the packet is from */
int
broadcast_pack (char *data, int datalen, struct vether_device *from_vdev)
{
- int internal_deliver_pack (struct vether_device *vdev)
- {
- /* Skip current interface. */
- if (from_vdev == vdev)
- return 0;
- /* Skip interfaces that are down. */
- if ((vdev->if_flags & IFF_UP) == 0)
- return 0;
- return deliver_pack (data, datalen, vdev);
- }
-
- return foreach_dev_do (internal_deliver_pack);
-}
-
-/* Create a message, and deliver it. */
-int
-deliver_pack (char *data, int datalen, struct vether_device *vdev)
-{
struct net_rcv_msg msg;
int pack_size;
struct ethhdr *header;
@@ -236,7 +220,18 @@ deliver_pack (char *data, int datalen, struct
vether_device *vdev)
packet->length = pack_size + sizeof (struct packet_header);
msg.packet_type.msgt_number = packet->length;
- return deliver_msg (&msg, vdev);
+ int internal_deliver_pack (struct vether_device *vdev)
+ {
+ /* Skip current interface. */
+ if (from_vdev == vdev)
+ return 0;
+ /* Skip interfaces that are down. */
+ if ((vdev->if_flags & IFF_UP) == 0)
+ return 0;
+ return deliver_msg (&msg, vdev);
+ }
+
+ return foreach_dev_do (internal_deliver_pack);
}
/* Broadcast the message to all virtual interfaces. */
@@ -265,7 +260,7 @@ broadcast_msg (struct net_rcv_msg *msg)
* Deliver the message to all right pfinet servers that
* connects to the virtual network interface.
*/
-int
+static int
deliver_msg(struct net_rcv_msg *msg, struct vether_device *vdev)
{
mach_msg_return_t err;
diff --git a/eth-multiplexer/vdev.h b/eth-multiplexer/vdev.h
index 85ecff5..8270fed 100644
--- a/eth-multiplexer/vdev.h
+++ b/eth-multiplexer/vdev.h
@@ -67,8 +67,6 @@ struct vether_device *lookup_dev_by_name (char *name);
int remove_dead_port_from_dev (mach_port_t dead_port);
struct vether_device *add_vdev (char *name, size_t size);
void destroy_vdev (void *port);
-int deliver_msg (struct net_rcv_msg *msg, struct vether_device *vdev);
-int deliver_pack (char *data, int datalen, struct vether_device *vdev);
boolean_t all_dev_close ();
int broadcast_pack (char *data, int datalen, struct vether_device *from_vdev);
int broadcast_msg (struct net_rcv_msg *msg);
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (796f878 -> 83fef6c), Samuel Thibault, 2017/11/19
- [hurd] 02/10: libdiskfs: Improve error message., Samuel Thibault, 2017/11/19
- [hurd] 03/10: eth-multiplexer: Remove unused function., Samuel Thibault, 2017/11/19
- [hurd] 06/10: eth-multiplexer: Remove unused macro., Samuel Thibault, 2017/11/19
- [hurd] 09/10: pfinet: Fix array size hardcoded value, Samuel Thibault, 2017/11/19
- [hurd] 01/10: fshelp: Fix fetching control ports., Samuel Thibault, 2017/11/19
- [hurd] 08/10: pfinet: Avoid returning udp errors unless requested, Samuel Thibault, 2017/11/19
- [hurd] 10/10: Make devprobe able to talk with userland drivers, Samuel Thibault, 2017/11/19
- [hurd] 05/10: eth-multiplexer: Fix debug macro., Samuel Thibault, 2017/11/19
- [hurd] 04/10: eth-multiplexer: Simplify device creation., Samuel Thibault, 2017/11/19
- [hurd] 07/10: eth-multiplexer: Avoid copying data multiple times.,
Samuel Thibault <=