The Codes stated the following
P0171:The mass air flow sensor has developed a problem and needs replacing.This is cause the bank 1(v6 has two banks of 3 cylinders each-Bank 1 has cylinder number 1 in it)to run a lean mixture of fuel.When you change the sensor change the filter and check for leaks in the air pipe where the sensor is located.
P0316:Misfiring:Check your spark plugs and get them replaced.Get the injectors cleaned.This problem might be due to the low quality of fuel as well.Try using higher octane premium fuel, if the problem still persists try using octane boosters in the fuel to raise the octane.If the problem still persists check the following.
- Crankshaft Position (CKP) sensor harness is open or shorted
- Crankshaft Position (CKP) sensor circuit poor electrical connection
- Faulty Crankshaft Position (CKP)
- Ignition System