netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* packet sockets and dev_get_by_name
@ 2002-10-16  7:13 Ben Greear
  0 siblings, 0 replies; only message in thread
From: Ben Greear @ 2002-10-16  7:13 UTC (permalink / raw)
  To: 'netdev@oss.sgi.com'

It appears that the the

  static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg, int len,
			       struct scm_cookie *scm)

method in net/packet/af_packet.c does a dev_get_by_name on each packet sent.
...
	/*
	 *	Find the device first to size check it
	 */

	saddr->spkt_device[13] = 0;
	dev = dev_get_by_name(saddr->spkt_device);
	err = -ENODEV;
	if (dev == NULL)
		goto out_unlock;

The packet_sendmsg does a dev_get_by_index, which is also a linear walk...


Think it would be worth optimizing this?  Seems if we hashed devices
on their index, and then (for packet_sendmsg_spkt) cached the last device
we found for a name in the socket, we could make this more like O(1).

Ben

-- 
Ben Greear <greearb@candelatech.com>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-16  7:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-16  7:13 packet sockets and dev_get_by_name Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).