dpdk-kvs/cvmcs-kvs-main.c
/**
 * \brief Process the packets received from the host
 *
 * @param wqe Work
 * @return COMP_CONSUMED is the packet was successfully switched in the
 *         FastPath.
 *         COMP_NOT_HANDLED if the packet was not handled and should 
 *         be sent to slowPath for further processing.
 */
\brief Process the packets received from the host
@param wqe Work
@return COMP_CONSUMED is the packet was successfully switched in the
FastPath.
COMP_NOT_HANDLED if the packet was not handled and should
be sent to slowPath for further processing.
\ brief Process the packets received from the host @param wqe Work @return COMP_CONSUMED is the packet was successfully switched in the FastPath . COMP_NOT_HANDLED if the packet was not handled and should be sent to slowPath for further processing .
int kvs_process_host_packet(cvmx_wqe_t * wqe)
{
    printf("Host packet received in KVS component\n");
	vnic_port_info_t *nicport;
	cvmcs_nic_metadata_t *mdata = CVMCS_NIC_METADATA(wqe);
    int l3_off = 0, l4_off = 0;
    if (!OCTEON_IS_MODEL(OCTEON_CN78XX) && !OCTEON_IS_MODEL(OCTEON_CN73XX))
    	return COMP_NOT_HANDLED;
	cvmcs_kvs_mdata_host_init(wqe);
	if (ISPF(mdata->from_ifidx))
	{
    	printf("PF packet received in KVS component\n");
		return COMP_NOT_HANDLED;
	}
	printf("VF packet received in KVS component, sending it to wire myself\n");
	nicport = &octnic->port[mdata->from_ifidx];
	if (cvmx_unlikely(nicport->linfo.link.s.link_up == 0)) {
		return COMP_DROP;
	}
	cvmcs_kvs_parse_mdata(wqe);
    cvmcs_kvs_mdata_offload(wqe, &l3_off, &l4_off);
    kvs_send_packet_to_phys_port(wqe, mdata->from_ifidx, 
            l3_off, l4_off, mdata->flags);
    return COMP_CONSUMED;
}
int kvs_process_host_packet ( cvmx_wqe_t * wqe ) { printf ( " \n " ) ; vnic_port_info_t * nicport ; cvmcs_nic_metadata_t * mdata = CVMCS_NIC_METADATA ( wqe ) ; int l3_off = 0 , l4_off = 0 ; if ( ! OCTEON_IS_MODEL ( OCTEON_CN78XX ) && ! OCTEON_IS_MODEL ( OCTEON_CN73XX ) ) return COMP_NOT_HANDLED ; cvmcs_kvs_mdata_host_init ( wqe ) ; if ( ISPF ( mdata -> from_ifidx ) ) { printf ( " \n " ) ; return COMP_NOT_HANDLED ; } printf ( " \n " ) ; nicport = & octnic -> port [ mdata -> from_ifidx ] ; if ( cvmx_unlikely ( nicport -> linfo . link . s . link_up == 0 ) ) { return COMP_DROP ; } cvmcs_kvs_parse_mdata ( wqe ) ; cvmcs_kvs_mdata_offload ( wqe , & l3_off , & l4_off ) ; kvs_send_packet_to_phys_port ( wqe , mdata -> from_ifidx , l3_off , l4_off , mdata -> flags ) ; return COMP_CONSUMED ; }
\brief Process the packets received from the host
 @param wqe Work
 @return COMP_CONSUMED is the packet was successfully switched in the
         FastPath.
\ brief Process the packets received from the host @param wqe Work @return COMP_CONSUMED is the packet was successfully switched in the FastPath .
/* Init metadata before main processing  */ /* Don't touch the PF traffic */ /* Packet was not handled in this component and needs further processing
		When we are *not* returning this return code, we need to be sure that packet is 
		definitely ours or bad things will happen */ // if (<not my packet>) //	return COMP_NOT_HANDLED; /* Don't do spoof-checking for now */ // if (cvmcs_nic_run_spoofcheck(wqe)) { // 	DBG("spoof src mac detected: from_ifidx=%d, mymac=%lx\n", // 	    mdata->from_ifidx,  octnic->port[mdata->from_ifidx].user_set_macaddr); // 	per_core_stats[cvmx_get_core_num()].link_stats[mdata->from_ifidx].fromhost.fw_err_drop += 1; // 	per_core_stats[cvmx_get_core_num()].vf_stats[mdata->from_ifidx].spoofmac_cnt += 1; // 	return COMP_DROP; // } //cvmx_atomic_add_u64(&nicport->stats.fromhost.fw_err_link, 1); /* Packet was consumed, no need to do further processing */