src/dpdk/drivers/net/txgbe/base/txgbe_hw.c
s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg,
		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
{
	if ((!(adv_reg)) ||  (!(lp_reg))) {
		DEBUGOUT("Local or link partner's advertised flow control "
			      "settings are NULL. Local: %x, link partner: %x\n",
			      adv_reg, lp_reg);
		return TXGBE_ERR_FC_NOT_NEGOTIATED;
	}

	if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) {
		/*
		 * Now we need to check if the user selected Rx ONLY
		 * of pause frames.  In this case, we had to advertise
		 * FULL flow control because we could not advertise RX
		 * ONLY. Hence, we must now check to see if we need to
		 * turn OFF the TRANSMISSION of PAUSE frames.
		 */
		if (hw->fc.requested_mode == txgbe_fc_full) {
			hw->fc.current_mode = txgbe_fc_full;
			DEBUGOUT("Flow Control = FULL.\n");
		} else {
			hw->fc.current_mode = txgbe_fc_rx_pause;
			DEBUGOUT("Flow Control=RX PAUSE frames only\n");
		}
	} else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) &&
		   (lp_reg & lp_sym) && (lp_reg & lp_asm)) {
		hw->fc.current_mode = txgbe_fc_tx_pause;
		DEBUGOUT("Flow Control = TX PAUSE frames only.\n");
	} else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) &&
		   !(lp_reg & lp_sym) && (lp_reg & lp_asm)) {
		hw->fc.current_mode = txgbe_fc_rx_pause;
		DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
	} else {
		hw->fc.current_mode = txgbe_fc_none;
		DEBUGOUT("Flow Control = NONE.\n");
	}
	return 0;
}
/**
 *  txgbe_negotiate_fc - Negotiate flow control
 *  @hw: pointer to hardware structure
 *  @adv_reg: flow control advertised settings
 *  @lp_reg: link partner's flow control settings
 *  @adv_sym: symmetric pause bit in advertisement
 *  @adv_asm: asymmetric pause bit in advertisement
 *  @lp_sym: symmetric pause bit in link partner advertisement
 *  @lp_asm: asymmetric pause bit in link partner advertisement
 *
 *  Find the intersection between advertised settings and link partner's
 *  advertised settings
 **/


Find the intersection between advertised settings and link partner's
advertised settings
Find the intersection between advertised settings and link partner ' s advertised settings
s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg,
		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
{
	if ((!(adv_reg)) ||  (!(lp_reg))) {
		DEBUGOUT("Local or link partner's advertised flow control "
			      "settings are NULL. Local: %x, link partner: %x\n",
			      adv_reg, lp_reg);
		return TXGBE_ERR_FC_NOT_NEGOTIATED;
	}
	if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) {
		if (hw->fc.requested_mode == txgbe_fc_full) {
			hw->fc.current_mode = txgbe_fc_full;
			DEBUGOUT("Flow Control = FULL.\n");
		} else {
			hw->fc.current_mode = txgbe_fc_rx_pause;
			DEBUGOUT("Flow Control=RX PAUSE frames only\n");
		}
	} else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) &&
		   (lp_reg & lp_sym) && (lp_reg & lp_asm)) {
		hw->fc.current_mode = txgbe_fc_tx_pause;
		DEBUGOUT("Flow Control = TX PAUSE frames only.\n");
	} else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) &&
		   !(lp_reg & lp_sym) && (lp_reg & lp_asm)) {
		hw->fc.current_mode = txgbe_fc_rx_pause;
		DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
	} else {
		hw->fc.current_mode = txgbe_fc_none;
		DEBUGOUT("Flow Control = NONE.\n");
	}
	return 0;
}
s32 txgbe_negotiate_fc ( struct txgbe_hw * hw , u32 adv_reg , u32 lp_reg , u32 adv_sym , u32 adv_asm , u32 lp_sym , u32 lp_asm ) { if ( ( ! ( adv_reg ) ) || ( ! ( lp_reg ) ) ) { DEBUGOUT ( " " " \n " , adv_reg , lp_reg ) ; return TXGBE_ERR_FC_NOT_NEGOTIATED ; } if ( ( adv_reg & adv_sym ) && ( lp_reg & lp_sym ) ) { if ( hw -> fc . requested_mode == txgbe_fc_full ) { hw -> fc . current_mode = txgbe_fc_full ; DEBUGOUT ( " \n " ) ; } else { hw -> fc . current_mode = txgbe_fc_rx_pause ; DEBUGOUT ( " \n " ) ; } } else if ( ! ( adv_reg & adv_sym ) && ( adv_reg & adv_asm ) && ( lp_reg & lp_sym ) && ( lp_reg & lp_asm ) ) { hw -> fc . current_mode = txgbe_fc_tx_pause ; DEBUGOUT ( " \n " ) ; } else if ( ( adv_reg & adv_sym ) && ( adv_reg & adv_asm ) && ! ( lp_reg & lp_sym ) && ( lp_reg & lp_asm ) ) { hw -> fc . current_mode = txgbe_fc_rx_pause ; DEBUGOUT ( " \n " ) ; } else { hw -> fc . current_mode = txgbe_fc_none ; DEBUGOUT ( " \n " ) ; } return 0 ; }
txgbe_negotiate_fc - Negotiate flow control
  @hw: pointer to hardware structure
  @adv_reg: flow control advertised settings
  @lp_reg: link partner's flow control settings
  @adv_sym: symmetric pause bit in advertisement
  @adv_asm: asymmetric pause bit in advertisement
  @lp_sym: symmetric pause bit in link partner advertisement
  @lp_asm: asymmetric pause bit in link partner advertisement
txgbe_negotiate_fc - Negotiate flow control @hw : pointer to hardware structure @adv_reg : flow control advertised settings @lp_reg : link partner ' s flow control settings @adv_sym : symmetric pause bit in advertisement @adv_asm : asymmetric pause bit in advertisement @lp_sym : symmetric pause bit in link partner advertisement @lp_asm : asymmetric pause bit in link partner advertisement
/*
		 * Now we need to check if the user selected Rx ONLY
		 * of pause frames.  In this case, we had to advertise
		 * FULL flow control because we could not advertise RX
		 * ONLY. Hence, we must now check to see if we need to
		 * turn OFF the TRANSMISSION of PAUSE frames.
		 */