[dpdk-dev] igb: handle VF LPE mailbox message

Message ID 1426680091-26328-1-git-send-email-sergio.gonzalez.monroy@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sergio Gonzalez Monroy March 18, 2015, 12:01 p.m. UTC
  This patch adds the handle function for the LPE mailbox message (VF to
PF) to set maximum packet size, which can be used to enable jumbo
frame support.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
 lib/librte_pmd_e1000/igb_pf.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
  

Comments

Sergio Gonzalez Monroy March 18, 2015, 12:04 p.m. UTC | #1
On 18/03/2015 12:01, Sergio Gonzalez Monroy wrote:
> This patch adds the handle function for the LPE mailbox message (VF to
> PF) to set maximum packet size, which can be used to enable jumbo
> frame support.
>
> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> ---
>   lib/librte_pmd_e1000/igb_pf.c | 28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
>
> diff --git a/lib/librte_pmd_e1000/igb_pf.c b/lib/librte_pmd_e1000/igb_pf.c
> index bc3816a..2d49379 100644
> --- a/lib/librte_pmd_e1000/igb_pf.c
> +++ b/lib/librte_pmd_e1000/igb_pf.c
> @@ -395,6 +395,31 @@ igb_vf_set_vlan(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
>   }
>   
>   static int
> +igb_vf_set_rlpml(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
> +{
> +	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +	uint16_t rlpml = msgbuf[1] & E1000_VMOLR_RLPML_MASK;
> +	uint32_t max_frame = rlpml + ETHER_HDR_LEN + ETHER_CRC_LEN;
> +	uint32_t vmolr;
> +
> +	if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN))
> +		return -1;
> +
> +	vmolr = E1000_READ_REG(hw, E1000_VMOLR(vf));
> +
> +	vmolr &= ~E1000_VMOLR_RLPML_MASK;
> +	vmolr |= rlpml;
> +
> +	/* Enable Long Packet support */
> +	vmolr |= E1000_VMOLR_LPE;
> +
> +	E1000_WRITE_REG(hw, E1000_VMOLR(vf), vmolr);
> +	E1000_WRITE_FLUSH(hw);
> +
> +	return 0;
> +}
> +
> +static int
>   igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
>   {
>   	uint16_t mbx_size = E1000_VFMAILBOX_SIZE;
> @@ -428,6 +453,9 @@ igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
>   	case E1000_VF_SET_MULTICAST:
>   		retval = igb_vf_set_multicast(dev, vf, msgbuf);
>   		break;
> +	case E1000_VF_SET_LPE:
> +		retval = igb_vf_set_rlpml(dev, vf, msgbuf);
> +		break;
>   	case E1000_VF_SET_VLAN:
>   		retval = igb_vf_set_vlan(dev, vf, msgbuf);
>   		break;
This patch is targeting 2.1 release.

Sergio
  
Ananyev, Konstantin March 18, 2015, 4:01 p.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez Monroy
> Sent: Wednesday, March 18, 2015 12:02 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] igb: handle VF LPE mailbox message
> 
> This patch adds the handle function for the LPE mailbox message (VF to
> PF) to set maximum packet size, which can be used to enable jumbo
> frame support.
> 
> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> ---
>  lib/librte_pmd_e1000/igb_pf.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/lib/librte_pmd_e1000/igb_pf.c b/lib/librte_pmd_e1000/igb_pf.c
> index bc3816a..2d49379 100644
> --- a/lib/librte_pmd_e1000/igb_pf.c
> +++ b/lib/librte_pmd_e1000/igb_pf.c
> @@ -395,6 +395,31 @@ igb_vf_set_vlan(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
>  }
> 
>  static int
> +igb_vf_set_rlpml(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
> +{
> +	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +	uint16_t rlpml = msgbuf[1] & E1000_VMOLR_RLPML_MASK;
> +	uint32_t max_frame = rlpml + ETHER_HDR_LEN + ETHER_CRC_LEN;
> +	uint32_t vmolr;
> +
> +	if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN))
> +		return -1;
> +
> +	vmolr = E1000_READ_REG(hw, E1000_VMOLR(vf));
> +
> +	vmolr &= ~E1000_VMOLR_RLPML_MASK;
> +	vmolr |= rlpml;
> +
> +	/* Enable Long Packet support */
> +	vmolr |= E1000_VMOLR_LPE;
> +
> +	E1000_WRITE_REG(hw, E1000_VMOLR(vf), vmolr);
> +	E1000_WRITE_FLUSH(hw);
> +
> +	return 0;
> +}
> +
> +static int
>  igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
>  {
>  	uint16_t mbx_size = E1000_VFMAILBOX_SIZE;
> @@ -428,6 +453,9 @@ igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
>  	case E1000_VF_SET_MULTICAST:
>  		retval = igb_vf_set_multicast(dev, vf, msgbuf);
>  		break;
> +	case E1000_VF_SET_LPE:
> +		retval = igb_vf_set_rlpml(dev, vf, msgbuf);
> +		break;
>  	case E1000_VF_SET_VLAN:
>  		retval = igb_vf_set_vlan(dev, vf, msgbuf);
>  		break;
> --
> 1.9.3
  
Thomas Monjalon April 28, 2015, 4:19 p.m. UTC | #3
> > This patch adds the handle function for the LPE mailbox message (VF to
> > PF) to set maximum packet size, which can be used to enable jumbo
> > frame support.
> > 
> > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_pmd_e1000/igb_pf.c b/lib/librte_pmd_e1000/igb_pf.c
index bc3816a..2d49379 100644
--- a/lib/librte_pmd_e1000/igb_pf.c
+++ b/lib/librte_pmd_e1000/igb_pf.c
@@ -395,6 +395,31 @@  igb_vf_set_vlan(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 }
 
 static int
+igb_vf_set_rlpml(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint16_t rlpml = msgbuf[1] & E1000_VMOLR_RLPML_MASK;
+	uint32_t max_frame = rlpml + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	uint32_t vmolr;
+
+	if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN))
+		return -1;
+
+	vmolr = E1000_READ_REG(hw, E1000_VMOLR(vf));
+
+	vmolr &= ~E1000_VMOLR_RLPML_MASK;
+	vmolr |= rlpml;
+
+	/* Enable Long Packet support */
+	vmolr |= E1000_VMOLR_LPE;
+
+	E1000_WRITE_REG(hw, E1000_VMOLR(vf), vmolr);
+	E1000_WRITE_FLUSH(hw);
+
+	return 0;
+}
+
+static int
 igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 {
 	uint16_t mbx_size = E1000_VFMAILBOX_SIZE;
@@ -428,6 +453,9 @@  igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	case E1000_VF_SET_MULTICAST:
 		retval = igb_vf_set_multicast(dev, vf, msgbuf);
 		break;
+	case E1000_VF_SET_LPE:
+		retval = igb_vf_set_rlpml(dev, vf, msgbuf);
+		break;
 	case E1000_VF_SET_VLAN:
 		retval = igb_vf_set_vlan(dev, vf, msgbuf);
 		break;