OpenCores
URL https://opencores.org/ocsvn/fade_ether_protocol/fade_ether_protocol/trunk

Subversion Repositories fade_ether_protocol

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /fade_ether_protocol/trunk
    from Rev 20 to Rev 21
    Reverse comparison

Rev 20 → Rev 21

/experimental_jumbo_frames_version/linux/fpga_l3_fade.c
281,6 → 281,51
mutex_unlock(&sd->usercmd_lock);
return result;
}
/* Function used to send RESET command (without confirmation, as
the core is reinitialized and can't send confirmation) */
static inline
long send_reset(slave_data * sd)
{
struct sk_buff *newskb = NULL;
uint8_t * my_data = NULL;
//First check, if the Ethernet device is claimed, otherwise return an error
if(sd->dev==NULL) return -ENODEV;
//Each slave may perform only one user command, so first check, if no other thread
//attempts to send the command
if ( mutex_trylock(&sd->usercmd_lock)==0) return -EBUSY;
//Mutex acquired, we can proceed
//First allocate the sequence number for the command
sd->cmd_seq = 0;
sd->cmd_code = FCMD_RESET;
sd->cmd_ack = 0; //We don't wait for response
//Send the packet
newskb = alloc_skb(LL_RESERVED_SPACE(sd->dev)+MY_ACK_LEN, GFP_KERNEL);
skb_reserve(newskb,LL_RESERVED_SPACE(sd->dev));
skb_reset_network_header(newskb);
newskb->dev = sd->dev;
newskb->protocol = htons(MY_PROTO_ID);
//Build the MAC header for the new packet
// Tu http://lxr.linux.no/linux+*/net/ipv4/arp.c#L586 jest pokazane jak zbudować pakiet!
if (dev_hard_header(newskb,sd->dev,MY_PROTO_ID,&sd->mac,sd->dev->dev_addr,MY_ACK_LEN+ETH_HLEN) < 0)
{
kfree_skb(newskb);
return -EINVAL;
}
//Put the protocol version id to the packet
put_skb_u16(newskb,MY_PROTO_VER);
//Put the command code
put_skb_u16(newskb,sd->cmd_code);
//Put the sequence number
put_skb_u16(newskb,sd->cmd_seq);
//Put the argument
put_skb_u32(newskb,0);
//Fill the packet
my_data = skb_put(newskb,MY_ACK_LEN-10);
memset(my_data,0xa5,MY_ACK_LEN-10);
dev_queue_xmit(newskb);
mutex_unlock(&sd->usercmd_lock);
return SUCCESS;
}
 
/* Function free_mac may be safely called even if the MAC was not taken
it checks sd->active to detect such situation
383,7 → 428,7
}
case L3_V1_IOC_RESETMAC: //Reset MAC so, that it stops transmission immediately
{
return send_cmd(sd,FCMD_RESET,0,NULL,100,2);
return send_reset(sd);
}
case L3_V1_IOC_GETMAC: //Open the slave
{
/experimental_jumbo_frames_version/linux/receiver2t.c
138,7 → 138,7
exit(1);
}
}
//Start the transmission
//Connect to appropriate FPGAs
for(i=0;i<=2;i++) {
if(active[i]) {
res = ioctl(frs[i],L3_V1_IOC_GETMAC,&sl[i]);
151,6 → 151,21
leave[i]=1;
}
}
//Send FADE reset command, so that FADE core is in predictable state
for(i=0;i<=2;i++) {
if(active[i]) {
int j;
for(j=0;j<3;j++) {
res = ioctl(frs[i],L3_V1_IOC_RESETMAC,&sl[i]);
if(res<0) {
printf("I couldn't RESET Ethernet device %d\n",i);
exit(1);
}
}
} else {
leave[i]=1;
}
}
//Start the second thread, which uses user commands
pthread_create(&ucmd_thread, NULL, user_cmd_thread, NULL);
int first_served=0;
/experimental_jumbo_frames_version/fpga/kc705/kc705_fade_top.vhd
624,7 → 624,7
 
process (Clk_user, rst_n)
begin -- process
if rst_n = '0' then -- asynchronous reset (active low)
if fade_rst_n = '0' then -- asynchronous reset (active low)
test_dta <= (others => '0');
td_del0 <= '0';
td_del1 <= '0';

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.