public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* network load 8245 vs. 8347E
@ 2007-06-21 14:15 Marc Leeman
  2007-06-21 15:33 ` Kumar Gala
  0 siblings, 1 reply; 12+ messages in thread
From: Marc Leeman @ 2007-06-21 14:15 UTC (permalink / raw)
  To: linuxppc-dev


[-- Attachment #1.1: Type: text/plain, Size: 804 bytes --]

Ok, I guess it's comparing apples to lemons here, but I'll have a go at
it anyway.

I'm trying to figure out why partial network decoding on an 8347E is
disappointingly slow wrt an older 8245 processor.

When simply receiving (cf. att) a multicast stream of 12 Mbps, an
8245/uclibc 0.9.28 @350 MHz, ppc arch , the system runs smoothly at a
load of around 4% on a e100 based MAC (pci:  8086:1209 ).

When doing the same thing on 8347e/0.9.28 @400 Mhz, powerpc arch, the
system is loaded at around 34%.

any clues?


This program just takes in data and does nothing with it, to limit the
search area :)

-- 
  greetz, marc
You know until today, I never really realized how much I love my feet.
	Chiana - Vitas Mortis
chiana 2.6.18-4-ixp4xx #1 Tue Mar 27 18:01:56 BST 2007 GNU/Linux

[-- Attachment #1.2: recv_mcast.c --]
[-- Type: text/x-csrc, Size: 3067 bytes --]

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFSIZE 64*1024 /*  Maximal packet content is 64k bytes */
#define MAXPARAMLEN 80

void error(char *msg);

int main(int argc, char *argv[]) 
{
	int socket_val, bind_val, recvfromval, ctrlboardlen, cameralen,
	    i, rc, recvbuff, optlen;
	u_short ctrlboardPort;
	struct ip_mreq mreq;
	struct sockaddr_in ctrlboard, camera;
	struct in_addr mcast_address;
	struct hostent *h;
	unsigned char buffer[BUFSIZE], ctrlboardip[16], sendseq[11];
	FILE *fc,*fp;

	/*  Initialize the buffer */
	bzero(buffer,BUFSIZE);

	if(argc!=3) {
		fprintf(stdout,"usage : %s <mcast address> <mcast port>\n",argv[0]);
		exit(0);
	}

	/*  Get mcast address to listen to  */
	h=gethostbyname(argv[1]);
	if(h==NULL) {
		fprintf(stdout,"Unknown group %s\n",ctrlboardip);
		exit(1);
	}
	ctrlboardPort=atoi(argv[2]);

	memcpy(&mcast_address, h->h_addr_list[0],h->h_length);

	/*  Check given address is multicast  */
	if(!IN_MULTICAST(ntohl(mcast_address.s_addr))) {
		fprintf(stdout,"Given address '%s' is not multicast\n",
				inet_ntoa(mcast_address));
		exit(1);
	}

	/*  Create socket for incoming connections */
	socket_val=socket(AF_INET, SOCK_DGRAM, 0);
	if (socket_val < 0)
		error("Error opening socket");

	/*  Set content of ctrlboard */
	ctrlboardlen = sizeof(ctrlboard);
	bzero(&ctrlboard,ctrlboardlen);

	/*  Fill in the UDP Receiver properties */
	ctrlboard.sin_family=AF_INET;
	ctrlboard.sin_addr.s_addr=htonl(INADDR_ANY);
	ctrlboard.sin_port=htons(ctrlboardPort);

	/*  Set socket options */
	recvbuff=128*1024;
	if (setsockopt(socket_val,SOL_SOCKET,SO_RCVBUF,(char *) &recvbuff, sizeof(recvbuff)) < 0)
	error("Error setting socket options");

	/*  Get socket options */
	optlen=sizeof(recvbuff);
	if (getsockopt(socket_val,SOL_SOCKET,SO_RCVBUF,(char *) &recvbuff, &optlen) < 0)
	error("Error getting socket options");
	fprintf(stdout,"Receive buffer size: %d \n",recvbuff);  
	
	/*  Bind to associate port number with the socket */
	bind_val = bind(socket_val,(struct sockaddr *)&ctrlboard,ctrlboardlen);
	if (bind_val < 0)
		error("Error bind");

	/* join multicast group */
	mreq.imr_multiaddr.s_addr=mcast_address.s_addr;
	mreq.imr_interface.s_addr=htonl(INADDR_ANY);

	rc = setsockopt(socket_val,IPPROTO_IP,IP_ADD_MEMBERSHIP, (void *) &mreq, sizeof(mreq));
	if(rc<0) 
	{
		fprintf(stdout,"Cannot join multicast group '%s'", inet_ntoa(mcast_address));
		exit(1);
	}
	else
		fprintf(stdout,"Listening to mgroup %s:%d\n", inet_ntoa(mcast_address), ctrlboardPort);

	/*  Fill in length of struct sockaddr_in camera */
	cameralen = sizeof(camera);

	/*  Loop */
	while (1) {
		recvfromval = recvfrom(socket_val,buffer,BUFSIZE,0,(struct sockaddr *)&camera,&cameralen);
		if (recvfromval < 0) error("Error recvfrom");
	}

	close(socket_val);
	fclose(fp);
}

void error(char *msg) {

  perror(msg);
  exit(0);
}


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-07-10  7:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 14:15 network load 8245 vs. 8347E Marc Leeman
2007-06-21 15:33 ` Kumar Gala
2007-06-21 15:56   ` Marc Leeman
2007-06-21 17:13     ` Marc Leeman
     [not found]       ` <467ABCDC.8060401@genesi-usa.com>
2007-06-21 18:33         ` Marc Leeman
2007-06-21 18:53           ` Matt Sealey
2007-06-21 19:09             ` Marc Leeman
2007-06-28 18:06       ` 2.4/2.6/ppc/powerpc/8245/8347e Marc Leeman
2007-06-29 14:59         ` 2.4/2.6/ppc/powerpc/8245/8347e Marc Leeman
2007-07-09 15:47           ` 2.4/2.6/ppc/powerpc/8245/8347e Marc Leeman
2007-07-09 19:56             ` 2.4/2.6/ppc/powerpc/8245/8347e Linas Vepstas
2007-07-10  7:55               ` 2.4/2.6/ppc/powerpc/8245/8347e Marc Leeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox