enic: add device ids
[dpdk.git] / lib / librte_pmd_e1000 / igb_pf.c
index 3d405f0..2d49379 100644 (file)
@@ -394,6 +394,31 @@ igb_vf_set_vlan(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        return 0;
 }
 
+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)
 {
@@ -404,7 +429,7 @@ igb_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 
        retval = e1000_read_mbx(hw, msgbuf, mbx_size, vf);
        if (retval) {
-               RTE_LOG(ERR, PMD, "Error mbx recv msg from VF %d\n", vf);
+               PMD_INIT_LOG(ERR, "Error mbx recv msg from VF %d", vf);
                return retval;
        }
 
@@ -428,11 +453,15 @@ 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;
        default:
-               RTE_LOG(DEBUG, PMD, "Unhandled Msg %8.8x\n", (unsigned) msgbuf[0]);
+               PMD_INIT_LOG(DEBUG, "Unhandled Msg %8.8x",
+                            (unsigned) msgbuf[0]);
                retval = E1000_ERR_MBX;
                break;
        }